drizzle-cube 0.4.40 → 0.4.41
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/cli/index.cjs +439 -0
- package/dist/client/charts/ChartLoader.d.ts +18 -3
- package/dist/client/charts/chartConfigRegistry.d.ts +11 -1
- package/dist/client/charts/chartPlugin.d.ts +74 -0
- package/dist/client/charts/lazyChartConfigRegistry.d.ts +10 -0
- package/dist/client/charts.js +13 -15
- package/dist/client/chunks/{DashboardEditModal-iGhIvNP6.js → DashboardEditModal-D_7J62sG.js} +683 -685
- package/dist/client/chunks/DashboardEditModal-D_7J62sG.js.map +1 -0
- package/dist/client/chunks/{FieldSearchModal-BxQ5JhWz.js → FieldSearchModal-5Qz6vvTz.js} +15 -16
- package/dist/client/chunks/{FieldSearchModal-BxQ5JhWz.js.map → FieldSearchModal-5Qz6vvTz.js.map} +1 -1
- package/dist/client/chunks/{RetentionCombinedChart-D4Yf1TnQ.js → RetentionCombinedChart-B1hUYaXt.js} +2 -2
- package/dist/client/chunks/{RetentionCombinedChart-D4Yf1TnQ.js.map → RetentionCombinedChart-B1hUYaXt.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-BoGY6mlZ.js → RetentionHeatmap-Dn2ocjVf.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-BoGY6mlZ.js.map → RetentionHeatmap-Dn2ocjVf.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-DEGG5NwE.js → analysis-builder-DPJJiHVx.js} +1506 -1564
- package/dist/client/chunks/analysis-builder-DPJJiHVx.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-BxHYfTzo.js → analysis-builder-shared-C-C-rOgu.js} +762 -778
- package/dist/client/chunks/analysis-builder-shared-C-C-rOgu.js.map +1 -0
- package/dist/client/chunks/{chart-bar-Bx4oKlqo.js → chart-bar-DVzmau1G.js} +1 -1
- package/dist/client/chunks/{chart-bar-Bx4oKlqo.js.map → chart-bar-DVzmau1G.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-CVIi1aM5.js → chart-box-plot-CCmbHv1Y.js} +1 -1
- package/dist/client/chunks/{chart-box-plot-CVIi1aM5.js.map → chart-box-plot-CCmbHv1Y.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-DvyG15UB.js → chart-bubble-S6qSwWdK.js} +1 -1
- package/dist/client/chunks/{chart-bubble-DvyG15UB.js.map → chart-bubble-S6qSwWdK.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-caHyxB9O.js → chart-candlestick-BNKbDruo.js} +1 -1
- package/dist/client/chunks/{chart-candlestick-caHyxB9O.js.map → chart-candlestick-BNKbDruo.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-USo7JrPh.js → chart-config-activity-grid-BSWS08cI.js} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-USo7JrPh.js.map → chart-config-activity-grid-BSWS08cI.js.map} +1 -1
- package/dist/client/chunks/{chart-config-area-D_ZufYzg.js → chart-config-area-DKwgcHp4.js} +1 -1
- package/dist/client/chunks/{chart-config-area-D_ZufYzg.js.map → chart-config-area-DKwgcHp4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bar-BCi2Wmd6.js → chart-config-bar-deTjEhap.js} +1 -1
- package/dist/client/chunks/{chart-config-bar-BCi2Wmd6.js.map → chart-config-bar-deTjEhap.js.map} +1 -1
- package/dist/client/chunks/{chart-config-box-plot-afKLzJSp.js → chart-config-box-plot-DU4iWk3V.js} +1 -1
- package/dist/client/chunks/{chart-config-box-plot-afKLzJSp.js.map → chart-config-box-plot-DU4iWk3V.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bubble-CgbBjPv8.js → chart-config-bubble-B8FSHSW-.js} +1 -1
- package/dist/client/chunks/{chart-config-bubble-CgbBjPv8.js.map → chart-config-bubble-B8FSHSW-.js.map} +1 -1
- package/dist/client/chunks/{chart-config-candlestick-7boGjZ-A.js → chart-config-candlestick-BGfyWFft.js} +1 -1
- package/dist/client/chunks/{chart-config-candlestick-7boGjZ-A.js.map → chart-config-candlestick-BGfyWFft.js.map} +1 -1
- package/dist/client/chunks/{chart-config-data-table-Cl7sBasW.js → chart-config-data-table-DKRcGa8t.js} +1 -1
- package/dist/client/chunks/{chart-config-data-table-Cl7sBasW.js.map → chart-config-data-table-DKRcGa8t.js.map} +1 -1
- package/dist/client/chunks/{chart-config-funnel-CXPYQtTl.js → chart-config-funnel-Bt4iGFo_.js} +1 -1
- package/dist/client/chunks/{chart-config-funnel-CXPYQtTl.js.map → chart-config-funnel-Bt4iGFo_.js.map} +1 -1
- package/dist/client/chunks/{chart-config-gauge-DUNEUCvh.js → chart-config-gauge-Bk4Jjp3W.js} +1 -1
- package/dist/client/chunks/{chart-config-gauge-DUNEUCvh.js.map → chart-config-gauge-Bk4Jjp3W.js.map} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-BFf1tO11.js → chart-config-heat-map-CkHsqkrY.js} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-BFf1tO11.js.map → chart-config-heat-map-CkHsqkrY.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-C5k2waIJ.js → chart-config-kpi-delta-CkUX98JV.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-C5k2waIJ.js.map → chart-config-kpi-delta-CkUX98JV.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DptOyhk0.js → chart-config-kpi-number-DcxyiUgs.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DptOyhk0.js.map → chart-config-kpi-number-DcxyiUgs.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-D9DdVWqd.js → chart-config-kpi-text-DI4mj8CN.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-D9DdVWqd.js.map → chart-config-kpi-text-DI4mj8CN.js.map} +1 -1
- package/dist/client/chunks/{chart-config-line-B3NgLF7K.js → chart-config-line--j7-dLue.js} +1 -1
- package/dist/client/chunks/{chart-config-line-B3NgLF7K.js.map → chart-config-line--j7-dLue.js.map} +1 -1
- package/dist/client/chunks/{chart-config-markdown-tlfivQTt.js → chart-config-markdown-DUjvVjV4.js} +1 -1
- package/dist/client/chunks/{chart-config-markdown-tlfivQTt.js.map → chart-config-markdown-DUjvVjV4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-measure-profile-D7XDwrU2.js → chart-config-measure-profile-B9FKBNGc.js} +1 -1
- package/dist/client/chunks/{chart-config-measure-profile-D7XDwrU2.js.map → chart-config-measure-profile-B9FKBNGc.js.map} +1 -1
- package/dist/client/chunks/{chart-config-pie-wY0B52PC.js → chart-config-pie-yU4jipl9.js} +1 -1
- package/dist/client/chunks/{chart-config-pie-wY0B52PC.js.map → chart-config-pie-yU4jipl9.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radar-DRpJBy1M.js → chart-config-radar-R9Fkc8wL.js} +1 -1
- package/dist/client/chunks/{chart-config-radar-DRpJBy1M.js.map → chart-config-radar-R9Fkc8wL.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-DCUpXv9G.js → chart-config-radial-bar-DeoXfpIp.js} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-DCUpXv9G.js.map → chart-config-radial-bar-DeoXfpIp.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sankey-CdOhlm4h.js → chart-config-sankey-CXEsxo6s.js} +1 -1
- package/dist/client/chunks/{chart-config-sankey-CdOhlm4h.js.map → chart-config-sankey-CXEsxo6s.js.map} +1 -1
- package/dist/client/chunks/{chart-config-scatter-B2su_x8f.js → chart-config-scatter-MVUFupub.js} +1 -1
- package/dist/client/chunks/{chart-config-scatter-B2su_x8f.js.map → chart-config-scatter-MVUFupub.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-BPdjbk18.js → chart-config-sunburst-Z_gqIY5u.js} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-BPdjbk18.js.map → chart-config-sunburst-Z_gqIY5u.js.map} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-Cbsh2fe2.js → chart-config-tree-map-BD-xAeIy.js} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-Cbsh2fe2.js.map → chart-config-tree-map-BD-xAeIy.js.map} +1 -1
- package/dist/client/chunks/{chart-config-waterfall-DGmuZfQF.js → chart-config-waterfall-CHwVkXZc.js} +1 -1
- package/dist/client/chunks/{chart-config-waterfall-DGmuZfQF.js.map → chart-config-waterfall-CHwVkXZc.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-CW_qZDpt.js → chart-data-table-D4s27-U3.js} +1452 -826
- package/dist/client/chunks/chart-data-table-D4s27-U3.js.map +1 -0
- package/dist/client/chunks/{chart-gauge-BLLJqeXo.js → chart-gauge-BFhc4i_f.js} +1 -1
- package/dist/client/chunks/{chart-gauge-BLLJqeXo.js.map → chart-gauge-BFhc4i_f.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-f2fM2mDC.js → chart-heat-map-BOMQeUDL.js} +1 -1
- package/dist/client/chunks/{chart-heat-map-f2fM2mDC.js.map → chart-heat-map-BOMQeUDL.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-BPexzOe7.js → chart-kpi-delta-DzGNnIcW.js} +4 -4
- package/dist/client/chunks/{chart-kpi-delta-BPexzOe7.js.map → chart-kpi-delta-DzGNnIcW.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-BBtGBtZL.js → chart-kpi-number-sHtgbE_f.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-BBtGBtZL.js.map → chart-kpi-number-sHtgbE_f.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-BqHhmJEB.js → chart-kpi-text-Bmk-GzVJ.js} +2 -2
- package/dist/client/chunks/{chart-kpi-text-BqHhmJEB.js.map → chart-kpi-text-Bmk-GzVJ.js.map} +1 -1
- package/dist/client/chunks/{chart-line-CPhQRMZ7.js → chart-line-Bkl5WQAw.js} +1 -1
- package/dist/client/chunks/{chart-line-CPhQRMZ7.js.map → chart-line-Bkl5WQAw.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-B2X4IwLO.js → chart-markdown-7MNetRtX.js} +1 -1
- package/dist/client/chunks/{chart-markdown-B2X4IwLO.js.map → chart-markdown-7MNetRtX.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-CVlqGslU.js → chart-measure-profile-B7h6vQo4.js} +1 -1
- package/dist/client/chunks/{chart-measure-profile-CVlqGslU.js.map → chart-measure-profile-B7h6vQo4.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-DafSc9sE.js → chart-pie-Do2YnCxl.js} +1 -1
- package/dist/client/chunks/{chart-pie-DafSc9sE.js.map → chart-pie-Do2YnCxl.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-Dz9F5k-B.js → chart-radar-C7gQkH70.js} +1 -1
- package/dist/client/chunks/{chart-radar-Dz9F5k-B.js.map → chart-radar-C7gQkH70.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-N3MNUL7o.js → chart-radial-bar-DHqCck3x.js} +1 -1
- package/dist/client/chunks/{chart-radial-bar-N3MNUL7o.js.map → chart-radial-bar-DHqCck3x.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-J2JNi88S.js → chart-scatter-YSHOUfXf.js} +1 -1
- package/dist/client/chunks/{chart-scatter-J2JNi88S.js.map → chart-scatter-YSHOUfXf.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-D1NFQjqk.js → chart-sunburst-BGhJ4fui.js} +1 -1
- package/dist/client/chunks/{chart-sunburst-D1NFQjqk.js.map → chart-sunburst-BGhJ4fui.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-CbYjko2s.js → chart-tree-map-BlhcXK1F.js} +1 -1
- package/dist/client/chunks/{chart-tree-map-CbYjko2s.js.map → chart-tree-map-BlhcXK1F.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-Z65TGMUO.js → chart-waterfall-BWCAzlPq.js} +1 -1
- package/dist/client/chunks/{chart-waterfall-Z65TGMUO.js.map → chart-waterfall-BWCAzlPq.js.map} +1 -1
- package/dist/client/chunks/{charts-core-CJlGzwsW.js → charts-core-Cy3rHADX.js} +1 -1
- package/dist/client/chunks/{charts-core-CJlGzwsW.js.map → charts-core-Cy3rHADX.js.map} +1 -1
- package/dist/client/chunks/{core-DJrniqct.js → core-BdWfCZ3y.js} +1 -1
- package/dist/client/chunks/{core-DJrniqct.js.map → core-BdWfCZ3y.js.map} +1 -1
- package/dist/client/chunks/{dist-DDBeV_JI.js → dist-BWPE2m_X.js} +1 -1
- package/dist/client/chunks/{dist-DDBeV_JI.js.map → dist-BWPE2m_X.js.map} +1 -1
- package/dist/client/chunks/{javascript-BBwTSo6e.js → javascript-O1RIRkZr.js} +1 -1
- package/dist/client/chunks/{javascript-BBwTSo6e.js.map → javascript-O1RIRkZr.js.map} +1 -1
- package/dist/client/chunks/{json-BpTrLZSh.js → json-C5bX2tt1.js} +1 -1
- package/dist/client/chunks/{json-BpTrLZSh.js.map → json-C5bX2tt1.js.map} +1 -1
- package/dist/client/chunks/{retention-UEXlSdZ-.js → retention-YhT1Oohi.js} +1 -1
- package/dist/client/chunks/{retention-UEXlSdZ-.js.map → retention-YhT1Oohi.js.map} +1 -1
- package/dist/client/chunks/{schema-visualization-CwiEtwdu.js → schema-visualization-BJ8HrNqB.js} +11 -11
- package/dist/client/chunks/{schema-visualization-CwiEtwdu.js.map → schema-visualization-BJ8HrNqB.js.map} +1 -1
- package/dist/client/chunks/{sql-B0chxcEK.js → sql-D2qikO5q.js} +1 -1
- package/dist/client/chunks/{sql-B0chxcEK.js.map → sql-D2qikO5q.js.map} +1 -1
- package/dist/client/chunks/{syntaxHighlighting-BLl0ch4A.js → syntaxHighlighting-BYYWYmjr.js} +2 -2
- package/dist/client/chunks/{syntaxHighlighting-BLl0ch4A.js.map → syntaxHighlighting-BYYWYmjr.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-C_wstEud.js → useDebounce-EWynD0lC.js} +12 -12
- package/dist/client/chunks/{useDebounce-C_wstEud.js.map → useDebounce-EWynD0lC.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CgKZWkel.js → useDirtyStateTracking-KAjwj1Ht.js} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CgKZWkel.js.map → useDirtyStateTracking-KAjwj1Ht.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-C9ytXRIC.js → useExplainAI-BBTJWQVu.js} +14 -14
- package/dist/client/chunks/{useExplainAI-C9ytXRIC.js.map → useExplainAI-BBTJWQVu.js.map} +1 -1
- package/dist/client/chunks/{useNotebookLayout-BFZ_33Kb.js → useNotebookLayout-DKkMenhj.js} +1 -1
- package/dist/client/chunks/{useNotebookLayout-BFZ_33Kb.js.map → useNotebookLayout-DKkMenhj.js.map} +1 -1
- package/dist/client/chunks/{utils-3FNmeZJR.js → utils-DMyRayr_.js} +2 -2
- package/dist/client/chunks/{utils-3FNmeZJR.js.map → utils-DMyRayr_.js.map} +1 -1
- package/dist/client/chunks/{vendor-BPRWulB7.js → vendor-iY25ogTA.js} +40 -40
- package/dist/client/chunks/{vendor-BPRWulB7.js.map → vendor-iY25ogTA.js.map} +1 -1
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +5 -5
- package/dist/client/icons/registry.d.ts +6 -0
- package/dist/client/icons.js +2 -2
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +160 -161
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers/CubeProvider.d.ts +4 -1
- package/dist/client/providers.js +2 -2
- package/dist/client/types.d.ts +2 -1
- package/dist/client/utils.js +6 -6
- package/dist/client-bundle-stats.html +1 -1
- package/package.json +6 -2
- package/dist/client/chunks/DashboardEditModal-iGhIvNP6.js.map +0 -1
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +0 -56
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +0 -1
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +0 -25
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +0 -1
- package/dist/client/chunks/analysis-builder-DEGG5NwE.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-BxHYfTzo.js.map +0 -1
- package/dist/client/chunks/chart-data-table-CW_qZDpt.js.map +0 -1
- package/dist/client/chunks/charts-loader-gZjOqZwG.js +0 -259
- package/dist/client/chunks/charts-loader-gZjOqZwG.js.map +0 -1
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +0 -149
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-
|
|
2
|
-
import {
|
|
3
|
-
import { C as
|
|
4
|
-
import { a as
|
|
5
|
-
import { r as te, s as
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-iY25ogTA.js";
|
|
2
|
+
import { A as s, V as c, u as l } from "./chart-data-table-D4s27-U3.js";
|
|
3
|
+
import { C as u, D as d, E as f, O as p, T as m, a as h, b as g, l as _, n as v, r as y, s as b, t as x } from "./useDebounce-EWynD0lC.js";
|
|
4
|
+
import { a as S, i as ee } from "./useExplainAI-BBTJWQVu.js";
|
|
5
|
+
import { r as te, s as C } from "./chart-funnel-C9JRW79j.js";
|
|
6
6
|
import { A as ne } from "./chart-activity-grid-wR2Twpo7.js";
|
|
7
|
-
import { a as
|
|
8
|
-
import { L as
|
|
9
|
-
import { n as
|
|
10
|
-
import
|
|
11
|
-
import { Fragment as
|
|
7
|
+
import { a as w, s as T, t as E } from "./retention-YhT1Oohi.js";
|
|
8
|
+
import { L as re, R as ie, a as D, c as O, d as k, f as A, g as j, h as ae, l as oe, o as M, s as N, t as P, x as se } from "./FieldSearchModal-5Qz6vvTz.js";
|
|
9
|
+
import { n as ce } from "./charts-core-Cy3rHADX.js";
|
|
10
|
+
import F, { createContext as I, memo as le, useCallback as L, useContext as ue, useEffect as R, useMemo as z, useRef as B, useState as V } from "react";
|
|
11
|
+
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
12
12
|
//#region src/shared/date-utils.ts
|
|
13
|
-
function
|
|
13
|
+
function de(e) {
|
|
14
14
|
let t = /* @__PURE__ */ new Date(), n = e.toLowerCase().trim(), r = t.getUTCFullYear(), i = t.getUTCMonth(), a = t.getUTCDate(), o = t.getUTCDay();
|
|
15
15
|
if (n === "today") {
|
|
16
16
|
let e = new Date(t);
|
|
@@ -123,7 +123,7 @@ function le(e) {
|
|
|
123
123
|
}
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function fe(e) {
|
|
127
127
|
if (Array.isArray(e)) {
|
|
128
128
|
if (e.length < 2) return null;
|
|
129
129
|
let t = new Date(e[0]), n = new Date(e[1]);
|
|
@@ -132,12 +132,12 @@ function ue(e) {
|
|
|
132
132
|
end: n
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
return
|
|
135
|
+
return de(e);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function G(e) {
|
|
138
138
|
return e.toISOString().split("T")[0];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function pe(e, t) {
|
|
141
141
|
let n = t.getTime() - e.getTime(), r = Math.ceil(n / (1e3 * 60 * 60 * 24)), i = new Date(e);
|
|
142
142
|
i.setUTCDate(i.getUTCDate() - 1), i.setUTCHours(23, 59, 59, 999);
|
|
143
143
|
let a = new Date(i);
|
|
@@ -148,27 +148,27 @@ function fe(e, t) {
|
|
|
148
148
|
}
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/client/components/AnalysisBuilder/utils/filterUtils.ts
|
|
151
|
-
function
|
|
151
|
+
function me(e, t) {
|
|
152
152
|
for (let n of e) if ("type" in n && "filters" in n) {
|
|
153
|
-
let e =
|
|
153
|
+
let e = me(n.filters, t);
|
|
154
154
|
if (e) return e;
|
|
155
155
|
} else if ("member" in n) {
|
|
156
156
|
let e = n;
|
|
157
157
|
if (e.member === t && e.operator === "inDateRange" && e.dateRange) return { dateRange: e.dateRange };
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
let n =
|
|
160
|
+
function he(e, t) {
|
|
161
|
+
let n = me(t, e);
|
|
162
162
|
if (!n?.dateRange) return;
|
|
163
|
-
let r =
|
|
163
|
+
let r = fe(n.dateRange);
|
|
164
164
|
if (!r) return;
|
|
165
|
-
let i =
|
|
166
|
-
return [[
|
|
165
|
+
let i = pe(r.start, r.end);
|
|
166
|
+
return [[G(r.start), G(r.end)], [G(i.start), G(i.end)]];
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function ge(e, t) {
|
|
169
169
|
return e.reduce((e, n) => {
|
|
170
170
|
if ("type" in n && "filters" in n) {
|
|
171
|
-
let r = n, i =
|
|
171
|
+
let r = n, i = ge(r.filters, t);
|
|
172
172
|
i.length > 0 && e.push({
|
|
173
173
|
type: r.type,
|
|
174
174
|
filters: i
|
|
@@ -182,10 +182,10 @@ function he(e, t) {
|
|
|
182
182
|
}
|
|
183
183
|
//#endregion
|
|
184
184
|
//#region src/client/components/AnalysisBuilder/utils/queryUtils.ts
|
|
185
|
-
function
|
|
185
|
+
function _e(e, t, n, r, i = !1, a) {
|
|
186
186
|
let o = t.filter((e) => e.isTimeDimension && e.enableComparison).map((e) => e.field), s = n;
|
|
187
|
-
if (!i) for (let e of o) s =
|
|
188
|
-
s = s.filter((e) =>
|
|
187
|
+
if (!i) for (let e of o) s = ge(s, e);
|
|
188
|
+
s = s.filter((e) => se(e));
|
|
189
189
|
let c = {
|
|
190
190
|
measures: e.map((e) => e.field),
|
|
191
191
|
dimensions: t.filter((e) => !e.isTimeDimension).map((e) => e.field),
|
|
@@ -195,7 +195,7 @@ function ge(e, t, n, r, i = !1, a) {
|
|
|
195
195
|
granularity: e.granularity || "day"
|
|
196
196
|
};
|
|
197
197
|
if (e.enableComparison) {
|
|
198
|
-
let r =
|
|
198
|
+
let r = he(e.field, n);
|
|
199
199
|
r && (t.compareDateRange = r);
|
|
200
200
|
}
|
|
201
201
|
return t;
|
|
@@ -219,19 +219,19 @@ function K() {
|
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/client/components/AnalysisBuilder/FilterConfigModal.tsx
|
|
222
|
-
var
|
|
223
|
-
function
|
|
224
|
-
let [a, o] =
|
|
222
|
+
var ve = s("close"), q = s("chevronDown"), J = s("dimension"), Y = s("timeDimension"), ye = s("measure");
|
|
223
|
+
function be({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
|
|
224
|
+
let [a, o] = V(e), [s, c] = V(!1), [l, h] = V(!1), [g, _] = V(!1), [y, b] = V("this_month"), [S, ee] = V(1), [te, C] = V(""), [ne, w] = V(null), [T, E] = V(-1), re = B(null), ie = B(null), D = x(te, 300), k = O(a.member, t), A = k?.field.type || "string", j = A === "time", ae = k?.fieldType === "measure", M = k?.fieldType === "dimension", N = oe(a.member, t), P = p[a.operator], se = m(A), ce = j && a.operator === "inDateRange", F = L(() => [
|
|
225
225
|
"equals",
|
|
226
226
|
"notEquals",
|
|
227
227
|
"in",
|
|
228
228
|
"notIn"
|
|
229
|
-
].includes(a.operator) &&
|
|
229
|
+
].includes(a.operator) && M && !j, [
|
|
230
230
|
a.operator,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
])(), { values:
|
|
234
|
-
|
|
231
|
+
M,
|
|
232
|
+
j
|
|
233
|
+
])(), { values: I, loading: le, error: ue, searchValues: z } = v(a.member, F);
|
|
234
|
+
R(() => {
|
|
235
235
|
if (!i) {
|
|
236
236
|
w(null);
|
|
237
237
|
return;
|
|
@@ -244,58 +244,58 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
244
244
|
top: e.bottom + 8,
|
|
245
245
|
left: a
|
|
246
246
|
});
|
|
247
|
-
}, [i]),
|
|
247
|
+
}, [i]), R(() => {
|
|
248
248
|
let e = (e) => {
|
|
249
|
-
re.current && !re.current.contains(e.target) && (c(!1), h(!1),
|
|
249
|
+
re.current && !re.current.contains(e.target) && (c(!1), h(!1), _(!1));
|
|
250
250
|
};
|
|
251
251
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
252
|
-
}, []),
|
|
253
|
-
|
|
252
|
+
}, []), R(() => {
|
|
253
|
+
l && F && z && z("", !0), l || E(-1);
|
|
254
254
|
}, [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
]),
|
|
259
|
-
if (T >= 0 &&
|
|
260
|
-
let e =
|
|
255
|
+
l,
|
|
256
|
+
F,
|
|
257
|
+
z
|
|
258
|
+
]), R(() => {
|
|
259
|
+
if (T >= 0 && ie.current) {
|
|
260
|
+
let e = ie.current.children[T];
|
|
261
261
|
e && e.scrollIntoView({ block: "nearest" });
|
|
262
262
|
}
|
|
263
|
-
}, [T]),
|
|
264
|
-
|
|
263
|
+
}, [T]), R(() => {
|
|
264
|
+
l && F && z && D !== void 0 && z(D);
|
|
265
265
|
}, [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
]),
|
|
271
|
-
if (!(!
|
|
266
|
+
D,
|
|
267
|
+
l,
|
|
268
|
+
F,
|
|
269
|
+
z
|
|
270
|
+
]), R(() => {
|
|
271
|
+
if (!(!ce || !a.dateRange)) if (Array.isArray(a.dateRange)) b("custom");
|
|
272
272
|
else {
|
|
273
273
|
let e = a.dateRange.match(/^last (\d+) (days|weeks|months|quarters|years)$/), t = !e && a.dateRange.match(/^last (day|week|month|quarter|year)$/);
|
|
274
274
|
if (e) {
|
|
275
275
|
let [, t, n] = e;
|
|
276
|
-
|
|
276
|
+
b(`last_n_${n}`), ee(parseInt(t) || 1);
|
|
277
277
|
} else if (t) {
|
|
278
278
|
let [, e] = t;
|
|
279
|
-
|
|
279
|
+
b(`last_n_${e === "day" ? "days" : e === "week" ? "weeks" : e === "month" ? "months" : e === "quarter" ? "quarters" : "years"}`), ee(1);
|
|
280
280
|
} else {
|
|
281
281
|
let e = !1;
|
|
282
|
-
for (let t of
|
|
283
|
-
|
|
282
|
+
for (let t of d) if (t.value !== "custom" && !f(t.value) && u(t.value) === a.dateRange) {
|
|
283
|
+
b(t.value), e = !0;
|
|
284
284
|
break;
|
|
285
285
|
}
|
|
286
|
-
e ||
|
|
286
|
+
e || b("custom");
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
}, [a.dateRange,
|
|
290
|
-
let
|
|
289
|
+
}, [a.dateRange, ce]);
|
|
290
|
+
let de = L((e) => {
|
|
291
291
|
o({
|
|
292
292
|
member: a.member,
|
|
293
293
|
operator: e,
|
|
294
294
|
values: []
|
|
295
295
|
}), c(!1);
|
|
296
|
-
}, [a.member]),
|
|
296
|
+
}, [a.member]), fe = L((e, t) => {
|
|
297
297
|
let n = t?.shiftKey ?? !1, r = a.values || [];
|
|
298
|
-
|
|
298
|
+
P?.supportsMultipleValues ? (r.includes(e) ? o({
|
|
299
299
|
...a,
|
|
300
300
|
values: r.filter((t) => t !== e)
|
|
301
301
|
}) : o({
|
|
@@ -304,36 +304,36 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
304
304
|
}), n || h(!1)) : (o({
|
|
305
305
|
...a,
|
|
306
306
|
values: [e]
|
|
307
|
-
}), h(!1)),
|
|
308
|
-
}, [a,
|
|
307
|
+
}), h(!1)), C(""), E(-1);
|
|
308
|
+
}, [a, P?.supportsMultipleValues]), G = L((e) => {
|
|
309
309
|
let t = (a.values || []).filter((t) => t !== e);
|
|
310
310
|
o({
|
|
311
311
|
...a,
|
|
312
312
|
values: t
|
|
313
313
|
});
|
|
314
|
-
}, [a]), pe =
|
|
315
|
-
if (!(!
|
|
314
|
+
}, [a]), pe = L((e) => {
|
|
315
|
+
if (!(!l || I.length === 0)) switch (e.key) {
|
|
316
316
|
case "ArrowDown":
|
|
317
|
-
e.preventDefault(), E((e) => e <
|
|
317
|
+
e.preventDefault(), E((e) => e < I.length - 1 ? e + 1 : 0);
|
|
318
318
|
break;
|
|
319
319
|
case "ArrowUp":
|
|
320
|
-
e.preventDefault(), E((e) => e > 0 ? e - 1 :
|
|
320
|
+
e.preventDefault(), E((e) => e > 0 ? e - 1 : I.length - 1);
|
|
321
321
|
break;
|
|
322
322
|
case "Enter":
|
|
323
|
-
e.preventDefault(), T >= 0 && T <
|
|
323
|
+
e.preventDefault(), T >= 0 && T < I.length && fe(I[T], { shiftKey: e.shiftKey });
|
|
324
324
|
break;
|
|
325
325
|
case "Escape":
|
|
326
326
|
e.preventDefault(), h(!1), E(-1);
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
329
329
|
}, [
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
l,
|
|
331
|
+
I,
|
|
332
332
|
T,
|
|
333
|
-
|
|
334
|
-
]), me =
|
|
333
|
+
fe
|
|
334
|
+
]), me = L((e) => {
|
|
335
335
|
let t = e.target.value;
|
|
336
|
-
if (
|
|
336
|
+
if (P?.valueType === "number") {
|
|
337
337
|
let e = parseFloat(t);
|
|
338
338
|
isNaN(e) ? (t === "" || t === "-") && o({
|
|
339
339
|
...a,
|
|
@@ -346,106 +346,106 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
346
346
|
...a,
|
|
347
347
|
values: t ? [t] : []
|
|
348
348
|
});
|
|
349
|
-
}, [a,
|
|
349
|
+
}, [a, P?.valueType]), he = L((e) => {
|
|
350
350
|
let t = parseFloat(e.target.value), n = [isNaN(t) ? "" : t, (a.values?.length >= 2 ? a.values : ["", ""])[1]].filter((e) => e !== "");
|
|
351
351
|
o({
|
|
352
352
|
...a,
|
|
353
353
|
values: n
|
|
354
354
|
});
|
|
355
|
-
}, [a]), ge =
|
|
355
|
+
}, [a]), ge = L((e) => {
|
|
356
356
|
let t = parseFloat(e.target.value), n = [(a.values?.length >= 2 ? a.values : ["", ""])[0], isNaN(t) ? "" : t].filter((e) => e !== "");
|
|
357
357
|
o({
|
|
358
358
|
...a,
|
|
359
359
|
values: n
|
|
360
360
|
});
|
|
361
|
-
}, [a]),
|
|
361
|
+
}, [a]), _e = L((e) => {
|
|
362
362
|
let t = e.target.value;
|
|
363
363
|
o({
|
|
364
364
|
...a,
|
|
365
365
|
values: t ? [t] : []
|
|
366
366
|
});
|
|
367
|
-
}, [a]),
|
|
368
|
-
|
|
367
|
+
}, [a]), K = L((e) => {
|
|
368
|
+
b(e), _(!1);
|
|
369
369
|
let t;
|
|
370
370
|
if (e === "custom") {
|
|
371
371
|
let e = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
372
372
|
t = [e, e];
|
|
373
|
-
} else t =
|
|
373
|
+
} else t = f(e) ? u(e, S) : u(e);
|
|
374
374
|
o({
|
|
375
375
|
...a,
|
|
376
376
|
dateRange: t
|
|
377
377
|
});
|
|
378
|
-
}, [a,
|
|
379
|
-
if (
|
|
380
|
-
let t =
|
|
378
|
+
}, [a, S]), be = L((e) => {
|
|
379
|
+
if (ee(e), f(y)) {
|
|
380
|
+
let t = u(y, e);
|
|
381
381
|
o({
|
|
382
382
|
...a,
|
|
383
383
|
dateRange: t
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
}, [a, y]), xe =
|
|
386
|
+
}, [a, y]), xe = L((e) => {
|
|
387
387
|
let t = e.target.value, n = (Array.isArray(a.dateRange) ? a.dateRange : [a.dateRange || "", ""])[1] || t;
|
|
388
388
|
o({
|
|
389
389
|
...a,
|
|
390
390
|
dateRange: [t, n]
|
|
391
391
|
});
|
|
392
|
-
}, [a]), Se =
|
|
392
|
+
}, [a]), Se = L((e) => {
|
|
393
393
|
let t = e.target.value, n = (Array.isArray(a.dateRange) ? a.dateRange : ["", a.dateRange || ""])[0] || t;
|
|
394
394
|
o({
|
|
395
395
|
...a,
|
|
396
396
|
dateRange: [n, t]
|
|
397
397
|
});
|
|
398
|
-
}, [a]), Ce =
|
|
398
|
+
}, [a]), Ce = se.find((e) => e.operator === a.operator)?.label || a.operator, we = d.find((e) => e.value === y)?.label || "Select range", Te = j ? Y : ae ? ye : J, Ee = () => P?.requiresValues ? ce ? /* @__PURE__ */ W("div", {
|
|
399
399
|
className: "dc:space-y-2",
|
|
400
400
|
children: [
|
|
401
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ W("div", {
|
|
402
402
|
className: "dc:relative",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ W("button", {
|
|
404
404
|
onClick: () => {
|
|
405
|
-
c(!1), h(!1),
|
|
405
|
+
c(!1), h(!1), _(!g);
|
|
406
406
|
},
|
|
407
407
|
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
408
|
-
children: [/* @__PURE__ */
|
|
408
|
+
children: [/* @__PURE__ */ U("span", {
|
|
409
409
|
className: "dc:truncate",
|
|
410
410
|
children: we
|
|
411
|
-
}), /* @__PURE__ */
|
|
412
|
-
}), g && /* @__PURE__ */
|
|
411
|
+
}), /* @__PURE__ */ U(q, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${g ? "dc:rotate-180" : ""}` })]
|
|
412
|
+
}), g && /* @__PURE__ */ U("div", {
|
|
413
413
|
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
414
|
-
children:
|
|
415
|
-
onClick: () =>
|
|
414
|
+
children: d.map((e) => /* @__PURE__ */ U("button", {
|
|
415
|
+
onClick: () => K(e.value),
|
|
416
416
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.value === y ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
417
417
|
children: e.label
|
|
418
418
|
}, e.value))
|
|
419
419
|
})]
|
|
420
420
|
}),
|
|
421
|
-
|
|
421
|
+
f(y) && /* @__PURE__ */ W("div", {
|
|
422
422
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
423
|
-
children: [/* @__PURE__ */
|
|
423
|
+
children: [/* @__PURE__ */ U("input", {
|
|
424
424
|
type: "number",
|
|
425
425
|
min: "1",
|
|
426
426
|
max: "1000",
|
|
427
|
-
value:
|
|
427
|
+
value: S,
|
|
428
428
|
onChange: (e) => be(Math.max(1, parseInt(e.target.value) || 1)),
|
|
429
429
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text dc:w-20"
|
|
430
|
-
}), /* @__PURE__ */
|
|
430
|
+
}), /* @__PURE__ */ U("span", {
|
|
431
431
|
className: "dc:text-sm text-dc-text-muted",
|
|
432
432
|
children: y.replace("last_n_", "")
|
|
433
433
|
})]
|
|
434
434
|
}),
|
|
435
|
-
y === "custom" && /* @__PURE__ */
|
|
435
|
+
y === "custom" && /* @__PURE__ */ W("div", {
|
|
436
436
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
437
437
|
children: [
|
|
438
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ U("input", {
|
|
439
439
|
type: "date",
|
|
440
440
|
value: Array.isArray(a.dateRange) ? a.dateRange[0] : "",
|
|
441
441
|
onChange: xe,
|
|
442
442
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-2 dc:py-2 bg-dc-surface text-dc-text"
|
|
443
443
|
}),
|
|
444
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ U("span", {
|
|
445
445
|
className: "dc:text-sm text-dc-text-muted",
|
|
446
446
|
children: "to"
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ U("input", {
|
|
449
449
|
type: "date",
|
|
450
450
|
value: Array.isArray(a.dateRange) ? a.dateRange[1] : "",
|
|
451
451
|
onChange: Se,
|
|
@@ -454,21 +454,21 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
454
454
|
]
|
|
455
455
|
})
|
|
456
456
|
]
|
|
457
|
-
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */
|
|
457
|
+
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ W("div", {
|
|
458
458
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
459
459
|
children: [
|
|
460
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ U("input", {
|
|
461
461
|
type: "number",
|
|
462
462
|
value: a.values?.[0] ?? "",
|
|
463
463
|
onChange: he,
|
|
464
464
|
placeholder: "Min",
|
|
465
465
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
466
466
|
}),
|
|
467
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ U("span", {
|
|
468
468
|
className: "dc:text-sm text-dc-text-muted",
|
|
469
469
|
children: "to"
|
|
470
470
|
}),
|
|
471
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ U("input", {
|
|
472
472
|
type: "number",
|
|
473
473
|
value: a.values?.[1] ?? "",
|
|
474
474
|
onChange: ge,
|
|
@@ -476,78 +476,78 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
476
476
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
477
477
|
})
|
|
478
478
|
]
|
|
479
|
-
}) :
|
|
479
|
+
}) : P?.valueType === "date" ? /* @__PURE__ */ U("input", {
|
|
480
480
|
type: "date",
|
|
481
481
|
value: a.values?.[0] || "",
|
|
482
|
-
onChange:
|
|
482
|
+
onChange: _e,
|
|
483
483
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
484
|
-
}) :
|
|
484
|
+
}) : P?.valueType === "number" ? /* @__PURE__ */ U("input", {
|
|
485
485
|
type: "number",
|
|
486
486
|
value: a.values?.[0] ?? "",
|
|
487
487
|
onChange: me,
|
|
488
488
|
placeholder: "Enter number",
|
|
489
489
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
490
|
-
}) :
|
|
490
|
+
}) : F ? /* @__PURE__ */ W("div", {
|
|
491
491
|
className: "dc:space-y-2",
|
|
492
492
|
children: [
|
|
493
|
-
a.values && a.values.length > 0 && /* @__PURE__ */
|
|
493
|
+
a.values && a.values.length > 0 && /* @__PURE__ */ U("div", {
|
|
494
494
|
className: "dc:flex dc:flex-wrap dc:gap-1.5",
|
|
495
|
-
children: a.values.map((e, t) => /* @__PURE__ */
|
|
495
|
+
children: a.values.map((e, t) => /* @__PURE__ */ W("span", {
|
|
496
496
|
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",
|
|
497
|
-
children: [/* @__PURE__ */
|
|
497
|
+
children: [/* @__PURE__ */ U("span", {
|
|
498
498
|
className: "dc:max-w-[150px] dc:truncate",
|
|
499
499
|
children: String(e)
|
|
500
|
-
}), /* @__PURE__ */
|
|
501
|
-
onClick: () =>
|
|
500
|
+
}), /* @__PURE__ */ U("button", {
|
|
501
|
+
onClick: () => G(e),
|
|
502
502
|
className: "hover:text-dc-danger",
|
|
503
|
-
children: /* @__PURE__ */
|
|
503
|
+
children: /* @__PURE__ */ U(ve, { className: "dc:w-3.5 dc:h-3.5" })
|
|
504
504
|
})]
|
|
505
505
|
}, t))
|
|
506
506
|
}),
|
|
507
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ W("div", {
|
|
508
508
|
className: "dc:relative",
|
|
509
|
-
children: [/* @__PURE__ */
|
|
509
|
+
children: [/* @__PURE__ */ W("button", {
|
|
510
510
|
onClick: () => {
|
|
511
|
-
c(!1),
|
|
511
|
+
c(!1), _(!1), h(!l);
|
|
512
512
|
},
|
|
513
513
|
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
514
|
-
children: [/* @__PURE__ */
|
|
514
|
+
children: [/* @__PURE__ */ U("span", {
|
|
515
515
|
className: "text-dc-text-muted dc:truncate",
|
|
516
|
-
children:
|
|
517
|
-
}), /* @__PURE__ */
|
|
518
|
-
}),
|
|
516
|
+
children: le ? "Loading..." : "Select value..."
|
|
517
|
+
}), /* @__PURE__ */ U(q, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${l ? "dc:rotate-180" : ""}` })]
|
|
518
|
+
}), l && /* @__PURE__ */ W("div", {
|
|
519
519
|
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-56 dc:overflow-hidden",
|
|
520
|
-
children: [/* @__PURE__ */
|
|
520
|
+
children: [/* @__PURE__ */ U("div", {
|
|
521
521
|
className: "dc:p-2 dc:border-b border-dc-border",
|
|
522
|
-
children: /* @__PURE__ */
|
|
522
|
+
children: /* @__PURE__ */ U("input", {
|
|
523
523
|
type: "text",
|
|
524
|
-
value:
|
|
524
|
+
value: te,
|
|
525
525
|
onChange: (e) => {
|
|
526
|
-
|
|
526
|
+
C(e.target.value), E(-1);
|
|
527
527
|
},
|
|
528
528
|
onKeyDown: pe,
|
|
529
529
|
placeholder: "Search...",
|
|
530
530
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text",
|
|
531
531
|
autoFocus: !0
|
|
532
532
|
})
|
|
533
|
-
}), /* @__PURE__ */
|
|
534
|
-
ref:
|
|
533
|
+
}), /* @__PURE__ */ U("div", {
|
|
534
|
+
ref: ie,
|
|
535
535
|
className: "dc:max-h-40 dc:overflow-y-auto",
|
|
536
|
-
children:
|
|
536
|
+
children: le ? /* @__PURE__ */ U("div", {
|
|
537
537
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
538
538
|
children: "Loading..."
|
|
539
|
-
}) :
|
|
539
|
+
}) : ue ? /* @__PURE__ */ W("div", {
|
|
540
540
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-error",
|
|
541
|
-
children: ["Error: ",
|
|
542
|
-
}) :
|
|
541
|
+
children: ["Error: ", ue]
|
|
542
|
+
}) : I.length === 0 ? /* @__PURE__ */ U("div", {
|
|
543
543
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
544
544
|
children: "No values found"
|
|
545
|
-
}) :
|
|
545
|
+
}) : I.map((e, t) => {
|
|
546
546
|
let n = a.values?.includes(e);
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
onClick: (t) =>
|
|
547
|
+
return /* @__PURE__ */ W("button", {
|
|
548
|
+
onClick: (t) => fe(e, t),
|
|
549
549
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm dc:transition-colors ${t === T ? "bg-dc-surface-hover" : ""} ${n ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text hover:bg-dc-surface-hover"}`,
|
|
550
|
-
children: [String(e), n && /* @__PURE__ */
|
|
550
|
+
children: [String(e), n && /* @__PURE__ */ U("span", {
|
|
551
551
|
className: "dc:float-right",
|
|
552
552
|
children: "✓"
|
|
553
553
|
})]
|
|
@@ -556,31 +556,31 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
556
556
|
})]
|
|
557
557
|
})]
|
|
558
558
|
}),
|
|
559
|
-
|
|
559
|
+
P?.supportsMultipleValues && /* @__PURE__ */ U("p", {
|
|
560
560
|
className: "dc:text-xs text-dc-text-muted",
|
|
561
561
|
children: "Hold Shift to select multiple values"
|
|
562
562
|
})
|
|
563
563
|
]
|
|
564
|
-
}) : /* @__PURE__ */
|
|
564
|
+
}) : /* @__PURE__ */ U("input", {
|
|
565
565
|
type: "text",
|
|
566
566
|
value: a.values?.[0] ?? "",
|
|
567
567
|
onChange: me,
|
|
568
568
|
placeholder: "Enter value...",
|
|
569
569
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text placeholder-dc-text-muted"
|
|
570
|
-
}) : /* @__PURE__ */
|
|
570
|
+
}) : /* @__PURE__ */ U("div", {
|
|
571
571
|
className: "dc:text-sm text-dc-text-muted dc:italic dc:py-2",
|
|
572
572
|
children: "No value required"
|
|
573
573
|
});
|
|
574
|
-
return /* @__PURE__ */
|
|
575
|
-
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${
|
|
574
|
+
return /* @__PURE__ */ U(H, { children: /* @__PURE__ */ U("div", {
|
|
575
|
+
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${ne ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
|
|
576
576
|
onClick: r,
|
|
577
|
-
children: /* @__PURE__ */
|
|
577
|
+
children: /* @__PURE__ */ W("div", {
|
|
578
578
|
ref: re,
|
|
579
|
-
className:
|
|
579
|
+
className: ne ? "bg-dc-surface rounded-lg border border-dc-border" : "bg-dc-surface rounded-lg border border-dc-border max-w-md w-full",
|
|
580
580
|
style: {
|
|
581
|
-
...
|
|
581
|
+
...ne ? {
|
|
582
582
|
position: "fixed",
|
|
583
|
-
...
|
|
583
|
+
...ne,
|
|
584
584
|
maxWidth: "400px",
|
|
585
585
|
width: "100%"
|
|
586
586
|
} : {},
|
|
@@ -588,66 +588,66 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
588
588
|
},
|
|
589
589
|
onClick: (e) => e.stopPropagation(),
|
|
590
590
|
children: [
|
|
591
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ W("div", {
|
|
592
592
|
className: "dc:flex dc:items-center dc:justify-between dc:p-4 dc:border-b border-dc-border",
|
|
593
|
-
children: [/* @__PURE__ */
|
|
593
|
+
children: [/* @__PURE__ */ U("h2", {
|
|
594
594
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
595
595
|
children: "Edit Filter"
|
|
596
|
-
}), /* @__PURE__ */
|
|
596
|
+
}), /* @__PURE__ */ U("button", {
|
|
597
597
|
onClick: r,
|
|
598
598
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-text dc:transition-colors",
|
|
599
|
-
children: /* @__PURE__ */
|
|
599
|
+
children: /* @__PURE__ */ U(ve, { className: "dc:w-5 dc:h-5" })
|
|
600
600
|
})]
|
|
601
601
|
}),
|
|
602
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ W("div", {
|
|
603
603
|
className: "dc:p-4 dc:space-y-4",
|
|
604
604
|
children: [
|
|
605
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("label", {
|
|
606
606
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
607
607
|
children: "Field"
|
|
608
|
-
}), /* @__PURE__ */
|
|
608
|
+
}), /* @__PURE__ */ W("div", {
|
|
609
609
|
className: "dc:flex dc:items-center dc:gap-2 dc:p-3 bg-dc-surface-secondary dc:rounded",
|
|
610
|
-
children: [/* @__PURE__ */
|
|
610
|
+
children: [/* @__PURE__ */ U(Te, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ U("span", {
|
|
611
611
|
className: "dc:text-sm dc:font-medium text-dc-text",
|
|
612
|
-
children:
|
|
612
|
+
children: N
|
|
613
613
|
})]
|
|
614
614
|
})] }),
|
|
615
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("label", {
|
|
616
616
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
617
617
|
children: "Operator"
|
|
618
|
-
}), /* @__PURE__ */
|
|
618
|
+
}), /* @__PURE__ */ W("div", {
|
|
619
619
|
className: "dc:relative",
|
|
620
|
-
children: [/* @__PURE__ */
|
|
620
|
+
children: [/* @__PURE__ */ W("button", {
|
|
621
621
|
onClick: () => {
|
|
622
|
-
h(!1),
|
|
622
|
+
h(!1), _(!1), c(!s);
|
|
623
623
|
},
|
|
624
624
|
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ U("span", {
|
|
626
626
|
className: "dc:truncate",
|
|
627
627
|
children: Ce
|
|
628
|
-
}), /* @__PURE__ */
|
|
629
|
-
}), s && /* @__PURE__ */
|
|
628
|
+
}), /* @__PURE__ */ U(q, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${s ? "dc:rotate-180" : ""}` })]
|
|
629
|
+
}), s && /* @__PURE__ */ U("div", {
|
|
630
630
|
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
631
|
-
children:
|
|
632
|
-
onClick: () =>
|
|
631
|
+
children: se.map((e) => /* @__PURE__ */ U("button", {
|
|
632
|
+
onClick: () => de(e.operator),
|
|
633
633
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.operator === a.operator ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
634
634
|
children: e.label
|
|
635
635
|
}, e.operator))
|
|
636
636
|
})]
|
|
637
637
|
})] }),
|
|
638
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("label", {
|
|
639
639
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
640
640
|
children: "Value"
|
|
641
641
|
}), Ee()] })
|
|
642
642
|
]
|
|
643
643
|
}),
|
|
644
|
-
/* @__PURE__ */
|
|
644
|
+
/* @__PURE__ */ W("div", {
|
|
645
645
|
className: "dc:flex dc:items-center dc:justify-end dc:gap-2 dc:p-4 dc:border-t border-dc-border",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
646
|
+
children: [/* @__PURE__ */ U("button", {
|
|
647
647
|
onClick: r,
|
|
648
648
|
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
649
649
|
children: "Cancel"
|
|
650
|
-
}), /* @__PURE__ */
|
|
650
|
+
}), /* @__PURE__ */ U("button", {
|
|
651
651
|
onClick: () => n(a),
|
|
652
652
|
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-primary-content bg-dc-primary hover:bg-dc-primary-hover dc:rounded dc:transition-colors",
|
|
653
653
|
children: "Save"
|
|
@@ -659,47 +659,47 @@ function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
659
659
|
}
|
|
660
660
|
//#endregion
|
|
661
661
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterItem.tsx
|
|
662
|
-
var
|
|
663
|
-
function
|
|
664
|
-
let [i, a] =
|
|
665
|
-
return /* @__PURE__ */
|
|
662
|
+
var xe = s("close"), Se = s("dimension"), Ce = s("timeDimension"), we = s("measure");
|
|
663
|
+
function Te({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
664
|
+
let [i, a] = V(!1), o = B(null), s = O(e.member, t), c = (s?.field.type || "string") === "time", l = s?.fieldType === "measure", u = oe(e.member, t), d = p[e.operator], f = d?.label || e.operator, m = Ee(e, d), h = c ? Ce : l ? we : Se;
|
|
665
|
+
return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ W("div", {
|
|
666
666
|
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",
|
|
667
667
|
children: [
|
|
668
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ U("span", {
|
|
669
669
|
className: `dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded ${c ? "bg-dc-time-dimension" : l ? "bg-dc-measure" : "bg-dc-dimension"} ${c ? "text-dc-time-dimension-text" : l ? "text-dc-measure-text" : "text-dc-dimension-text"} dc:flex-shrink-0 dc:mt-0.5`,
|
|
670
|
-
children: h && /* @__PURE__ */
|
|
670
|
+
children: h && /* @__PURE__ */ U(h, { className: "dc:w-4 dc:h-4" })
|
|
671
671
|
}),
|
|
672
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ U("button", {
|
|
673
673
|
ref: o,
|
|
674
674
|
onClick: () => a(!0),
|
|
675
675
|
className: "dc:flex-1 dc:min-w-0 dc:text-left",
|
|
676
|
-
title: `${u} ${
|
|
677
|
-
children: /* @__PURE__ */
|
|
676
|
+
title: `${u} ${f} ${m}`,
|
|
677
|
+
children: /* @__PURE__ */ W("div", {
|
|
678
678
|
className: "dc:text-sm text-dc-text dc:break-words",
|
|
679
679
|
children: [
|
|
680
|
-
/* @__PURE__ */
|
|
680
|
+
/* @__PURE__ */ U("span", {
|
|
681
681
|
className: "dc:font-medium",
|
|
682
682
|
children: u
|
|
683
683
|
}),
|
|
684
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ U("span", {
|
|
685
685
|
className: "text-dc-text-muted dc:mx-1",
|
|
686
|
-
children:
|
|
686
|
+
children: f
|
|
687
687
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ U("span", {
|
|
689
689
|
className: "text-dc-primary",
|
|
690
690
|
children: m
|
|
691
691
|
})
|
|
692
692
|
]
|
|
693
693
|
})
|
|
694
694
|
}),
|
|
695
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ U("button", {
|
|
696
696
|
onClick: n,
|
|
697
697
|
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",
|
|
698
698
|
title: "Remove filter",
|
|
699
|
-
children:
|
|
699
|
+
children: xe && /* @__PURE__ */ U(xe, { className: "dc:w-4 dc:h-4" })
|
|
700
700
|
})
|
|
701
701
|
]
|
|
702
|
-
}), i && /* @__PURE__ */
|
|
702
|
+
}), i && /* @__PURE__ */ U(be, {
|
|
703
703
|
filter: e,
|
|
704
704
|
schema: t,
|
|
705
705
|
onSave: (e) => {
|
|
@@ -709,7 +709,7 @@ function we({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
|
709
709
|
anchorElement: o.current
|
|
710
710
|
})] });
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Ee(e, t) {
|
|
713
713
|
if (!t?.requiresValues) return "";
|
|
714
714
|
if (e.dateRange) return Array.isArray(e.dateRange) ? `${e.dateRange[0]} to ${e.dateRange[1]}` : e.dateRange;
|
|
715
715
|
let n = e.values || [];
|
|
@@ -717,34 +717,34 @@ function Te(e, t) {
|
|
|
717
717
|
}
|
|
718
718
|
//#endregion
|
|
719
719
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterGroup.tsx
|
|
720
|
-
var
|
|
721
|
-
function
|
|
720
|
+
var De = s("add"), Oe = s("close");
|
|
721
|
+
function ke(e) {
|
|
722
722
|
return "member" in e && typeof e.member == "string";
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Ae(e) {
|
|
725
725
|
return "type" in e && (e.type === "and" || e.type === "or");
|
|
726
726
|
}
|
|
727
|
-
function
|
|
728
|
-
let [s, c] =
|
|
729
|
-
|
|
727
|
+
function je({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
|
|
728
|
+
let [s, c] = V(!1), l = B(null);
|
|
729
|
+
R(() => {
|
|
730
730
|
let e = (e) => {
|
|
731
731
|
l.current && !l.current.contains(e.target) && c(!1);
|
|
732
732
|
};
|
|
733
733
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
734
734
|
}, []);
|
|
735
|
-
let u =
|
|
735
|
+
let u = L(() => {
|
|
736
736
|
let t = e.type === "and" ? "or" : "and";
|
|
737
737
|
n({
|
|
738
738
|
...e,
|
|
739
739
|
type: t
|
|
740
740
|
});
|
|
741
|
-
}, [e, n]), d =
|
|
741
|
+
}, [e, n]), d = L((t, r) => {
|
|
742
742
|
let i = [...e.filters];
|
|
743
743
|
i[t] = r, n({
|
|
744
744
|
...e,
|
|
745
745
|
filters: i
|
|
746
746
|
});
|
|
747
|
-
}, [e, n]), f =
|
|
747
|
+
}, [e, n]), f = L((t) => {
|
|
748
748
|
let i = e.filters.filter((e, n) => n !== t);
|
|
749
749
|
i.length === 0 ? r() : n({
|
|
750
750
|
...e,
|
|
@@ -755,7 +755,7 @@ function Ae({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
755
755
|
n,
|
|
756
756
|
r,
|
|
757
757
|
a
|
|
758
|
-
]), p =
|
|
758
|
+
]), p = L((t) => {
|
|
759
759
|
let r = {
|
|
760
760
|
type: t,
|
|
761
761
|
filters: []
|
|
@@ -764,23 +764,23 @@ function Ae({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
764
764
|
...e,
|
|
765
765
|
filters: [...e.filters, r]
|
|
766
766
|
}), c(!1);
|
|
767
|
-
}, [e, n]), m =
|
|
767
|
+
}, [e, n]), m = L(() => {
|
|
768
768
|
i([]), c(!1);
|
|
769
|
-
}, [i]), h =
|
|
769
|
+
}, [i]), h = L((e) => (t = []) => {
|
|
770
770
|
i([e, ...t]);
|
|
771
771
|
}, [i]), g = () => a % 2 == 0 ? "border-dc-border" : "border-dc-border dark:border-dc-border", _ = () => e.type === "and" ? "bg-dc-info-bg/50" : "bg-dc-warning-bg/50", v = e.filters.length, y = v === 1 ? "condition" : "conditions";
|
|
772
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ W("div", {
|
|
773
773
|
className: `dc:border ${g()} dc:rounded-lg bg-dc-surface dc:w-full`,
|
|
774
|
-
children: [/* @__PURE__ */
|
|
774
|
+
children: [/* @__PURE__ */ W("div", {
|
|
775
775
|
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 ${_()}`,
|
|
776
|
-
children: [/* @__PURE__ */
|
|
776
|
+
children: [/* @__PURE__ */ W("div", {
|
|
777
777
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
778
|
-
children: [/* @__PURE__ */
|
|
778
|
+
children: [/* @__PURE__ */ U("button", {
|
|
779
779
|
onClick: u,
|
|
780
780
|
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-semibold dc:rounded dc:transition-colors ${e.type === "and" ? "bg-dc-info-bg text-dc-info dc:hover:opacity-80" : "bg-dc-warning-bg text-dc-warning dc:hover:opacity-80"}`,
|
|
781
781
|
title: `Click to switch to ${e.type === "and" ? "OR" : "AND"}`,
|
|
782
782
|
children: e.type.toUpperCase()
|
|
783
|
-
}), /* @__PURE__ */
|
|
783
|
+
}), /* @__PURE__ */ W("span", {
|
|
784
784
|
className: "dc:text-xs text-dc-text-muted",
|
|
785
785
|
children: [
|
|
786
786
|
v,
|
|
@@ -788,61 +788,61 @@ function Ae({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
788
788
|
y
|
|
789
789
|
]
|
|
790
790
|
})]
|
|
791
|
-
}), /* @__PURE__ */
|
|
791
|
+
}), /* @__PURE__ */ W("div", {
|
|
792
792
|
className: "dc:flex dc:items-center dc:gap-1",
|
|
793
|
-
children: [/* @__PURE__ */
|
|
793
|
+
children: [/* @__PURE__ */ W("div", {
|
|
794
794
|
className: "dc:relative",
|
|
795
795
|
ref: l,
|
|
796
|
-
children: [/* @__PURE__ */
|
|
796
|
+
children: [/* @__PURE__ */ U("button", {
|
|
797
797
|
onClick: () => c(!s),
|
|
798
798
|
className: "dc:p-1 text-dc-text-secondary hover:text-dc-primary hover:bg-dc-surface-hover dc:rounded dc:transition-colors",
|
|
799
799
|
title: "Add condition",
|
|
800
|
-
children: /* @__PURE__ */
|
|
801
|
-
}), s && /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ U(De, { className: "dc:w-4 dc:h-4" })
|
|
801
|
+
}), s && /* @__PURE__ */ W("div", {
|
|
802
802
|
className: "dc:absolute dc:right-0 dc:mt-1 dc:z-40 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:py-1 dc:min-w-[120px]",
|
|
803
803
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ U("button", {
|
|
805
805
|
onClick: m,
|
|
806
806
|
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",
|
|
807
807
|
children: "Add Filter"
|
|
808
808
|
}),
|
|
809
|
-
/* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ U("button", {
|
|
810
810
|
onClick: () => p("and"),
|
|
811
811
|
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",
|
|
812
812
|
children: "Add AND Group"
|
|
813
813
|
}),
|
|
814
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ U("button", {
|
|
815
815
|
onClick: () => p("or"),
|
|
816
816
|
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",
|
|
817
817
|
children: "Add OR Group"
|
|
818
818
|
})
|
|
819
819
|
]
|
|
820
820
|
})]
|
|
821
|
-
}), !o && /* @__PURE__ */
|
|
821
|
+
}), !o && /* @__PURE__ */ U("button", {
|
|
822
822
|
onClick: r,
|
|
823
823
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:transition-colors",
|
|
824
824
|
title: "Remove group",
|
|
825
|
-
children: /* @__PURE__ */
|
|
825
|
+
children: /* @__PURE__ */ U(Oe, { className: "dc:w-4 dc:h-4" })
|
|
826
826
|
})]
|
|
827
827
|
})]
|
|
828
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ U("div", {
|
|
829
829
|
className: "dc:p-1.5 dc:flex dc:flex-wrap dc:gap-2",
|
|
830
|
-
children: e.filters.length === 0 ? /* @__PURE__ */
|
|
830
|
+
children: e.filters.length === 0 ? /* @__PURE__ */ W("div", {
|
|
831
831
|
className: "dc:text-center dc:py-3",
|
|
832
|
-
children: [/* @__PURE__ */
|
|
832
|
+
children: [/* @__PURE__ */ U("p", {
|
|
833
833
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
834
834
|
children: "No conditions in this group"
|
|
835
|
-
}), /* @__PURE__ */
|
|
835
|
+
}), /* @__PURE__ */ U("button", {
|
|
836
836
|
onClick: () => i([]),
|
|
837
837
|
className: "dc:text-xs text-dc-primary dc:hover:underline",
|
|
838
838
|
children: "Add a filter"
|
|
839
839
|
})]
|
|
840
|
-
}) : e.filters.map((e, n) =>
|
|
840
|
+
}) : e.filters.map((e, n) => ke(e) ? /* @__PURE__ */ U(Te, {
|
|
841
841
|
filter: e,
|
|
842
842
|
schema: t,
|
|
843
843
|
onUpdate: (e) => d(n, e),
|
|
844
844
|
onRemove: () => f(n)
|
|
845
|
-
}, `filter-${n}`) :
|
|
845
|
+
}, `filter-${n}`) : Ae(e) ? /* @__PURE__ */ U(je, {
|
|
846
846
|
group: e,
|
|
847
847
|
schema: t,
|
|
848
848
|
onUpdate: (e) => d(n, e),
|
|
@@ -855,28 +855,28 @@ function Ae({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
855
855
|
}
|
|
856
856
|
//#endregion
|
|
857
857
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterSection.tsx
|
|
858
|
-
var
|
|
859
|
-
function
|
|
858
|
+
var Me = s("add");
|
|
859
|
+
function Ne(e) {
|
|
860
860
|
return "member" in e && typeof e.member == "string";
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function Pe(e) {
|
|
863
863
|
return "type" in e && (e.type === "and" || e.type === "or");
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function Fe(e) {
|
|
866
866
|
let t = 0;
|
|
867
|
-
for (let n of e)
|
|
867
|
+
for (let n of e) Ne(n) ? t++ : Pe(n) && (t += Fe(n.filters));
|
|
868
868
|
return t;
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function Ie(e) {
|
|
871
871
|
let t = [];
|
|
872
|
-
for (let n of e)
|
|
872
|
+
for (let n of e) Ne(n) ? t.push(n.member) : Pe(n) && t.push(...Ie(n.filters));
|
|
873
873
|
return t;
|
|
874
874
|
}
|
|
875
|
-
function
|
|
876
|
-
if (t.length === 0) return e.length === 0 ? [n] : e.length === 1 &&
|
|
875
|
+
function Le(e, t, n) {
|
|
876
|
+
if (t.length === 0) return e.length === 0 ? [n] : e.length === 1 && Ne(e[0]) ? [{
|
|
877
877
|
type: "and",
|
|
878
878
|
filters: [e[0], n]
|
|
879
|
-
}] : e.length === 1 &&
|
|
879
|
+
}] : e.length === 1 && Pe(e[0]) ? [{
|
|
880
880
|
...e[0],
|
|
881
881
|
filters: [...e[0].filters, n]
|
|
882
882
|
}] : [{
|
|
@@ -884,38 +884,38 @@ function Ie(e, t, n) {
|
|
|
884
884
|
filters: [...e, n]
|
|
885
885
|
}];
|
|
886
886
|
let [r, ...i] = t, a = [...e], o = a[r];
|
|
887
|
-
return
|
|
887
|
+
return Pe(o) && (i.length === 0 ? a[r] = {
|
|
888
888
|
...o,
|
|
889
889
|
filters: [...o.filters, n]
|
|
890
890
|
} : a[r] = {
|
|
891
891
|
...o,
|
|
892
|
-
filters:
|
|
892
|
+
filters: Le(o.filters, i, n)
|
|
893
893
|
}), a;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
896
|
-
let [a, o] =
|
|
895
|
+
function Re({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dimensionsOnly: i = !1 }) {
|
|
896
|
+
let [a, o] = V(!1), [s, c] = V(!1), l = B([]), d = Fe(e), f = L((e) => {
|
|
897
897
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
898
|
-
}, []), p =
|
|
898
|
+
}, []), p = L((e) => {
|
|
899
899
|
e.preventDefault(), e.stopPropagation(), c(!1);
|
|
900
|
-
}, []), m =
|
|
900
|
+
}, []), m = L((e) => {
|
|
901
901
|
e.preventDefault(), e.stopPropagation(), c(!1);
|
|
902
902
|
try {
|
|
903
903
|
let t = JSON.parse(e.dataTransfer.getData("text/plain"));
|
|
904
904
|
t.field && r && r(t.field);
|
|
905
905
|
} catch {}
|
|
906
|
-
}, [r]), h =
|
|
906
|
+
}, [r]), h = Ie(e), g = L((t, r, i) => {
|
|
907
907
|
let a = t.type === "time", s = a ? "inDateRange" : "equals", c = {
|
|
908
908
|
member: t.name,
|
|
909
909
|
operator: s,
|
|
910
910
|
values: []
|
|
911
911
|
};
|
|
912
|
-
a && s === "inDateRange" && (c.dateRange =
|
|
913
|
-
}, [e, n]), _ =
|
|
912
|
+
a && s === "inDateRange" && (c.dateRange = u("this_month")), n(Le(e, l.current, c)), o(!1), l.current = [];
|
|
913
|
+
}, [e, n]), _ = L((t, r) => {
|
|
914
914
|
let i = [...e];
|
|
915
915
|
i[t] = r, n(i);
|
|
916
|
-
}, [e, n]), v =
|
|
916
|
+
}, [e, n]), v = L((t) => {
|
|
917
917
|
let r = e.filter((e, n) => n !== t);
|
|
918
|
-
if (r.length === 1 &&
|
|
918
|
+
if (r.length === 1 && Pe(r[0])) {
|
|
919
919
|
let e = r[0];
|
|
920
920
|
if (e.filters.length === 1) {
|
|
921
921
|
n([e.filters[0]]);
|
|
@@ -923,20 +923,20 @@ function Le({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
n(r);
|
|
926
|
-
}, [e, n]), y =
|
|
926
|
+
}, [e, n]), y = L(() => {
|
|
927
927
|
n([]);
|
|
928
|
-
}, [n]), b =
|
|
929
|
-
|
|
930
|
-
}, []), x =
|
|
931
|
-
|
|
932
|
-
}, []),
|
|
928
|
+
}, [n]), b = L(() => {
|
|
929
|
+
l.current = [], o(!0);
|
|
930
|
+
}, []), x = L((e) => (t = []) => {
|
|
931
|
+
l.current = [...e, ...t], o(!0);
|
|
932
|
+
}, []), S = (n, r, i = []) => {
|
|
933
933
|
let a = [...i, r];
|
|
934
|
-
return
|
|
934
|
+
return Ne(n) ? /* @__PURE__ */ U(Te, {
|
|
935
935
|
filter: n,
|
|
936
936
|
schema: t,
|
|
937
937
|
onUpdate: (e) => _(r, e),
|
|
938
938
|
onRemove: () => v(r)
|
|
939
|
-
}, `filter-${a.join("-")}`) :
|
|
939
|
+
}, `filter-${a.join("-")}`) : Pe(n) ? /* @__PURE__ */ U(je, {
|
|
940
940
|
group: n,
|
|
941
941
|
schema: t,
|
|
942
942
|
onUpdate: (e) => _(r, e),
|
|
@@ -945,21 +945,21 @@ function Le({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
945
945
|
hideRemoveButton: e.length === 1
|
|
946
946
|
}, `group-${a.join("-")}`) : null;
|
|
947
947
|
};
|
|
948
|
-
return /* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ W("div", { children: [
|
|
949
|
+
/* @__PURE__ */ W("button", {
|
|
950
950
|
onClick: b,
|
|
951
951
|
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",
|
|
952
952
|
title: "Add filter",
|
|
953
|
-
children: [/* @__PURE__ */
|
|
953
|
+
children: [/* @__PURE__ */ W(ce, { children: ["Filter", d > 0 && /* @__PURE__ */ W("span", {
|
|
954
954
|
className: "dc:ml-1.5 dc:text-xs dc:font-normal text-dc-text-muted dc:normal-case dc:tracking-normal",
|
|
955
955
|
children: [
|
|
956
956
|
"(",
|
|
957
957
|
d,
|
|
958
958
|
")"
|
|
959
959
|
]
|
|
960
|
-
})] }), /* @__PURE__ */
|
|
960
|
+
})] }), /* @__PURE__ */ W("div", {
|
|
961
961
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
962
|
-
children: [d > 0 && /* @__PURE__ */
|
|
962
|
+
children: [d > 0 && /* @__PURE__ */ U("span", {
|
|
963
963
|
role: "button",
|
|
964
964
|
tabIndex: 0,
|
|
965
965
|
onClick: (e) => {
|
|
@@ -970,26 +970,26 @@ function Le({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
970
970
|
},
|
|
971
971
|
className: "dc:text-xs text-dc-text-muted hover:text-dc-error dc:underline dc:cursor-pointer",
|
|
972
972
|
children: "Clear all"
|
|
973
|
-
}), /* @__PURE__ */
|
|
973
|
+
}), /* @__PURE__ */ U(Me, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
|
|
974
974
|
})]
|
|
975
975
|
}),
|
|
976
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ U("div", {
|
|
977
977
|
onDragOver: r ? f : void 0,
|
|
978
978
|
onDragLeave: r ? p : void 0,
|
|
979
979
|
onDrop: r ? m : void 0,
|
|
980
980
|
className: `dc:p-2 dc:-mx-2 dc:rounded-lg dc:border-2 dc:border-dashed dc:transition-all ${s ? "border-dc-primary bg-dc-primary/5" : "border-transparent"}`,
|
|
981
|
-
children: e.length === 0 ? /* @__PURE__ */
|
|
981
|
+
children: e.length === 0 ? /* @__PURE__ */ U("p", {
|
|
982
982
|
className: `dc:text-sm ${s ? "text-dc-primary dc:font-medium" : "text-dc-text-muted"}`,
|
|
983
983
|
children: s ? "Drop to add filter" : "No filters applied"
|
|
984
|
-
}) : /* @__PURE__ */
|
|
984
|
+
}) : /* @__PURE__ */ U("div", {
|
|
985
985
|
className: "dc:flex dc:flex-wrap dc:gap-2",
|
|
986
|
-
children: e.map((e, t) =>
|
|
986
|
+
children: e.map((e, t) => S(e, t))
|
|
987
987
|
})
|
|
988
988
|
}),
|
|
989
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ U(P, {
|
|
990
990
|
isOpen: a,
|
|
991
991
|
onClose: () => {
|
|
992
|
-
o(!1),
|
|
992
|
+
o(!1), l.current = [];
|
|
993
993
|
},
|
|
994
994
|
onSelect: g,
|
|
995
995
|
mode: i ? "dimensionFilter" : "filter",
|
|
@@ -1000,23 +1000,23 @@ function Le({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
1000
1000
|
}
|
|
1001
1001
|
//#endregion
|
|
1002
1002
|
//#region src/client/shared/chartDefaults.ts
|
|
1003
|
-
function Re(e) {
|
|
1004
|
-
return e.isTimeDimension;
|
|
1005
|
-
}
|
|
1006
1003
|
function ze(e) {
|
|
1007
|
-
return e.
|
|
1004
|
+
return e.isTimeDimension;
|
|
1008
1005
|
}
|
|
1009
1006
|
function Be(e) {
|
|
1010
|
-
return e.find(
|
|
1007
|
+
return e.find(ze);
|
|
1011
1008
|
}
|
|
1012
1009
|
function Ve(e) {
|
|
1013
|
-
return e.
|
|
1010
|
+
return e.find((e) => !e.isTimeDimension);
|
|
1014
1011
|
}
|
|
1015
1012
|
function He(e) {
|
|
1016
|
-
return e.filter(
|
|
1013
|
+
return e.filter((e) => !e.isTimeDimension);
|
|
1014
|
+
}
|
|
1015
|
+
function Ue(e) {
|
|
1016
|
+
return e.filter(ze);
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1019
|
-
let r = t.length, i =
|
|
1018
|
+
function We(e, t, n) {
|
|
1019
|
+
let r = t.length, i = He(n).length, a = Ue(n).length, o = n.length;
|
|
1020
1020
|
switch (e) {
|
|
1021
1021
|
case "table":
|
|
1022
1022
|
case "markdown": return { available: !0 };
|
|
@@ -1099,41 +1099,25 @@ function Ue(e, t, n) {
|
|
|
1099
1099
|
default: return { available: !0 };
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let n =
|
|
1104
|
-
|
|
1105
|
-
"area",
|
|
1106
|
-
"bar",
|
|
1107
|
-
"bubble",
|
|
1108
|
-
"kpiDelta",
|
|
1109
|
-
"kpiNumber",
|
|
1110
|
-
"kpiText",
|
|
1111
|
-
"line",
|
|
1112
|
-
"markdown",
|
|
1113
|
-
"pie",
|
|
1114
|
-
"radar",
|
|
1115
|
-
"radialBar",
|
|
1116
|
-
"scatter",
|
|
1117
|
-
"table",
|
|
1118
|
-
"treemap"
|
|
1119
|
-
], r = {};
|
|
1120
|
-
for (let i of n) r[i] = Ue(i, e, t);
|
|
1102
|
+
function Ge(e, t) {
|
|
1103
|
+
let n = Object.keys(l), r = {};
|
|
1104
|
+
for (let i of n) r[i] = We(i, e, t);
|
|
1121
1105
|
return r;
|
|
1122
1106
|
}
|
|
1123
|
-
function
|
|
1124
|
-
if (
|
|
1125
|
-
let r =
|
|
1107
|
+
function Ke(e, t, n) {
|
|
1108
|
+
if (We(n, e, t).available || e.length === 0 && t.length === 0) return n;
|
|
1109
|
+
let r = Ue(t).length > 0, i = He(t).length > 0, a = e.length > 0;
|
|
1126
1110
|
return r && a ? "line" : i && a ? "bar" : a && !i && !r ? "kpiNumber" : "table";
|
|
1127
1111
|
}
|
|
1128
|
-
function
|
|
1129
|
-
let r =
|
|
1112
|
+
function qe(e, t, n) {
|
|
1113
|
+
let r = Ke(e, t, n);
|
|
1130
1114
|
return {
|
|
1131
1115
|
chartType: r,
|
|
1132
|
-
chartConfig:
|
|
1116
|
+
chartConfig: Je(r, e, t)
|
|
1133
1117
|
};
|
|
1134
1118
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let r =
|
|
1119
|
+
function Je(e, t, n) {
|
|
1120
|
+
let r = Be(n), i = Ve(n), a = He(n), o = n;
|
|
1137
1121
|
switch (e) {
|
|
1138
1122
|
case "line":
|
|
1139
1123
|
case "area": return {
|
|
@@ -1186,35 +1170,35 @@ function qe(e, t, n) {
|
|
|
1186
1170
|
};
|
|
1187
1171
|
}
|
|
1188
1172
|
}
|
|
1189
|
-
function
|
|
1190
|
-
if (r &&
|
|
1191
|
-
let i =
|
|
1173
|
+
function Ye(e, t, n, r) {
|
|
1174
|
+
if (r && We(n, e, t).available) return null;
|
|
1175
|
+
let i = Ke(e, t, n);
|
|
1192
1176
|
return i === n ? null : i;
|
|
1193
1177
|
}
|
|
1194
1178
|
//#endregion
|
|
1195
1179
|
//#region src/client/components/AnalysisBuilder/ExplainAIPanel.tsx
|
|
1196
|
-
function
|
|
1180
|
+
function Xe(e) {
|
|
1197
1181
|
return typeof e == "string" ? e : typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "");
|
|
1198
1182
|
}
|
|
1199
|
-
var
|
|
1183
|
+
var Ze = {
|
|
1200
1184
|
good: "bg-dc-success-bg text-dc-success border-dc-success",
|
|
1201
1185
|
warning: "bg-dc-warning-bg text-dc-warning border-dc-warning",
|
|
1202
1186
|
critical: "bg-dc-danger-bg text-dc-error border-dc-error"
|
|
1203
|
-
},
|
|
1187
|
+
}, Qe = {
|
|
1204
1188
|
critical: "bg-dc-danger-bg text-dc-error",
|
|
1205
1189
|
warning: "bg-dc-warning-bg text-dc-warning",
|
|
1206
1190
|
suggestion: "bg-dc-accent-bg text-dc-accent"
|
|
1207
|
-
},
|
|
1191
|
+
}, $e = {
|
|
1208
1192
|
high: "text-dc-error",
|
|
1209
1193
|
medium: "text-dc-warning",
|
|
1210
1194
|
low: "text-dc-text-muted"
|
|
1211
1195
|
};
|
|
1212
|
-
function
|
|
1213
|
-
return /* @__PURE__ */
|
|
1214
|
-
className: `dc:p-4 dc:rounded-lg dc:border ${
|
|
1215
|
-
children: [/* @__PURE__ */
|
|
1196
|
+
function et({ assessment: e, reason: t }) {
|
|
1197
|
+
return /* @__PURE__ */ W("div", {
|
|
1198
|
+
className: `dc:p-4 dc:rounded-lg dc:border ${Ze[e]}`,
|
|
1199
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1216
1200
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-1",
|
|
1217
|
-
children: /* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ W("span", {
|
|
1218
1202
|
className: "dc:font-semibold dc:uppercase dc:text-base",
|
|
1219
1203
|
children: [
|
|
1220
1204
|
e === "good" && "✓ ",
|
|
@@ -1227,33 +1211,33 @@ function $e({ assessment: e, reason: t }) {
|
|
|
1227
1211
|
}[e]
|
|
1228
1212
|
]
|
|
1229
1213
|
})
|
|
1230
|
-
}), /* @__PURE__ */
|
|
1214
|
+
}), /* @__PURE__ */ U("p", {
|
|
1231
1215
|
className: "dc:text-sm",
|
|
1232
|
-
children:
|
|
1216
|
+
children: Xe(t)
|
|
1233
1217
|
})]
|
|
1234
1218
|
});
|
|
1235
1219
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return /* @__PURE__ */
|
|
1220
|
+
function tt({ issue: e }) {
|
|
1221
|
+
return /* @__PURE__ */ W("div", {
|
|
1238
1222
|
className: "dc:flex dc:items-start dc:gap-2 dc:py-2",
|
|
1239
|
-
children: [/* @__PURE__ */
|
|
1240
|
-
className: `dc:text-sm ${
|
|
1223
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1224
|
+
className: `dc:text-sm ${$e[e.severity]}`,
|
|
1241
1225
|
children: [
|
|
1242
1226
|
e.severity === "high" && "●",
|
|
1243
1227
|
e.severity === "medium" && "○",
|
|
1244
1228
|
e.severity === "low" && "○"
|
|
1245
1229
|
]
|
|
1246
|
-
}), /* @__PURE__ */
|
|
1230
|
+
}), /* @__PURE__ */ U("span", {
|
|
1247
1231
|
className: "dc:text-sm text-dc-text-secondary",
|
|
1248
|
-
children:
|
|
1232
|
+
children: Xe(e.description)
|
|
1249
1233
|
})]
|
|
1250
1234
|
});
|
|
1251
1235
|
}
|
|
1252
|
-
function
|
|
1253
|
-
let [t, n] =
|
|
1254
|
-
return
|
|
1236
|
+
function nt({ text: e }) {
|
|
1237
|
+
let [t, n] = F.useState(!1), r = F.useRef(null);
|
|
1238
|
+
return F.useEffect(() => () => {
|
|
1255
1239
|
r.current && clearTimeout(r.current);
|
|
1256
|
-
}, []), /* @__PURE__ */
|
|
1240
|
+
}, []), /* @__PURE__ */ U("button", {
|
|
1257
1241
|
onClick: async () => {
|
|
1258
1242
|
try {
|
|
1259
1243
|
await navigator.clipboard.writeText(e), n(!0), r.current && clearTimeout(r.current), r.current = setTimeout(() => n(!1), 2e3);
|
|
@@ -1266,110 +1250,110 @@ function tt({ text: e }) {
|
|
|
1266
1250
|
children: t ? "Copied!" : "Copy"
|
|
1267
1251
|
});
|
|
1268
1252
|
}
|
|
1269
|
-
function
|
|
1270
|
-
return /* @__PURE__ */
|
|
1253
|
+
function rt({ rec: e }) {
|
|
1254
|
+
return /* @__PURE__ */ W("div", {
|
|
1271
1255
|
className: "dc:p-4 dc:border border-dc-border dc:rounded-lg bg-dc-surface",
|
|
1272
1256
|
children: [
|
|
1273
|
-
/* @__PURE__ */
|
|
1257
|
+
/* @__PURE__ */ W("div", {
|
|
1274
1258
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-2",
|
|
1275
|
-
children: [/* @__PURE__ */
|
|
1276
|
-
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${
|
|
1259
|
+
children: [/* @__PURE__ */ U("span", {
|
|
1260
|
+
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${Qe[e.severity]}`,
|
|
1277
1261
|
children: {
|
|
1278
1262
|
index: "INDEX",
|
|
1279
1263
|
table: "TABLE",
|
|
1280
1264
|
cube: "CUBE",
|
|
1281
1265
|
general: "TIP"
|
|
1282
1266
|
}[e.type]
|
|
1283
|
-
}), /* @__PURE__ */
|
|
1267
|
+
}), /* @__PURE__ */ U("h5", {
|
|
1284
1268
|
className: "dc:font-medium text-dc-text",
|
|
1285
|
-
children:
|
|
1269
|
+
children: Xe(e.title)
|
|
1286
1270
|
})]
|
|
1287
1271
|
}),
|
|
1288
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ U("p", {
|
|
1289
1273
|
className: "dc:text-sm text-dc-text-secondary dc:mb-3",
|
|
1290
|
-
children:
|
|
1274
|
+
children: Xe(e.description)
|
|
1291
1275
|
}),
|
|
1292
|
-
e.sql && /* @__PURE__ */
|
|
1276
|
+
e.sql && /* @__PURE__ */ U("div", {
|
|
1293
1277
|
className: "dc:mt-2",
|
|
1294
|
-
children: /* @__PURE__ */
|
|
1278
|
+
children: /* @__PURE__ */ U(j, {
|
|
1295
1279
|
code: e.sql,
|
|
1296
1280
|
language: "sql",
|
|
1297
|
-
headerRight: /* @__PURE__ */
|
|
1281
|
+
headerRight: /* @__PURE__ */ U(nt, { text: e.sql })
|
|
1298
1282
|
})
|
|
1299
1283
|
}),
|
|
1300
|
-
e.cubeCode && /* @__PURE__ */
|
|
1284
|
+
e.cubeCode && /* @__PURE__ */ W("div", {
|
|
1301
1285
|
className: "dc:mt-2",
|
|
1302
|
-
children: [e.cubeName && /* @__PURE__ */
|
|
1286
|
+
children: [e.cubeName && /* @__PURE__ */ W("p", {
|
|
1303
1287
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
1304
1288
|
children: [
|
|
1305
1289
|
"Add to ",
|
|
1306
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ U("code", {
|
|
1307
1291
|
className: "bg-dc-surface-secondary dc:px-1 dc:rounded",
|
|
1308
1292
|
children: e.cubeName
|
|
1309
1293
|
}),
|
|
1310
1294
|
" cube:"
|
|
1311
1295
|
]
|
|
1312
|
-
}), /* @__PURE__ */
|
|
1296
|
+
}), /* @__PURE__ */ W("div", {
|
|
1313
1297
|
className: "dc:relative",
|
|
1314
|
-
children: [/* @__PURE__ */
|
|
1298
|
+
children: [/* @__PURE__ */ U("pre", {
|
|
1315
1299
|
className: "dc:p-3 dc:text-xs bg-dc-surface-secondary dc:rounded dc:overflow-x-auto dc:font-mono text-dc-text",
|
|
1316
1300
|
children: e.cubeCode
|
|
1317
|
-
}), /* @__PURE__ */
|
|
1301
|
+
}), /* @__PURE__ */ U("div", {
|
|
1318
1302
|
className: "dc:absolute dc:top-1 dc:right-1",
|
|
1319
|
-
children: /* @__PURE__ */
|
|
1303
|
+
children: /* @__PURE__ */ U(nt, { text: e.cubeCode })
|
|
1320
1304
|
})]
|
|
1321
1305
|
})]
|
|
1322
1306
|
}),
|
|
1323
|
-
e.estimatedImpact && /* @__PURE__ */
|
|
1307
|
+
e.estimatedImpact && /* @__PURE__ */ W("p", {
|
|
1324
1308
|
className: "dc:text-xs text-dc-text-muted dc:mt-2",
|
|
1325
1309
|
children: [
|
|
1326
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ U("strong", { children: "Expected impact:" }),
|
|
1327
1311
|
" ",
|
|
1328
|
-
|
|
1312
|
+
Xe(e.estimatedImpact)
|
|
1329
1313
|
]
|
|
1330
1314
|
})
|
|
1331
1315
|
]
|
|
1332
1316
|
});
|
|
1333
1317
|
}
|
|
1334
|
-
function
|
|
1318
|
+
function it({ analysis: e, onClose: t, onClear: n }) {
|
|
1335
1319
|
let r = t || n;
|
|
1336
|
-
return
|
|
1320
|
+
return F.useEffect(() => {
|
|
1337
1321
|
let e = (e) => {
|
|
1338
1322
|
e.key === "Escape" && r && r();
|
|
1339
1323
|
};
|
|
1340
1324
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1341
|
-
}, [r]),
|
|
1325
|
+
}, [r]), F.useEffect(() => (document.body.style.overflow = "hidden", () => {
|
|
1342
1326
|
document.body.style.overflow = "";
|
|
1343
|
-
}), []), /* @__PURE__ */
|
|
1327
|
+
}), []), /* @__PURE__ */ W("div", {
|
|
1344
1328
|
className: "dc:fixed dc:inset-0 dc:z-50 dc:flex dc:items-center dc:justify-center dc:p-4 bg-black/50",
|
|
1345
|
-
children: [/* @__PURE__ */
|
|
1329
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1346
1330
|
className: "dc:absolute dc:inset-0",
|
|
1347
1331
|
onClick: r,
|
|
1348
1332
|
"aria-hidden": "true"
|
|
1349
|
-
}), /* @__PURE__ */
|
|
1333
|
+
}), /* @__PURE__ */ W("div", {
|
|
1350
1334
|
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",
|
|
1351
1335
|
children: [
|
|
1352
|
-
/* @__PURE__ */
|
|
1336
|
+
/* @__PURE__ */ W("div", {
|
|
1353
1337
|
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",
|
|
1354
|
-
children: [/* @__PURE__ */
|
|
1338
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1355
1339
|
className: "dc:flex dc:items-center dc:gap-3",
|
|
1356
|
-
children: [/* @__PURE__ */
|
|
1340
|
+
children: [/* @__PURE__ */ U("span", {
|
|
1357
1341
|
className: "dc:text-lg",
|
|
1358
1342
|
children: "✨"
|
|
1359
|
-
}), /* @__PURE__ */
|
|
1343
|
+
}), /* @__PURE__ */ U("h3", {
|
|
1360
1344
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
1361
1345
|
children: "AI Performance Analysis"
|
|
1362
1346
|
})]
|
|
1363
|
-
}), /* @__PURE__ */
|
|
1347
|
+
}), /* @__PURE__ */ U("button", {
|
|
1364
1348
|
onClick: r,
|
|
1365
1349
|
className: "dc:p-2 dc:rounded-lg hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
1366
1350
|
"aria-label": "Close",
|
|
1367
|
-
children: /* @__PURE__ */
|
|
1351
|
+
children: /* @__PURE__ */ U("svg", {
|
|
1368
1352
|
className: "dc:w-5 dc:h-5",
|
|
1369
1353
|
fill: "none",
|
|
1370
1354
|
stroke: "currentColor",
|
|
1371
1355
|
viewBox: "0 0 24 24",
|
|
1372
|
-
children: /* @__PURE__ */
|
|
1356
|
+
children: /* @__PURE__ */ U("path", {
|
|
1373
1357
|
strokeLinecap: "round",
|
|
1374
1358
|
strokeLinejoin: "round",
|
|
1375
1359
|
strokeWidth: 2,
|
|
@@ -1378,65 +1362,65 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1378
1362
|
})
|
|
1379
1363
|
})]
|
|
1380
1364
|
}),
|
|
1381
|
-
/* @__PURE__ */
|
|
1365
|
+
/* @__PURE__ */ W("div", {
|
|
1382
1366
|
className: "dc:flex-1 dc:overflow-y-auto dc:px-6 dc:py-4 dc:space-y-6",
|
|
1383
1367
|
children: [
|
|
1384
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ U(et, {
|
|
1385
1369
|
assessment: e.assessment,
|
|
1386
1370
|
reason: e.assessmentReason
|
|
1387
1371
|
}),
|
|
1388
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("h4", {
|
|
1389
1373
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1390
1374
|
children: "Summary"
|
|
1391
|
-
}), /* @__PURE__ */
|
|
1375
|
+
}), /* @__PURE__ */ U("p", {
|
|
1392
1376
|
className: "text-dc-text",
|
|
1393
|
-
children:
|
|
1377
|
+
children: Xe(e.summary)
|
|
1394
1378
|
})] }),
|
|
1395
|
-
e.queryUnderstanding && /* @__PURE__ */
|
|
1379
|
+
e.queryUnderstanding && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U("h4", {
|
|
1396
1380
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1397
1381
|
children: "Query Analysis"
|
|
1398
|
-
}), /* @__PURE__ */
|
|
1382
|
+
}), /* @__PURE__ */ U("p", {
|
|
1399
1383
|
className: "text-dc-text-secondary",
|
|
1400
|
-
children:
|
|
1384
|
+
children: Xe(e.queryUnderstanding)
|
|
1401
1385
|
})] }),
|
|
1402
|
-
e.issues && e.issues.length > 0 && /* @__PURE__ */
|
|
1386
|
+
e.issues && e.issues.length > 0 && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ W("h4", {
|
|
1403
1387
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1404
1388
|
children: [
|
|
1405
1389
|
"Issues Found (",
|
|
1406
1390
|
e.issues.length,
|
|
1407
1391
|
")"
|
|
1408
1392
|
]
|
|
1409
|
-
}), /* @__PURE__ */
|
|
1393
|
+
}), /* @__PURE__ */ U("div", {
|
|
1410
1394
|
className: "dc:space-y-1 bg-dc-surface-secondary dc:rounded-lg dc:p-3",
|
|
1411
|
-
children: e.issues.map((e, t) => /* @__PURE__ */
|
|
1395
|
+
children: e.issues.map((e, t) => /* @__PURE__ */ U(tt, { issue: e }, t))
|
|
1412
1396
|
})] }),
|
|
1413
|
-
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */
|
|
1397
|
+
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ W("div", { children: [/* @__PURE__ */ W("h4", {
|
|
1414
1398
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-3",
|
|
1415
1399
|
children: [
|
|
1416
1400
|
"Recommendations (",
|
|
1417
1401
|
e.recommendations.length,
|
|
1418
1402
|
")"
|
|
1419
1403
|
]
|
|
1420
|
-
}), /* @__PURE__ */
|
|
1404
|
+
}), /* @__PURE__ */ U("div", {
|
|
1421
1405
|
className: "dc:space-y-4",
|
|
1422
|
-
children: e.recommendations.map((e, t) => /* @__PURE__ */
|
|
1406
|
+
children: e.recommendations.map((e, t) => /* @__PURE__ */ U(rt, { rec: e }, t))
|
|
1423
1407
|
})] }),
|
|
1424
|
-
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */
|
|
1408
|
+
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ U("div", {
|
|
1425
1409
|
className: "text-dc-text-muted dc:italic dc:p-4 bg-dc-surface-secondary dc:rounded-lg",
|
|
1426
1410
|
children: "No specific recommendations. The query appears to be well-optimized."
|
|
1427
1411
|
})
|
|
1428
1412
|
]
|
|
1429
1413
|
}),
|
|
1430
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ W("div", {
|
|
1431
1415
|
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",
|
|
1432
|
-
children: [e._meta && /* @__PURE__ */
|
|
1416
|
+
children: [e._meta && /* @__PURE__ */ W("div", {
|
|
1433
1417
|
className: "dc:text-xs text-dc-text-muted",
|
|
1434
1418
|
children: [
|
|
1435
1419
|
"Model: ",
|
|
1436
1420
|
e._meta.model,
|
|
1437
1421
|
e._meta.usingUserKey && " (using your API key)"
|
|
1438
1422
|
]
|
|
1439
|
-
}), /* @__PURE__ */
|
|
1423
|
+
}), /* @__PURE__ */ U("button", {
|
|
1440
1424
|
onClick: r,
|
|
1441
1425
|
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",
|
|
1442
1426
|
children: "Close"
|
|
@@ -1448,93 +1432,93 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1448
1432
|
}
|
|
1449
1433
|
//#endregion
|
|
1450
1434
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanel.tsx
|
|
1451
|
-
var
|
|
1452
|
-
let [v, y] =
|
|
1435
|
+
var at = le(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" }) {
|
|
1436
|
+
let [v, y] = V(!1), [b, x] = V(!1), S = e ? e.sql + (e.params && e.params.length > 0 ? "\n\n-- Parameters:\n" + JSON.stringify(e.params, null, 2) : "") : "", ee = () => {
|
|
1453
1437
|
f && i && h && (f(i, h), x(!0));
|
|
1454
|
-
},
|
|
1438
|
+
}, te = () => {
|
|
1455
1439
|
x(!1);
|
|
1456
|
-
},
|
|
1457
|
-
onClick:
|
|
1440
|
+
}, C = m && i ? /* @__PURE__ */ U("button", {
|
|
1441
|
+
onClick: ee,
|
|
1458
1442
|
disabled: u,
|
|
1459
1443
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded bg-dc-accent text-white hover:bg-dc-accent-hover dc:disabled:opacity-50 dc:disabled:cursor-not-allowed dc:flex dc:items-center dc:gap-1",
|
|
1460
|
-
children: u ? /* @__PURE__ */
|
|
1444
|
+
children: u ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("span", {
|
|
1461
1445
|
className: "dc:animate-spin",
|
|
1462
1446
|
children: "⟳"
|
|
1463
|
-
}), "Analyzing..."] }) : /* @__PURE__ */
|
|
1447
|
+
}), "Analyzing..."] }) : /* @__PURE__ */ U(H, { children: "✨ AI Analysis" })
|
|
1464
1448
|
}) : null;
|
|
1465
|
-
return /* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ W("div", {
|
|
1466
1450
|
className: "dc:space-y-3",
|
|
1467
1451
|
children: [
|
|
1468
|
-
t ? /* @__PURE__ */
|
|
1452
|
+
t ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("h4", {
|
|
1469
1453
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
1470
1454
|
children: g
|
|
1471
|
-
}), /* @__PURE__ */
|
|
1455
|
+
}), /* @__PURE__ */ U("div", {
|
|
1472
1456
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
1473
1457
|
style: { height: _ },
|
|
1474
1458
|
children: "Loading SQL..."
|
|
1475
|
-
})] }) : n ? /* @__PURE__ */
|
|
1459
|
+
})] }) : n ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("h4", {
|
|
1476
1460
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
1477
1461
|
children: g
|
|
1478
|
-
}), /* @__PURE__ */
|
|
1462
|
+
}), /* @__PURE__ */ U("div", {
|
|
1479
1463
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1480
1464
|
style: { height: _ },
|
|
1481
1465
|
children: n.message
|
|
1482
|
-
})] }) : e ? /* @__PURE__ */
|
|
1483
|
-
code:
|
|
1466
|
+
})] }) : e ? /* @__PURE__ */ U(j, {
|
|
1467
|
+
code: S,
|
|
1484
1468
|
language: "sql",
|
|
1485
1469
|
title: g,
|
|
1486
1470
|
height: _,
|
|
1487
|
-
headerRight: /* @__PURE__ */
|
|
1471
|
+
headerRight: /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ W("label", {
|
|
1488
1472
|
className: "dc:flex dc:items-center dc:gap-1 dc:text-xs text-dc-text-secondary dc:cursor-pointer",
|
|
1489
|
-
children: [/* @__PURE__ */
|
|
1473
|
+
children: [/* @__PURE__ */ U("input", {
|
|
1490
1474
|
type: "checkbox",
|
|
1491
1475
|
checked: v,
|
|
1492
1476
|
onChange: (e) => y(e.target.checked),
|
|
1493
1477
|
className: "dc:w-3 dc:h-3 dc:rounded border-dc-border text-dc-accent focus:ring-dc-accent"
|
|
1494
1478
|
}), "Include timing"]
|
|
1495
|
-
}), /* @__PURE__ */
|
|
1479
|
+
}), /* @__PURE__ */ U("button", {
|
|
1496
1480
|
onClick: () => c({ analyze: v }),
|
|
1497
1481
|
disabled: a,
|
|
1498
1482
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded dc:border border-dc-border bg-dc-surface hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors dc:disabled:opacity-50 dc:disabled:cursor-not-allowed",
|
|
1499
1483
|
children: a ? "Running..." : "Explain Plan"
|
|
1500
1484
|
})] })
|
|
1501
|
-
}) : /* @__PURE__ */
|
|
1485
|
+
}) : /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("h4", {
|
|
1502
1486
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
1503
1487
|
children: g
|
|
1504
|
-
}), /* @__PURE__ */
|
|
1488
|
+
}), /* @__PURE__ */ U("div", {
|
|
1505
1489
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm",
|
|
1506
1490
|
style: { height: _ },
|
|
1507
1491
|
children: r
|
|
1508
1492
|
})] }),
|
|
1509
|
-
o && /* @__PURE__ */
|
|
1493
|
+
o && /* @__PURE__ */ U("div", { children: a ? /* @__PURE__ */ W("div", {
|
|
1510
1494
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
1511
1495
|
children: [
|
|
1512
1496
|
"Running EXPLAIN",
|
|
1513
1497
|
v ? " ANALYZE" : "",
|
|
1514
1498
|
"..."
|
|
1515
1499
|
]
|
|
1516
|
-
}) : s ? /* @__PURE__ */
|
|
1500
|
+
}) : s ? /* @__PURE__ */ W("div", {
|
|
1517
1501
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1518
1502
|
children: [
|
|
1519
|
-
/* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ U("strong", { children: "Explain Error:" }),
|
|
1520
1504
|
" ",
|
|
1521
1505
|
s.message
|
|
1522
1506
|
]
|
|
1523
|
-
}) : i ? /* @__PURE__ */
|
|
1507
|
+
}) : i ? /* @__PURE__ */ W("div", {
|
|
1524
1508
|
className: "dc:space-y-3",
|
|
1525
1509
|
children: [
|
|
1526
|
-
/* @__PURE__ */
|
|
1510
|
+
/* @__PURE__ */ W("div", {
|
|
1527
1511
|
className: "dc:flex dc:flex-wrap dc:items-center dc:gap-2",
|
|
1528
1512
|
children: [
|
|
1529
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ U("span", {
|
|
1530
1514
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-accent text-white dc:rounded",
|
|
1531
1515
|
children: i.summary.database.toUpperCase()
|
|
1532
1516
|
}),
|
|
1533
|
-
i.summary.hasSequentialScans && /* @__PURE__ */
|
|
1517
|
+
i.summary.hasSequentialScans && /* @__PURE__ */ U("span", {
|
|
1534
1518
|
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",
|
|
1535
1519
|
children: "Sequential Scans Detected"
|
|
1536
1520
|
}),
|
|
1537
|
-
i.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1521
|
+
i.summary.usedIndexes.length > 0 && /* @__PURE__ */ W("span", {
|
|
1538
1522
|
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",
|
|
1539
1523
|
children: [
|
|
1540
1524
|
i.summary.usedIndexes.length,
|
|
@@ -1543,7 +1527,7 @@ var it = L(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
1543
1527
|
" Used"
|
|
1544
1528
|
]
|
|
1545
1529
|
}),
|
|
1546
|
-
i.summary.executionTime !== void 0 && /* @__PURE__ */
|
|
1530
|
+
i.summary.executionTime !== void 0 && /* @__PURE__ */ W("span", {
|
|
1547
1531
|
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",
|
|
1548
1532
|
children: [
|
|
1549
1533
|
"Execution: ",
|
|
@@ -1551,7 +1535,7 @@ var it = L(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
1551
1535
|
"ms"
|
|
1552
1536
|
]
|
|
1553
1537
|
}),
|
|
1554
|
-
i.summary.planningTime !== void 0 && /* @__PURE__ */
|
|
1538
|
+
i.summary.planningTime !== void 0 && /* @__PURE__ */ W("span", {
|
|
1555
1539
|
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",
|
|
1556
1540
|
children: [
|
|
1557
1541
|
"Planning: ",
|
|
@@ -1559,47 +1543,47 @@ var it = L(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
1559
1543
|
"ms"
|
|
1560
1544
|
]
|
|
1561
1545
|
}),
|
|
1562
|
-
i.summary.totalCost !== void 0 && /* @__PURE__ */
|
|
1546
|
+
i.summary.totalCost !== void 0 && /* @__PURE__ */ W("span", {
|
|
1563
1547
|
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",
|
|
1564
1548
|
children: ["Cost: ", i.summary.totalCost.toFixed(2)]
|
|
1565
1549
|
})
|
|
1566
1550
|
]
|
|
1567
1551
|
}),
|
|
1568
|
-
i.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1552
|
+
i.summary.usedIndexes.length > 0 && /* @__PURE__ */ W("div", {
|
|
1569
1553
|
className: "dc:text-xs text-dc-text-muted",
|
|
1570
1554
|
children: [
|
|
1571
|
-
/* @__PURE__ */
|
|
1555
|
+
/* @__PURE__ */ U("strong", { children: "Indexes:" }),
|
|
1572
1556
|
" ",
|
|
1573
1557
|
i.summary.usedIndexes.join(", ")
|
|
1574
1558
|
]
|
|
1575
1559
|
}),
|
|
1576
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ U(j, {
|
|
1577
1561
|
code: i.raw,
|
|
1578
1562
|
language: "sql",
|
|
1579
1563
|
title: `Execution Plan (${i.summary.database})`,
|
|
1580
1564
|
height: "16rem",
|
|
1581
|
-
headerRight:
|
|
1565
|
+
headerRight: C
|
|
1582
1566
|
})
|
|
1583
1567
|
]
|
|
1584
1568
|
}) : null }),
|
|
1585
|
-
d && /* @__PURE__ */
|
|
1569
|
+
d && /* @__PURE__ */ W("div", {
|
|
1586
1570
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1587
1571
|
children: [
|
|
1588
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ U("strong", { children: "AI Analysis Error:" }),
|
|
1589
1573
|
" ",
|
|
1590
1574
|
d.message
|
|
1591
1575
|
]
|
|
1592
1576
|
}),
|
|
1593
|
-
b && l && /* @__PURE__ */
|
|
1577
|
+
b && l && /* @__PURE__ */ U(it, {
|
|
1594
1578
|
analysis: l,
|
|
1595
|
-
onClose:
|
|
1579
|
+
onClose: te
|
|
1596
1580
|
})
|
|
1597
1581
|
]
|
|
1598
1582
|
});
|
|
1599
1583
|
});
|
|
1600
1584
|
//#endregion
|
|
1601
1585
|
//#region src/client/adapters/queryModeAdapter.ts
|
|
1602
|
-
function
|
|
1586
|
+
function ot() {
|
|
1603
1587
|
return {
|
|
1604
1588
|
metrics: [],
|
|
1605
1589
|
breakdowns: [],
|
|
@@ -1610,10 +1594,10 @@ function at() {
|
|
|
1610
1594
|
validationError: null
|
|
1611
1595
|
};
|
|
1612
1596
|
}
|
|
1613
|
-
function
|
|
1597
|
+
function st(e) {
|
|
1614
1598
|
return e.map((e) => e.field);
|
|
1615
1599
|
}
|
|
1616
|
-
function
|
|
1600
|
+
function ct(e, t) {
|
|
1617
1601
|
let n = [], r = [];
|
|
1618
1602
|
for (let i of e) if (i.isTimeDimension) {
|
|
1619
1603
|
let e = {
|
|
@@ -1621,7 +1605,7 @@ function st(e, t) {
|
|
|
1621
1605
|
granularity: i.granularity || "day"
|
|
1622
1606
|
};
|
|
1623
1607
|
if (i.enableComparison) {
|
|
1624
|
-
let n =
|
|
1608
|
+
let n = he(i.field, t);
|
|
1625
1609
|
n && (e.compareDateRange = n);
|
|
1626
1610
|
}
|
|
1627
1611
|
r.push(e);
|
|
@@ -1631,21 +1615,21 @@ function st(e, t) {
|
|
|
1631
1615
|
timeDimensions: r
|
|
1632
1616
|
};
|
|
1633
1617
|
}
|
|
1634
|
-
function
|
|
1635
|
-
let { dimensions: t, timeDimensions: n } =
|
|
1636
|
-
measures:
|
|
1618
|
+
function lt(e) {
|
|
1619
|
+
let { dimensions: t, timeDimensions: n } = ct(e.breakdowns, e.filters), r = {
|
|
1620
|
+
measures: st(e.metrics),
|
|
1637
1621
|
dimensions: t
|
|
1638
1622
|
};
|
|
1639
1623
|
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;
|
|
1640
1624
|
}
|
|
1641
|
-
function
|
|
1625
|
+
function ut(e) {
|
|
1642
1626
|
return e.map((e, t) => ({
|
|
1643
1627
|
id: k(),
|
|
1644
1628
|
field: e,
|
|
1645
1629
|
label: A(t)
|
|
1646
1630
|
}));
|
|
1647
1631
|
}
|
|
1648
|
-
function
|
|
1632
|
+
function dt(e) {
|
|
1649
1633
|
let t = [];
|
|
1650
1634
|
if (e.dimensions) for (let n of e.dimensions) t.push({
|
|
1651
1635
|
id: k(),
|
|
@@ -1664,10 +1648,10 @@ function ut(e) {
|
|
|
1664
1648
|
}
|
|
1665
1649
|
return t;
|
|
1666
1650
|
}
|
|
1667
|
-
function
|
|
1651
|
+
function ft(e) {
|
|
1668
1652
|
return {
|
|
1669
|
-
metrics:
|
|
1670
|
-
breakdowns:
|
|
1653
|
+
metrics: ut(e.measures || []),
|
|
1654
|
+
breakdowns: dt(e),
|
|
1671
1655
|
filters: e.filters || [],
|
|
1672
1656
|
order: e.order,
|
|
1673
1657
|
limit: e.limit,
|
|
@@ -1675,14 +1659,14 @@ function dt(e) {
|
|
|
1675
1659
|
validationError: null
|
|
1676
1660
|
};
|
|
1677
1661
|
}
|
|
1678
|
-
function
|
|
1662
|
+
function pt(e) {
|
|
1679
1663
|
return typeof e == "object" && !!e && "queries" in e && Array.isArray(e.queries);
|
|
1680
1664
|
}
|
|
1681
1665
|
var X = {
|
|
1682
1666
|
type: "query",
|
|
1683
1667
|
createInitial() {
|
|
1684
1668
|
return {
|
|
1685
|
-
queryStates: [
|
|
1669
|
+
queryStates: [ot()],
|
|
1686
1670
|
activeQueryIndex: 0,
|
|
1687
1671
|
mergeStrategy: "concat"
|
|
1688
1672
|
};
|
|
@@ -1702,22 +1686,22 @@ var X = {
|
|
|
1702
1686
|
load(e) {
|
|
1703
1687
|
if (e.analysisType !== "query") throw Error(`Cannot load ${e.analysisType} config with query adapter`);
|
|
1704
1688
|
let t = e;
|
|
1705
|
-
if (
|
|
1706
|
-
let e = t.query, n = e.queries.map(
|
|
1707
|
-
return n.length === 0 && n.push(
|
|
1689
|
+
if (pt(t.query)) {
|
|
1690
|
+
let e = t.query, n = e.queries.map(ft);
|
|
1691
|
+
return n.length === 0 && n.push(ot()), {
|
|
1708
1692
|
queryStates: n,
|
|
1709
1693
|
activeQueryIndex: 0,
|
|
1710
1694
|
mergeStrategy: e.mergeStrategy || "concat"
|
|
1711
1695
|
};
|
|
1712
1696
|
}
|
|
1713
1697
|
return {
|
|
1714
|
-
queryStates: [
|
|
1698
|
+
queryStates: [ft(t.query)],
|
|
1715
1699
|
activeQueryIndex: 0,
|
|
1716
1700
|
mergeStrategy: "concat"
|
|
1717
1701
|
};
|
|
1718
1702
|
},
|
|
1719
1703
|
save(e, t, n) {
|
|
1720
|
-
let r = e.queryStates.map(
|
|
1704
|
+
let r = e.queryStates.map(lt), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
|
|
1721
1705
|
queries: r,
|
|
1722
1706
|
mergeStrategy: e.mergeStrategy
|
|
1723
1707
|
};
|
|
@@ -1761,35 +1745,35 @@ var X = {
|
|
|
1761
1745
|
}
|
|
1762
1746
|
};
|
|
1763
1747
|
}
|
|
1764
|
-
}, Z = /* @__PURE__ */ new Map(),
|
|
1765
|
-
function
|
|
1766
|
-
|
|
1748
|
+
}, Z = /* @__PURE__ */ new Map(), mt = !1;
|
|
1749
|
+
function ht() {
|
|
1750
|
+
mt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", N), Z.has("flow") || Z.set("flow", M), Z.has("retention") || Z.set("retention", D), !0);
|
|
1767
1751
|
}
|
|
1768
1752
|
var Q = {
|
|
1769
1753
|
register(e) {
|
|
1770
1754
|
Z.has(e.type) && console.warn(`[adapterRegistry] Overwriting existing adapter for type: ${e.type}`), Z.set(e.type, e);
|
|
1771
1755
|
},
|
|
1772
1756
|
get(e) {
|
|
1773
|
-
|
|
1757
|
+
ht();
|
|
1774
1758
|
let t = Z.get(e);
|
|
1775
1759
|
if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(Z.keys()).join(", ") || "none"}`);
|
|
1776
1760
|
return t;
|
|
1777
1761
|
},
|
|
1778
1762
|
has(e) {
|
|
1779
|
-
return
|
|
1763
|
+
return ht(), Z.has(e);
|
|
1780
1764
|
},
|
|
1781
1765
|
getRegisteredTypes() {
|
|
1782
|
-
return
|
|
1766
|
+
return ht(), Array.from(Z.keys());
|
|
1783
1767
|
},
|
|
1784
1768
|
clear() {
|
|
1785
|
-
Z.clear(),
|
|
1769
|
+
Z.clear(), mt = !1;
|
|
1786
1770
|
}
|
|
1787
|
-
},
|
|
1771
|
+
}, gt = () => ({
|
|
1788
1772
|
analysisType: "query",
|
|
1789
1773
|
charts: {
|
|
1790
1774
|
query: X.getDefaultChartConfig(),
|
|
1791
|
-
funnel:
|
|
1792
|
-
flow:
|
|
1775
|
+
funnel: N.getDefaultChartConfig(),
|
|
1776
|
+
flow: M.getDefaultChartConfig(),
|
|
1793
1777
|
retention: D.getDefaultChartConfig()
|
|
1794
1778
|
},
|
|
1795
1779
|
activeViews: {
|
|
@@ -1800,8 +1784,8 @@ var Q = {
|
|
|
1800
1784
|
},
|
|
1801
1785
|
userManuallySelectedChart: !1,
|
|
1802
1786
|
localPaletteName: "default"
|
|
1803
|
-
}),
|
|
1804
|
-
...
|
|
1787
|
+
}), _t = (e, t, n) => ({
|
|
1788
|
+
...gt(),
|
|
1805
1789
|
setAnalysisType: (t) => {
|
|
1806
1790
|
e((e) => {
|
|
1807
1791
|
let n = { ...e.charts };
|
|
@@ -2014,12 +1998,12 @@ var Q = {
|
|
|
2014
1998
|
...u
|
|
2015
1999
|
});
|
|
2016
2000
|
}
|
|
2017
|
-
}),
|
|
2001
|
+
}), vt = () => ({
|
|
2018
2002
|
queryStates: [K()],
|
|
2019
2003
|
activeQueryIndex: 0,
|
|
2020
2004
|
mergeStrategy: "concat"
|
|
2021
|
-
}),
|
|
2022
|
-
...
|
|
2005
|
+
}), yt = (e, t, n) => ({
|
|
2006
|
+
...vt(),
|
|
2023
2007
|
setQueryStates: (t) => e({ queryStates: t }),
|
|
2024
2008
|
updateQueryState: (t, n) => e((e) => {
|
|
2025
2009
|
let r = [...e.queryStates];
|
|
@@ -2146,7 +2130,7 @@ var Q = {
|
|
|
2146
2130
|
}, { queryStates: o };
|
|
2147
2131
|
}),
|
|
2148
2132
|
toggleBreakdownComparison: (t) => e((e) => {
|
|
2149
|
-
let { mergeStrategy: n, activeQueryIndex: r, queryStates: i, charts: a, analysisType: o } = e, s = [...i], c = n === "merge" && r > 0 ? 0 : r,
|
|
2133
|
+
let { mergeStrategy: n, activeQueryIndex: r, queryStates: i, charts: a, analysisType: o } = e, s = [...i], c = n === "merge" && r > 0 ? 0 : r, l = s[c].breakdowns.find((e) => e.id === t), d = l && !l.enableComparison, f = s[c].breakdowns.map((e) => e.id === t ? {
|
|
2150
2134
|
...e,
|
|
2151
2135
|
enableComparison: !e.enableComparison
|
|
2152
2136
|
} : e.isTimeDimension && e.enableComparison ? {
|
|
@@ -2158,20 +2142,20 @@ var Q = {
|
|
|
2158
2142
|
breakdowns: f
|
|
2159
2143
|
};
|
|
2160
2144
|
let p = { queryStates: s };
|
|
2161
|
-
if (d &&
|
|
2145
|
+
if (d && l?.isTimeDimension && l.field) {
|
|
2162
2146
|
let t = s[c].filters || [];
|
|
2163
2147
|
if (!t.some((e) => {
|
|
2164
2148
|
if ("member" in e) {
|
|
2165
2149
|
let t = e;
|
|
2166
|
-
return t.member ===
|
|
2150
|
+
return t.member === l.field && t.operator === "inDateRange";
|
|
2167
2151
|
}
|
|
2168
2152
|
return !1;
|
|
2169
2153
|
})) {
|
|
2170
2154
|
let e = {
|
|
2171
|
-
member:
|
|
2155
|
+
member: l.field,
|
|
2172
2156
|
operator: "inDateRange",
|
|
2173
2157
|
values: [],
|
|
2174
|
-
dateRange:
|
|
2158
|
+
dateRange: u("last_n_months", 3)
|
|
2175
2159
|
};
|
|
2176
2160
|
s[c] = {
|
|
2177
2161
|
...s[c],
|
|
@@ -2260,11 +2244,11 @@ var Q = {
|
|
|
2260
2244
|
},
|
|
2261
2245
|
buildCurrentQuery: () => {
|
|
2262
2246
|
let e = t(), n = e.queryStates[e.activeQueryIndex] || K();
|
|
2263
|
-
return
|
|
2247
|
+
return _e(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit);
|
|
2264
2248
|
},
|
|
2265
2249
|
buildAllQueries: () => {
|
|
2266
2250
|
let e = t(), n = e.queryStates[0]?.breakdowns || [];
|
|
2267
|
-
return e.queryStates.map((t, r) =>
|
|
2251
|
+
return e.queryStates.map((t, r) => _e(t.metrics, e.mergeStrategy === "merge" && r > 0 ? n : t.breakdowns, t.filters, t.order, !1, t.limit));
|
|
2268
2252
|
},
|
|
2269
2253
|
buildMultiQueryConfig: () => {
|
|
2270
2254
|
let e = t();
|
|
@@ -2277,15 +2261,15 @@ var Q = {
|
|
|
2277
2261
|
queryLabels: n.map((e, t) => `Q${t + 1}`)
|
|
2278
2262
|
};
|
|
2279
2263
|
}
|
|
2280
|
-
}),
|
|
2264
|
+
}), bt = () => ({
|
|
2281
2265
|
funnelCube: null,
|
|
2282
2266
|
funnelSteps: [],
|
|
2283
2267
|
activeFunnelStepIndex: 0,
|
|
2284
2268
|
funnelTimeDimension: null,
|
|
2285
2269
|
funnelBindingKey: null,
|
|
2286
2270
|
stepTimeToConvert: []
|
|
2287
|
-
}),
|
|
2288
|
-
...
|
|
2271
|
+
}), xt = (e, t, n) => ({
|
|
2272
|
+
...bt(),
|
|
2289
2273
|
addFunnelStep: () => e((e) => {
|
|
2290
2274
|
let t = e.funnelSteps[e.funnelSteps.length - 1], n = {
|
|
2291
2275
|
id: k(),
|
|
@@ -2353,7 +2337,7 @@ var Q = {
|
|
|
2353
2337
|
let e = t();
|
|
2354
2338
|
return e.analysisType !== "funnel" || !e.funnelBindingKey || !e.funnelTimeDimension || e.funnelSteps.length < 2 ? !1 : e.funnelSteps.filter((e) => e.cube && e.name).length >= 2;
|
|
2355
2339
|
}
|
|
2356
|
-
}),
|
|
2340
|
+
}), St = () => ({
|
|
2357
2341
|
flowCube: null,
|
|
2358
2342
|
flowBindingKey: null,
|
|
2359
2343
|
flowTimeDimension: null,
|
|
@@ -2365,8 +2349,8 @@ var Q = {
|
|
|
2365
2349
|
stepsAfter: 3,
|
|
2366
2350
|
eventDimension: null,
|
|
2367
2351
|
joinStrategy: "auto"
|
|
2368
|
-
}),
|
|
2369
|
-
...
|
|
2352
|
+
}), Ct = (e, t, n) => ({
|
|
2353
|
+
...St(),
|
|
2370
2354
|
setFlowCube: (t) => e(() => ({
|
|
2371
2355
|
flowCube: t,
|
|
2372
2356
|
flowBindingKey: null,
|
|
@@ -2436,8 +2420,8 @@ var Q = {
|
|
|
2436
2420
|
joinStrategy: e.joinStrategy
|
|
2437
2421
|
} };
|
|
2438
2422
|
}
|
|
2439
|
-
}),
|
|
2440
|
-
...
|
|
2423
|
+
}), wt = () => ({ ...w }), Tt = (e, t, n) => ({
|
|
2424
|
+
...wt(),
|
|
2441
2425
|
setRetentionCube: (t) => e(() => ({
|
|
2442
2426
|
retentionCube: t,
|
|
2443
2427
|
retentionTimeDimension: null,
|
|
@@ -2512,22 +2496,22 @@ var Q = {
|
|
|
2512
2496
|
warnings: r
|
|
2513
2497
|
};
|
|
2514
2498
|
}
|
|
2515
|
-
}),
|
|
2499
|
+
}), Et = {
|
|
2516
2500
|
isOpen: !1,
|
|
2517
2501
|
userPrompt: "",
|
|
2518
2502
|
isGenerating: !1,
|
|
2519
2503
|
error: null,
|
|
2520
2504
|
hasGeneratedQuery: !1,
|
|
2521
2505
|
previousState: null
|
|
2522
|
-
},
|
|
2506
|
+
}, Dt = () => ({
|
|
2523
2507
|
activeTab: "query",
|
|
2524
2508
|
activeView: "chart",
|
|
2525
2509
|
displayLimit: 100,
|
|
2526
2510
|
showFieldModal: !1,
|
|
2527
2511
|
fieldModalMode: "metrics",
|
|
2528
|
-
aiState:
|
|
2529
|
-
}),
|
|
2530
|
-
...
|
|
2512
|
+
aiState: Et
|
|
2513
|
+
}), Ot = (e, t, n) => ({
|
|
2514
|
+
...Dt(),
|
|
2531
2515
|
setActiveTab: (t) => e({ activeTab: t }),
|
|
2532
2516
|
setActiveView: (t) => e((e) => ({
|
|
2533
2517
|
activeView: t,
|
|
@@ -2611,13 +2595,13 @@ var Q = {
|
|
|
2611
2595
|
displayConfig: t.displayConfig
|
|
2612
2596
|
}
|
|
2613
2597
|
},
|
|
2614
|
-
aiState: { ...
|
|
2598
|
+
aiState: { ...Et }
|
|
2615
2599
|
};
|
|
2616
2600
|
})
|
|
2617
2601
|
});
|
|
2618
2602
|
//#endregion
|
|
2619
2603
|
//#region src/client/stores/analysisBuilderStore.tsx
|
|
2620
|
-
function
|
|
2604
|
+
function kt(e) {
|
|
2621
2605
|
let t = e.filters ? [...e.filters] : [], n = e.timeDimensions || [], r = [...(e.dimensions || []).map((e) => ({
|
|
2622
2606
|
id: k(),
|
|
2623
2607
|
field: e,
|
|
@@ -2660,13 +2644,13 @@ function Ot(e) {
|
|
|
2660
2644
|
order: e.order
|
|
2661
2645
|
};
|
|
2662
2646
|
}
|
|
2663
|
-
function
|
|
2647
|
+
function At(e) {
|
|
2664
2648
|
return "queries" in e && Array.isArray(e.queries);
|
|
2665
2649
|
}
|
|
2666
|
-
function
|
|
2650
|
+
function jt(e) {
|
|
2667
2651
|
if (e.initialAnalysisType === "funnel" && e.initialFunnelState) {
|
|
2668
|
-
let t =
|
|
2669
|
-
return
|
|
2652
|
+
let t = N.getDefaultChartConfig();
|
|
2653
|
+
return N.save({
|
|
2670
2654
|
funnelCube: e.initialFunnelState.funnelCube ?? null,
|
|
2671
2655
|
funnelSteps: e.initialFunnelState.funnelSteps || [],
|
|
2672
2656
|
activeFunnelStepIndex: 0,
|
|
@@ -2679,8 +2663,8 @@ function At(e) {
|
|
|
2679
2663
|
} }, e.initialActiveView || "chart");
|
|
2680
2664
|
}
|
|
2681
2665
|
if (e.initialAnalysisType === "flow" && e.initialFlowState) {
|
|
2682
|
-
let t =
|
|
2683
|
-
return
|
|
2666
|
+
let t = M.getDefaultChartConfig();
|
|
2667
|
+
return M.save({
|
|
2684
2668
|
flowCube: e.initialFlowState.flowCube ?? null,
|
|
2685
2669
|
flowBindingKey: e.initialFlowState.flowBindingKey ?? null,
|
|
2686
2670
|
flowTimeDimension: e.initialFlowState.flowTimeDimension ?? null,
|
|
@@ -2703,7 +2687,7 @@ function At(e) {
|
|
|
2703
2687
|
chartType: e.initialChartConfig?.chartType || t.chartType,
|
|
2704
2688
|
chartConfig: e.initialChartConfig?.chartConfig || t.chartConfig,
|
|
2705
2689
|
displayConfig: e.initialChartConfig?.displayConfig || t.displayConfig
|
|
2706
|
-
}, r =
|
|
2690
|
+
}, r = T(E);
|
|
2707
2691
|
return D.save({
|
|
2708
2692
|
retentionCube: e.initialRetentionState.retentionCube ?? null,
|
|
2709
2693
|
retentionBindingKey: e.initialRetentionState.retentionBindingKey ?? null,
|
|
@@ -2719,7 +2703,7 @@ function At(e) {
|
|
|
2719
2703
|
}
|
|
2720
2704
|
if (e.initialQuery) {
|
|
2721
2705
|
let t = e.initialQuery, n, r = "concat";
|
|
2722
|
-
|
|
2706
|
+
At(t) ? (n = t.queries.map(kt), t.mergeStrategy && (r = t.mergeStrategy)) : n = [kt(t)];
|
|
2723
2707
|
let i = X.getDefaultChartConfig();
|
|
2724
2708
|
return X.save({
|
|
2725
2709
|
queryStates: n,
|
|
@@ -2749,19 +2733,19 @@ function At(e) {
|
|
|
2749
2733
|
mergeStrategy: "concat"
|
|
2750
2734
|
}, { query: X.getDefaultChartConfig() }, e.initialActiveView) : null;
|
|
2751
2735
|
}
|
|
2752
|
-
function
|
|
2736
|
+
function Mt(e, t) {
|
|
2753
2737
|
return {
|
|
2754
2738
|
reset: () => {
|
|
2755
2739
|
e({
|
|
2756
|
-
...
|
|
2757
|
-
...
|
|
2758
|
-
...
|
|
2759
|
-
...
|
|
2760
|
-
...
|
|
2740
|
+
...gt(),
|
|
2741
|
+
...vt(),
|
|
2742
|
+
...bt(),
|
|
2743
|
+
...St(),
|
|
2744
|
+
...wt(),
|
|
2761
2745
|
charts: {
|
|
2762
2746
|
query: X.getDefaultChartConfig(),
|
|
2763
|
-
funnel:
|
|
2764
|
-
flow:
|
|
2747
|
+
funnel: N.getDefaultChartConfig(),
|
|
2748
|
+
flow: M.getDefaultChartConfig(),
|
|
2765
2749
|
retention: D.getDefaultChartConfig()
|
|
2766
2750
|
},
|
|
2767
2751
|
activeViews: {
|
|
@@ -2775,28 +2759,28 @@ function jt(e, t) {
|
|
|
2775
2759
|
clearCurrentMode: () => e((e) => {
|
|
2776
2760
|
switch (e.analysisType) {
|
|
2777
2761
|
case "funnel": return {
|
|
2778
|
-
...
|
|
2762
|
+
...bt(),
|
|
2779
2763
|
charts: {
|
|
2780
2764
|
...e.charts,
|
|
2781
|
-
funnel:
|
|
2765
|
+
funnel: N.getDefaultChartConfig()
|
|
2782
2766
|
}
|
|
2783
2767
|
};
|
|
2784
2768
|
case "flow": return {
|
|
2785
|
-
...
|
|
2769
|
+
...St(),
|
|
2786
2770
|
charts: {
|
|
2787
2771
|
...e.charts,
|
|
2788
|
-
flow:
|
|
2772
|
+
flow: M.getDefaultChartConfig()
|
|
2789
2773
|
}
|
|
2790
2774
|
};
|
|
2791
2775
|
case "retention": return {
|
|
2792
|
-
...
|
|
2776
|
+
...wt(),
|
|
2793
2777
|
charts: {
|
|
2794
2778
|
...e.charts,
|
|
2795
2779
|
retention: D.getDefaultChartConfig()
|
|
2796
2780
|
}
|
|
2797
2781
|
};
|
|
2798
2782
|
default: return {
|
|
2799
|
-
...
|
|
2783
|
+
...vt(),
|
|
2800
2784
|
userManuallySelectedChart: !1,
|
|
2801
2785
|
charts: {
|
|
2802
2786
|
...e.charts,
|
|
@@ -2822,15 +2806,15 @@ function jt(e, t) {
|
|
|
2822
2806
|
}
|
|
2823
2807
|
};
|
|
2824
2808
|
}
|
|
2825
|
-
function
|
|
2826
|
-
let r =
|
|
2827
|
-
...
|
|
2828
|
-
...
|
|
2829
|
-
...
|
|
2830
|
-
...
|
|
2831
|
-
...
|
|
2832
|
-
...
|
|
2833
|
-
...
|
|
2809
|
+
function Nt(n = {}) {
|
|
2810
|
+
let r = jt(n), o = (e, t, n) => ({
|
|
2811
|
+
..._t(e, t, n),
|
|
2812
|
+
...yt(e, t, n),
|
|
2813
|
+
...xt(e, t, n),
|
|
2814
|
+
...Ct(e, t, n),
|
|
2815
|
+
...Tt(e, t, n),
|
|
2816
|
+
...Ot(e, t, n),
|
|
2817
|
+
...Mt(e, t)
|
|
2834
2818
|
});
|
|
2835
2819
|
if (n.disableLocalStorage) {
|
|
2836
2820
|
let t = a()(i(e(o), { name: "AnalysisBuilderStore (no-persist)" }));
|
|
@@ -2839,10 +2823,10 @@ function Mt(n = {}) {
|
|
|
2839
2823
|
return a()(i(e(t(o, {
|
|
2840
2824
|
name: n.storageKey || "drizzle-cube-analysis-builder-v3",
|
|
2841
2825
|
partialize: (e) => e.saveWorkspace(),
|
|
2842
|
-
merge: (e, t) => e &&
|
|
2826
|
+
merge: (e, t) => e && ie(e) ? {
|
|
2843
2827
|
...t,
|
|
2844
2828
|
_persistedWorkspace: e
|
|
2845
|
-
} : e &&
|
|
2829
|
+
} : e && re(e) ? {
|
|
2846
2830
|
...t,
|
|
2847
2831
|
_persistedConfig: e
|
|
2848
2832
|
} : r ? {
|
|
@@ -2865,10 +2849,10 @@ function Mt(n = {}) {
|
|
|
2865
2849
|
}
|
|
2866
2850
|
})), { name: "AnalysisBuilderStore" }));
|
|
2867
2851
|
}
|
|
2868
|
-
var
|
|
2869
|
-
function
|
|
2870
|
-
let u =
|
|
2871
|
-
return u.current ||=
|
|
2852
|
+
var Pt = I(null);
|
|
2853
|
+
function Ft({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
|
|
2854
|
+
let u = B(null);
|
|
2855
|
+
return u.current ||= Nt({
|
|
2872
2856
|
initialQuery: t,
|
|
2873
2857
|
initialChartConfig: n,
|
|
2874
2858
|
disableLocalStorage: r,
|
|
@@ -2878,22 +2862,22 @@ function Pt({ children: e, initialQuery: t, initialChartConfig: n, disableLocalS
|
|
|
2878
2862
|
initialFlowState: s,
|
|
2879
2863
|
initialRetentionState: c,
|
|
2880
2864
|
initialActiveView: l
|
|
2881
|
-
}), /* @__PURE__ */
|
|
2865
|
+
}), /* @__PURE__ */ U(Pt.Provider, {
|
|
2882
2866
|
value: u.current,
|
|
2883
2867
|
children: e
|
|
2884
2868
|
});
|
|
2885
2869
|
}
|
|
2886
2870
|
function $(e) {
|
|
2887
|
-
let t =
|
|
2871
|
+
let t = ue(Pt);
|
|
2888
2872
|
if (!t) throw Error("useAnalysisBuilderStore must be used within AnalysisBuilderStoreProvider");
|
|
2889
2873
|
return r(t, e);
|
|
2890
2874
|
}
|
|
2891
|
-
function
|
|
2892
|
-
let e =
|
|
2875
|
+
function It() {
|
|
2876
|
+
let e = ue(Pt);
|
|
2893
2877
|
if (!e) throw Error("useAnalysisBuilderStoreApi must be used within AnalysisBuilderStoreProvider");
|
|
2894
2878
|
return e;
|
|
2895
2879
|
}
|
|
2896
|
-
var
|
|
2880
|
+
var Lt = (e) => e.queryStates[e.activeQueryIndex] || K(), Rt = (e) => Lt(e).metrics, zt = (e) => Lt(e).breakdowns, Bt = (e) => Lt(e).filters, Vt = (e) => {
|
|
2897
2881
|
let t = e.charts[e.analysisType];
|
|
2898
2882
|
return t ? {
|
|
2899
2883
|
chartType: t.chartType,
|
|
@@ -2908,18 +2892,18 @@ var It = (e) => e.queryStates[e.activeQueryIndex] || K(), Lt = (e) => It(e).metr
|
|
|
2908
2892
|
showTooltip: !0
|
|
2909
2893
|
}
|
|
2910
2894
|
};
|
|
2911
|
-
},
|
|
2895
|
+
}, Ht = (e) => ({
|
|
2912
2896
|
activeTab: e.activeTab,
|
|
2913
2897
|
activeView: e.activeView,
|
|
2914
2898
|
displayLimit: e.displayLimit,
|
|
2915
2899
|
showFieldModal: e.showFieldModal,
|
|
2916
2900
|
fieldModalMode: e.fieldModalMode
|
|
2917
|
-
}),
|
|
2901
|
+
}), Ut = (e) => ({
|
|
2918
2902
|
queryStates: e.queryStates,
|
|
2919
2903
|
activeQueryIndex: e.activeQueryIndex,
|
|
2920
2904
|
mergeStrategy: e.mergeStrategy,
|
|
2921
2905
|
isMultiQueryMode: e.analysisType === "query" && e.queryStates.length > 1
|
|
2922
|
-
}),
|
|
2906
|
+
}), Wt = (e) => ({
|
|
2923
2907
|
funnelCube: e.funnelCube,
|
|
2924
2908
|
funnelSteps: e.funnelSteps,
|
|
2925
2909
|
activeFunnelStepIndex: e.activeFunnelStepIndex,
|
|
@@ -2930,16 +2914,16 @@ var It = (e) => e.queryStates[e.activeQueryIndex] || K(), Lt = (e) => It(e).metr
|
|
|
2930
2914
|
});
|
|
2931
2915
|
//#endregion
|
|
2932
2916
|
//#region src/client/utils/multiQueryValidation.ts
|
|
2933
|
-
function
|
|
2917
|
+
function Gt(e) {
|
|
2934
2918
|
return e.timeDimensions || [];
|
|
2935
2919
|
}
|
|
2936
|
-
function
|
|
2920
|
+
function Kt(e) {
|
|
2937
2921
|
let t = [];
|
|
2938
2922
|
if (e.length < 2) return t;
|
|
2939
|
-
let n =
|
|
2923
|
+
let n = Gt(e[0]);
|
|
2940
2924
|
if (n.length === 0) return t;
|
|
2941
2925
|
for (let r = 1; r < e.length; r++) {
|
|
2942
|
-
let i =
|
|
2926
|
+
let i = Gt(e[r]);
|
|
2943
2927
|
if (i.length === 0 && n.length > 0) {
|
|
2944
2928
|
t.push({
|
|
2945
2929
|
type: "missing_time_dimension",
|
|
@@ -2965,7 +2949,7 @@ function Gt(e) {
|
|
|
2965
2949
|
}
|
|
2966
2950
|
return t;
|
|
2967
2951
|
}
|
|
2968
|
-
function
|
|
2952
|
+
function qt(e, t) {
|
|
2969
2953
|
let n = [];
|
|
2970
2954
|
if (e.length < 2 || t.length === 0) return n;
|
|
2971
2955
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -2979,7 +2963,7 @@ function Kt(e, t) {
|
|
|
2979
2963
|
}
|
|
2980
2964
|
return n;
|
|
2981
2965
|
}
|
|
2982
|
-
function
|
|
2966
|
+
function Jt(e) {
|
|
2983
2967
|
let t = [];
|
|
2984
2968
|
if (e.length < 2) return t;
|
|
2985
2969
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -2998,7 +2982,7 @@ function qt(e) {
|
|
|
2998
2982
|
affectedMeasures: r
|
|
2999
2983
|
}), t;
|
|
3000
2984
|
}
|
|
3001
|
-
function
|
|
2985
|
+
function Yt(e) {
|
|
3002
2986
|
let t = [];
|
|
3003
2987
|
if (e.length < 2) return t;
|
|
3004
2988
|
let n = e.map((e) => e.timeDimensions?.[0]?.dateRange);
|
|
@@ -3008,39 +2992,39 @@ function Jt(e) {
|
|
|
3008
2992
|
message: "Queries have different date ranges - some data points may be missing in merged results"
|
|
3009
2993
|
}), t;
|
|
3010
2994
|
}
|
|
3011
|
-
function
|
|
2995
|
+
function Xt(e, t, n = []) {
|
|
3012
2996
|
let r = [], i = [];
|
|
3013
2997
|
return e.length < 2 ? {
|
|
3014
2998
|
isValid: !0,
|
|
3015
2999
|
errors: r,
|
|
3016
3000
|
warnings: i
|
|
3017
|
-
} : (i.push(...
|
|
3001
|
+
} : (i.push(...Jt(e)), i.push(...Yt(e)), t === "merge" && (r.push(...Kt(e)), n.length > 0 && r.push(...qt(e, n))), {
|
|
3018
3002
|
isValid: r.length === 0,
|
|
3019
3003
|
errors: r,
|
|
3020
3004
|
warnings: i
|
|
3021
3005
|
});
|
|
3022
3006
|
}
|
|
3023
|
-
function
|
|
3007
|
+
function Zt(e) {
|
|
3024
3008
|
return e.filter((e) => (e.measures?.length || 0) + (e.dimensions?.length || 0) + (e.timeDimensions?.length || 0) > 0).length >= 2;
|
|
3025
3009
|
}
|
|
3026
|
-
function
|
|
3010
|
+
function Qt(e) {
|
|
3027
3011
|
if (e.isValid && e.warnings.length === 0) return "Configuration is valid";
|
|
3028
3012
|
let t = [];
|
|
3029
3013
|
return e.errors.length > 0 && t.push(`${e.errors.length} error${e.errors.length > 1 ? "s" : ""}`), e.warnings.length > 0 && t.push(`${e.warnings.length} warning${e.warnings.length > 1 ? "s" : ""}`), t.join(", ");
|
|
3030
3014
|
}
|
|
3031
3015
|
//#endregion
|
|
3032
3016
|
//#region src/client/hooks/useAnalysisQueryBuilder.ts
|
|
3033
|
-
function
|
|
3034
|
-
let e = $((e) => e.queryStates), t = $((e) => e.activeQueryIndex), n = $((e) => e.mergeStrategy), r = $((e) => e.setActiveQueryIndex), i = $((e) => e.setMergeStrategy), a = $((e) => e.addQuery), o = $((e) => e.removeQuery), s = $((e) => e.getCurrentState), c = $((e) => e.getMergeKeys), l = $((e) => e.isMultiQueryMode), u = s(), d = l(), f = c(), p =
|
|
3017
|
+
function $t() {
|
|
3018
|
+
let e = $((e) => e.queryStates), t = $((e) => e.activeQueryIndex), n = $((e) => e.mergeStrategy), r = $((e) => e.setActiveQueryIndex), i = $((e) => e.setMergeStrategy), a = $((e) => e.addQuery), o = $((e) => e.removeQuery), s = $((e) => e.getCurrentState), c = $((e) => e.getMergeKeys), l = $((e) => e.isMultiQueryMode), u = s(), d = l(), f = c(), p = z(() => {
|
|
3035
3019
|
let n = e[t] || u;
|
|
3036
|
-
return
|
|
3020
|
+
return _e(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit);
|
|
3037
3021
|
}, [
|
|
3038
3022
|
e,
|
|
3039
3023
|
t,
|
|
3040
3024
|
u
|
|
3041
|
-
]), m =
|
|
3025
|
+
]), m = z(() => {
|
|
3042
3026
|
let t = e[0]?.breakdowns || [];
|
|
3043
|
-
return e.map((e, r) =>
|
|
3027
|
+
return e.map((e, r) => _e(e.metrics, n === "merge" && r > 0 ? t : e.breakdowns, e.filters, e.order, !1, e.limit));
|
|
3044
3028
|
}, [e, n]);
|
|
3045
3029
|
return {
|
|
3046
3030
|
queryState: u,
|
|
@@ -3051,7 +3035,7 @@ function Qt() {
|
|
|
3051
3035
|
mergeKeys: f,
|
|
3052
3036
|
currentQuery: p,
|
|
3053
3037
|
allQueries: m,
|
|
3054
|
-
multiQueryConfig:
|
|
3038
|
+
multiQueryConfig: z(() => {
|
|
3055
3039
|
if (e.length <= 1) return null;
|
|
3056
3040
|
let t = m.filter((e) => e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0);
|
|
3057
3041
|
return t.length < 2 ? null : {
|
|
@@ -3066,13 +3050,13 @@ function Qt() {
|
|
|
3066
3050
|
n,
|
|
3067
3051
|
f
|
|
3068
3052
|
]),
|
|
3069
|
-
multiQueryValidation:
|
|
3053
|
+
multiQueryValidation: z(() => d ? Xt(m, n, f || []) : null, [
|
|
3070
3054
|
d,
|
|
3071
3055
|
m,
|
|
3072
3056
|
n,
|
|
3073
3057
|
f
|
|
3074
3058
|
]),
|
|
3075
|
-
isValidQuery:
|
|
3059
|
+
isValidQuery: z(() => p.measures && p.measures.length > 0 || p.dimensions && p.dimensions.length > 0 || p.timeDimensions && p.timeDimensions.length > 0, [p]),
|
|
3076
3060
|
setActiveQueryIndex: r,
|
|
3077
3061
|
setMergeStrategy: i,
|
|
3078
3062
|
addQuery: a,
|
|
@@ -3081,10 +3065,10 @@ function Qt() {
|
|
|
3081
3065
|
}
|
|
3082
3066
|
//#endregion
|
|
3083
3067
|
//#region src/client/hooks/useAnalysisCombinedFields.ts
|
|
3084
|
-
function
|
|
3068
|
+
function en(e) {
|
|
3085
3069
|
let { queryState: t, queryStates: n, isMultiQueryMode: r, mergeStrategy: i, activeQueryIndex: a } = e;
|
|
3086
3070
|
return {
|
|
3087
|
-
combinedMetrics:
|
|
3071
|
+
combinedMetrics: z(() => {
|
|
3088
3072
|
if (!r) return t.metrics;
|
|
3089
3073
|
let e = /* @__PURE__ */ new Set(), i = [];
|
|
3090
3074
|
for (let t = 0; t < n.length; t++) {
|
|
@@ -3103,7 +3087,7 @@ function $t(e) {
|
|
|
3103
3087
|
n,
|
|
3104
3088
|
t.metrics
|
|
3105
3089
|
]),
|
|
3106
|
-
combinedBreakdowns:
|
|
3090
|
+
combinedBreakdowns: z(() => {
|
|
3107
3091
|
if (!r) return t.breakdowns;
|
|
3108
3092
|
let e = /* @__PURE__ */ new Set(), i = [];
|
|
3109
3093
|
for (let t of n) for (let n of t.breakdowns) e.has(n.field) || (e.add(n.field), i.push(n));
|
|
@@ -3113,7 +3097,7 @@ function $t(e) {
|
|
|
3113
3097
|
n,
|
|
3114
3098
|
t.breakdowns
|
|
3115
3099
|
]),
|
|
3116
|
-
effectiveBreakdowns:
|
|
3100
|
+
effectiveBreakdowns: z(() => i === "merge" && a > 0 ? n[0]?.breakdowns || [] : t.breakdowns, [
|
|
3117
3101
|
i,
|
|
3118
3102
|
a,
|
|
3119
3103
|
n,
|
|
@@ -3123,129 +3107,129 @@ function $t(e) {
|
|
|
3123
3107
|
}
|
|
3124
3108
|
//#endregion
|
|
3125
3109
|
//#region src/client/hooks/useAnalysisQueryExecution.ts
|
|
3126
|
-
function
|
|
3127
|
-
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:
|
|
3110
|
+
function tn(e) {
|
|
3111
|
+
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: v } = ne(), x = u === "funnel" || l, C = u === "flow", w = u === "retention", T = u === "query" && i, E = u === "query" && !i, re = u === "funnel" && !!d, ie = z(() => re || !x || !c || n.length < 2 ? null : te(n, c), [
|
|
3128
3112
|
re,
|
|
3129
|
-
|
|
3113
|
+
x,
|
|
3130
3114
|
c,
|
|
3131
3115
|
n
|
|
3132
|
-
]),
|
|
3116
|
+
]), D = g(t, {
|
|
3133
3117
|
skip: !a || !E,
|
|
3134
3118
|
debounceMs: 300
|
|
3135
|
-
}),
|
|
3119
|
+
}), O = _(r, {
|
|
3136
3120
|
skip: !r || !T,
|
|
3137
3121
|
debounceMs: 300
|
|
3138
|
-
}),
|
|
3139
|
-
skip: !
|
|
3122
|
+
}), k = b(ie, {
|
|
3123
|
+
skip: !x || !ie && !d,
|
|
3140
3124
|
debounceMs: 300,
|
|
3141
3125
|
prebuiltServerQuery: re ? d : void 0
|
|
3142
|
-
}),
|
|
3126
|
+
}), A = h(f ?? null, {
|
|
3143
3127
|
skip: !C || !f,
|
|
3144
3128
|
debounceMs: 300
|
|
3145
|
-
}),
|
|
3129
|
+
}), j = y(p ?? null, {
|
|
3146
3130
|
skip: !w || !p,
|
|
3147
3131
|
debounceMs: 300,
|
|
3148
|
-
getFieldLabel:
|
|
3149
|
-
}),
|
|
3132
|
+
getFieldLabel: v
|
|
3133
|
+
}), ae = ee({
|
|
3150
3134
|
queries: i ? n : [t],
|
|
3151
3135
|
isMultiQueryMode: i,
|
|
3152
|
-
skip: !a ||
|
|
3153
|
-
}),
|
|
3154
|
-
w ?
|
|
3136
|
+
skip: !a || x || C || w
|
|
3137
|
+
}), oe = S(k.serverQuery, { skip: !x || !k.serverQuery }), M = S(A.serverQuery, { skip: !C || !A.serverQuery }), N = S(p, { skip: !w || !p }), P = w ? j.isLoading || j.isDebouncing : C ? A.isLoading || A.isDebouncing : x ? k.isExecuting || k.isDebouncing : T ? O.isLoading : D.isLoading, se = w ? j.isFetching : C ? A.isFetching : x ? k.isExecuting : T ? O.isFetching : D.isFetching, ce = w ? j.error : C ? A.error : x ? k.error : T ? O.error : D.error, F = !!(D.debouncedQuery || O.debouncedConfig || !k.isDebouncing || !A.isDebouncing || !j.isDebouncing), I = L((e) => {
|
|
3138
|
+
w ? j.execute(e) : C ? A.refetch(e) : x ? k.execute(e) : T ? O.refetch(e) : D.refetch(e);
|
|
3155
3139
|
}, [
|
|
3156
3140
|
w,
|
|
3157
3141
|
C,
|
|
3158
|
-
|
|
3142
|
+
x,
|
|
3159
3143
|
T,
|
|
3160
|
-
M,
|
|
3161
3144
|
j,
|
|
3162
3145
|
A,
|
|
3163
3146
|
k,
|
|
3164
|
-
O
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3147
|
+
O,
|
|
3148
|
+
D
|
|
3149
|
+
]), le = z(() => {
|
|
3150
|
+
let e = w ? j.chartData : C ? A.data : x ? k.chartData : T ? O.data : D.rawData;
|
|
3151
|
+
return o && o.length > 0 && !e ? "success" : a ? P && !e ? "loading" : se && e ? "refreshing" : ce ? "error" : e ? "success" : "idle" : "idle";
|
|
3168
3152
|
}, [
|
|
3169
3153
|
a,
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3154
|
+
P,
|
|
3155
|
+
se,
|
|
3156
|
+
ce,
|
|
3157
|
+
D.rawData,
|
|
3158
|
+
O.data,
|
|
3159
|
+
k.chartData,
|
|
3160
|
+
A.data,
|
|
3161
|
+
j.chartData,
|
|
3178
3162
|
o,
|
|
3179
3163
|
T,
|
|
3180
|
-
|
|
3164
|
+
x,
|
|
3181
3165
|
C,
|
|
3182
3166
|
w
|
|
3183
|
-
]),
|
|
3167
|
+
]), ue = z(() => w && j.chartData ? j.chartData.rows.map((e) => ({
|
|
3184
3168
|
"Retention.period": `P${e.period}`,
|
|
3185
3169
|
"Retention.rate": e.retentionRate,
|
|
3186
3170
|
"Retention.retained": e.retainedUsers,
|
|
3187
3171
|
"Retention.cohortSize": e.cohortSize,
|
|
3188
3172
|
"Retention.segment": e.breakdownValue || "All Users"
|
|
3189
|
-
})) : C &&
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3173
|
+
})) : C && A.data ? [A.data] : x && k.chartData ? k.chartData : T && O.data ? O.data : D.rawData ? D.rawData : o && o.length > 0 ? o : null, [
|
|
3174
|
+
D.rawData,
|
|
3175
|
+
O.data,
|
|
3176
|
+
k.chartData,
|
|
3177
|
+
A.data,
|
|
3178
|
+
j.chartData,
|
|
3195
3179
|
o,
|
|
3196
3180
|
T,
|
|
3197
|
-
|
|
3181
|
+
x,
|
|
3198
3182
|
C,
|
|
3199
3183
|
w
|
|
3200
|
-
]),
|
|
3184
|
+
]), R = z(() => x && k.stepResults ? k.stepResults.map((e) => e.data) : !T || !O.perQueryData ? null : O.perQueryData, [
|
|
3201
3185
|
T,
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
]),
|
|
3186
|
+
x,
|
|
3187
|
+
O.perQueryData,
|
|
3188
|
+
k.stepResults
|
|
3189
|
+
]), B = x && k.executedQueries?.length > 0 ? k.executedQueries : null, V = x ? k.serverQuery : null, H = x ? oe.debugData : null, U = C ? A.serverQuery : null, W = C ? A.data : null, de = C ? M.debugData : null, fe = w ? p ?? null : null, G = w ? j.chartData : null, pe = w ? N.debugData : null, me = z(() => w ? j.needsRefresh : C ? A.needsRefresh : x ? k.needsRefresh : T ? !1 : D.needsRefresh, [
|
|
3206
3190
|
w,
|
|
3207
3191
|
C,
|
|
3208
|
-
|
|
3192
|
+
x,
|
|
3209
3193
|
T,
|
|
3210
|
-
M.needsRefresh,
|
|
3211
3194
|
j.needsRefresh,
|
|
3212
3195
|
A.needsRefresh,
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3196
|
+
k.needsRefresh,
|
|
3197
|
+
D.needsRefresh
|
|
3198
|
+
]), he = z(() => {
|
|
3199
|
+
if (E && D.warnings) return D.warnings;
|
|
3200
|
+
}, [E, D.warnings]);
|
|
3217
3201
|
return {
|
|
3218
|
-
executionStatus:
|
|
3219
|
-
executionResults:
|
|
3220
|
-
perQueryResults:
|
|
3221
|
-
isLoading:
|
|
3222
|
-
isFetching:
|
|
3223
|
-
error:
|
|
3224
|
-
debugDataPerQuery:
|
|
3225
|
-
hasDebounced:
|
|
3226
|
-
refetch:
|
|
3227
|
-
funnelExecutedQueries:
|
|
3228
|
-
funnelServerQuery:
|
|
3229
|
-
funnelDebugData:
|
|
3230
|
-
flowServerQuery:
|
|
3231
|
-
flowChartData:
|
|
3232
|
-
flowDebugData:
|
|
3233
|
-
retentionServerQuery:
|
|
3234
|
-
retentionChartData:
|
|
3202
|
+
executionStatus: le,
|
|
3203
|
+
executionResults: ue,
|
|
3204
|
+
perQueryResults: R,
|
|
3205
|
+
isLoading: P,
|
|
3206
|
+
isFetching: se,
|
|
3207
|
+
error: ce,
|
|
3208
|
+
debugDataPerQuery: ae.debugDataPerQuery,
|
|
3209
|
+
hasDebounced: F,
|
|
3210
|
+
refetch: I,
|
|
3211
|
+
funnelExecutedQueries: B,
|
|
3212
|
+
funnelServerQuery: V,
|
|
3213
|
+
funnelDebugData: H,
|
|
3214
|
+
flowServerQuery: U,
|
|
3215
|
+
flowChartData: W,
|
|
3216
|
+
flowDebugData: de,
|
|
3217
|
+
retentionServerQuery: fe,
|
|
3218
|
+
retentionChartData: G,
|
|
3235
3219
|
retentionDebugData: pe,
|
|
3236
|
-
retentionValidation:
|
|
3220
|
+
retentionValidation: m ?? null,
|
|
3237
3221
|
needsRefresh: me,
|
|
3238
3222
|
warnings: he
|
|
3239
3223
|
};
|
|
3240
3224
|
}
|
|
3241
3225
|
//#endregion
|
|
3242
3226
|
//#region src/client/hooks/useAnalysisChartDefaults.ts
|
|
3243
|
-
function
|
|
3244
|
-
let { externalColorPalette: t, combinedMetrics: r, combinedBreakdowns: i, hasDebounced: a } = e, o = $((e) => e.analysisType), { chartType: s, chartConfig: c, displayConfig: l } = $(n(
|
|
3227
|
+
function nn(e) {
|
|
3228
|
+
let { externalColorPalette: t, combinedMetrics: r, combinedBreakdowns: i, hasDebounced: a } = e, o = $((e) => e.analysisType), { chartType: s, chartConfig: c, displayConfig: l } = $(n(Vt)), u = $((e) => e.userManuallySelectedChart), d = $((e) => e.localPaletteName), f = $((e) => e.setChartTypeManual), p = $((e) => e.setChartConfig), m = $((e) => e.setDisplayConfig), h = $((e) => e.setFunnelChartType), g = $((e) => e.setFunnelChartConfig), _ = $((e) => e.setFunnelDisplayConfig), v = $((e) => e.setLocalPaletteName), y = $((e) => e.setUserManuallySelectedChart), b = L((e) => {
|
|
3245
3229
|
if (o === "funnel") h(e);
|
|
3246
3230
|
else {
|
|
3247
3231
|
f(e);
|
|
3248
|
-
let { chartConfig: t } =
|
|
3232
|
+
let { chartConfig: t } = qe(r, i, e);
|
|
3249
3233
|
p(t);
|
|
3250
3234
|
}
|
|
3251
3235
|
}, [
|
|
@@ -3255,25 +3239,25 @@ function tn(e) {
|
|
|
3255
3239
|
h,
|
|
3256
3240
|
f,
|
|
3257
3241
|
p
|
|
3258
|
-
]), x =
|
|
3242
|
+
]), x = L((e) => {
|
|
3259
3243
|
o === "funnel" ? g(e) : p(e);
|
|
3260
3244
|
}, [
|
|
3261
3245
|
o,
|
|
3262
3246
|
g,
|
|
3263
3247
|
p
|
|
3264
|
-
]),
|
|
3248
|
+
]), S = L((e) => {
|
|
3265
3249
|
o === "funnel" ? _(e) : m(e);
|
|
3266
3250
|
}, [
|
|
3267
3251
|
o,
|
|
3268
3252
|
_,
|
|
3269
3253
|
m
|
|
3270
|
-
]),
|
|
3254
|
+
]), ee = z(() => Ge(r, i), [r, i]), te = z(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
|
|
3271
3255
|
name: "custom",
|
|
3272
3256
|
label: "Custom",
|
|
3273
3257
|
colors: t,
|
|
3274
3258
|
gradient: t
|
|
3275
|
-
} : t :
|
|
3276
|
-
return
|
|
3259
|
+
} : t : ae(d), [t, d]), C = B("");
|
|
3260
|
+
return R(() => {
|
|
3277
3261
|
if (!a || r.length === 0 && i.length === 0) return;
|
|
3278
3262
|
let e = JSON.stringify({
|
|
3279
3263
|
metrics: r.map((e) => e.field),
|
|
@@ -3282,14 +3266,14 @@ function tn(e) {
|
|
|
3282
3266
|
isTime: e.isTimeDimension
|
|
3283
3267
|
}))
|
|
3284
3268
|
});
|
|
3285
|
-
if (e ===
|
|
3286
|
-
|
|
3287
|
-
let t =
|
|
3269
|
+
if (e === C.current) return;
|
|
3270
|
+
C.current = e;
|
|
3271
|
+
let t = Ye(r, i, s, u);
|
|
3288
3272
|
if (t) {
|
|
3289
|
-
let { chartConfig: e } =
|
|
3273
|
+
let { chartConfig: e } = qe(r, i, t);
|
|
3290
3274
|
b(t), x(e), y(!1);
|
|
3291
3275
|
} else if ((r.length > 0 || i.length > 0) && !c.xAxis?.length && !c.yAxis?.length && !c.series?.length) {
|
|
3292
|
-
let { chartConfig: e } =
|
|
3276
|
+
let { chartConfig: e } = qe(r, i, s);
|
|
3293
3277
|
x(e);
|
|
3294
3278
|
}
|
|
3295
3279
|
}, [
|
|
@@ -3306,20 +3290,20 @@ function tn(e) {
|
|
|
3306
3290
|
chartType: s,
|
|
3307
3291
|
chartConfig: c,
|
|
3308
3292
|
displayConfig: l,
|
|
3309
|
-
colorPalette:
|
|
3293
|
+
colorPalette: te,
|
|
3310
3294
|
localPaletteName: d,
|
|
3311
|
-
chartAvailability:
|
|
3295
|
+
chartAvailability: ee,
|
|
3312
3296
|
userManuallySelectedChart: u,
|
|
3313
3297
|
setChartType: b,
|
|
3314
3298
|
setChartConfig: x,
|
|
3315
|
-
setDisplayConfig:
|
|
3299
|
+
setDisplayConfig: S,
|
|
3316
3300
|
setLocalPaletteName: v
|
|
3317
3301
|
};
|
|
3318
3302
|
}
|
|
3319
3303
|
//#endregion
|
|
3320
3304
|
//#region src/client/hooks/useAnalysisUIState.ts
|
|
3321
|
-
function
|
|
3322
|
-
let e = $((e) => e.activeTab), t = $((e) => e.activeView), n = $((e) => e.displayLimit), r = $((e) => e.showFieldModal), i = $((e) => e.fieldModalMode), a = $((e) => e.userManuallySelectedChart), o = $((e) => e.setActiveTab), s = $((e) => e.setActiveView), c = $((e) => e.setDisplayLimit), l = $((e) => e.closeFieldModal), [u, d] =
|
|
3305
|
+
function rn() {
|
|
3306
|
+
let e = $((e) => e.activeTab), t = $((e) => e.activeView), n = $((e) => e.displayLimit), r = $((e) => e.showFieldModal), i = $((e) => e.fieldModalMode), a = $((e) => e.userManuallySelectedChart), o = $((e) => e.setActiveTab), s = $((e) => e.setActiveView), c = $((e) => e.setDisplayLimit), l = $((e) => e.closeFieldModal), [u, d] = V(0);
|
|
3323
3307
|
return {
|
|
3324
3308
|
activeTab: e,
|
|
3325
3309
|
activeView: t,
|
|
@@ -3337,42 +3321,42 @@ function nn() {
|
|
|
3337
3321
|
}
|
|
3338
3322
|
//#endregion
|
|
3339
3323
|
//#region src/client/utils/shareUtils.ts
|
|
3340
|
-
var
|
|
3341
|
-
function sn(e) {
|
|
3342
|
-
return (0, rn.compressToEncodedURIComponent)(JSON.stringify(e));
|
|
3343
|
-
}
|
|
3324
|
+
var an = o(), on = 1800, sn = "share=";
|
|
3344
3325
|
function cn(e) {
|
|
3326
|
+
return (0, an.compressToEncodedURIComponent)(JSON.stringify(e));
|
|
3327
|
+
}
|
|
3328
|
+
function ln(e) {
|
|
3345
3329
|
try {
|
|
3346
|
-
let t = (0,
|
|
3330
|
+
let t = (0, an.decompressFromEncodedURIComponent)(e);
|
|
3347
3331
|
if (!t) return null;
|
|
3348
3332
|
let n = JSON.parse(t);
|
|
3349
|
-
return
|
|
3333
|
+
return re(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
|
|
3350
3334
|
} catch {
|
|
3351
3335
|
return null;
|
|
3352
3336
|
}
|
|
3353
3337
|
}
|
|
3354
|
-
function
|
|
3355
|
-
let t =
|
|
3338
|
+
function un(e) {
|
|
3339
|
+
let t = cn(e);
|
|
3356
3340
|
return {
|
|
3357
|
-
ok: t.length <=
|
|
3341
|
+
ok: t.length <= on,
|
|
3358
3342
|
size: t.length,
|
|
3359
|
-
maxSize:
|
|
3343
|
+
maxSize: on
|
|
3360
3344
|
};
|
|
3361
3345
|
}
|
|
3362
|
-
function
|
|
3363
|
-
let t =
|
|
3364
|
-
if (t.length <=
|
|
3346
|
+
function dn(e) {
|
|
3347
|
+
let t = cn(e);
|
|
3348
|
+
if (t.length <= on) return {
|
|
3365
3349
|
encoded: t,
|
|
3366
3350
|
queryOnly: !1
|
|
3367
3351
|
};
|
|
3368
|
-
let n =
|
|
3352
|
+
let n = cn({
|
|
3369
3353
|
version: e.version,
|
|
3370
3354
|
analysisType: e.analysisType,
|
|
3371
3355
|
activeView: e.activeView,
|
|
3372
3356
|
charts: {},
|
|
3373
3357
|
query: e.query
|
|
3374
3358
|
});
|
|
3375
|
-
return n.length <=
|
|
3359
|
+
return n.length <= on ? {
|
|
3376
3360
|
encoded: n,
|
|
3377
3361
|
queryOnly: !0
|
|
3378
3362
|
} : {
|
|
@@ -3380,40 +3364,40 @@ function un(e) {
|
|
|
3380
3364
|
queryOnly: !0
|
|
3381
3365
|
};
|
|
3382
3366
|
}
|
|
3383
|
-
function
|
|
3384
|
-
let { encoded: t } =
|
|
3385
|
-
return t ? `${window.location.origin}${window.location.pathname}#${
|
|
3367
|
+
function fn(e) {
|
|
3368
|
+
let { encoded: t } = dn(e);
|
|
3369
|
+
return t ? `${window.location.origin}${window.location.pathname}#${sn}${t}` : null;
|
|
3386
3370
|
}
|
|
3387
|
-
function
|
|
3371
|
+
function pn() {
|
|
3388
3372
|
if (typeof window > "u") return null;
|
|
3389
3373
|
let e = window.location.hash;
|
|
3390
|
-
return !e || !e.startsWith(`#${
|
|
3374
|
+
return !e || !e.startsWith(`#${sn}`) ? null : e.slice(7);
|
|
3391
3375
|
}
|
|
3392
|
-
function
|
|
3376
|
+
function mn() {
|
|
3393
3377
|
if (typeof window > "u") return;
|
|
3394
3378
|
let e = new URL(window.location.href);
|
|
3395
3379
|
e.hash = "", window.history.replaceState(null, "", e.toString());
|
|
3396
3380
|
}
|
|
3397
|
-
function
|
|
3398
|
-
let e =
|
|
3399
|
-
return e ?
|
|
3381
|
+
function hn() {
|
|
3382
|
+
let e = pn();
|
|
3383
|
+
return e ? ln(e) : null;
|
|
3400
3384
|
}
|
|
3401
3385
|
//#endregion
|
|
3402
3386
|
//#region src/client/hooks/useAnalysisInitialization.ts
|
|
3403
|
-
function
|
|
3404
|
-
let { currentQuery: t, isValidQuery: n, chartType: r, chartConfig: i, displayConfig: a, onQueryChange: o, onChartConfigChange: s } = e, c = $((e) => e.load), l =
|
|
3405
|
-
|
|
3387
|
+
function gn(e) {
|
|
3388
|
+
let { currentQuery: t, isValidQuery: n, chartType: r, chartConfig: i, displayConfig: a, onQueryChange: o, onChartConfigChange: s } = e, c = $((e) => e.load), l = B(!1);
|
|
3389
|
+
R(() => {
|
|
3406
3390
|
if (l.current) return;
|
|
3407
3391
|
l.current = !0;
|
|
3408
|
-
let e =
|
|
3409
|
-
e && (c(e),
|
|
3410
|
-
}, [c]),
|
|
3392
|
+
let e = hn();
|
|
3393
|
+
e && (c(e), mn());
|
|
3394
|
+
}, [c]), R(() => {
|
|
3411
3395
|
o && n && o(t);
|
|
3412
3396
|
}, [
|
|
3413
3397
|
t,
|
|
3414
3398
|
n,
|
|
3415
3399
|
o
|
|
3416
|
-
]),
|
|
3400
|
+
]), R(() => {
|
|
3417
3401
|
s && s({
|
|
3418
3402
|
chartType: r,
|
|
3419
3403
|
chartConfig: i,
|
|
@@ -3428,99 +3412,99 @@ function hn(e) {
|
|
|
3428
3412
|
}
|
|
3429
3413
|
//#endregion
|
|
3430
3414
|
//#region src/client/hooks/useAnalysisBuilderHook.ts
|
|
3431
|
-
function
|
|
3432
|
-
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } =
|
|
3433
|
-
queryState:
|
|
3434
|
-
queryStates:
|
|
3435
|
-
isMultiQueryMode:
|
|
3436
|
-
mergeStrategy:
|
|
3437
|
-
activeQueryIndex:
|
|
3438
|
-
}), u = $((e) => e.funnelBindingKey), d = $((e) => e.analysisType), f = $((e) => e.funnelCube), p = $((e) => e.funnelSteps), m = $((e) => e.activeFunnelStepIndex), h = $((e) => e.funnelTimeDimension), g =
|
|
3415
|
+
function _n(e = {}) {
|
|
3416
|
+
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = c(), o = It(), s = $t(), l = en({
|
|
3417
|
+
queryState: s.queryState,
|
|
3418
|
+
queryStates: s.queryStates,
|
|
3419
|
+
isMultiQueryMode: s.isMultiQueryMode,
|
|
3420
|
+
mergeStrategy: s.mergeStrategy,
|
|
3421
|
+
activeQueryIndex: s.activeQueryIndex
|
|
3422
|
+
}), u = $((e) => e.funnelBindingKey), d = $((e) => e.analysisType), f = $((e) => e.funnelCube), p = $((e) => e.funnelSteps), m = $((e) => e.activeFunnelStepIndex), h = $((e) => e.funnelTimeDimension), g = z(() => d !== "funnel" || !u?.dimension || !h || !p || p.length < 2 ? !1 : p.every((e) => e.filters.length > 0), [
|
|
3439
3423
|
d,
|
|
3440
3424
|
u,
|
|
3441
3425
|
h,
|
|
3442
3426
|
p
|
|
3443
|
-
]), _ = $((e) => e.charts.funnel?.chartType) || "funnel", v = $((e) => e.charts.funnel?.chartConfig), y =
|
|
3427
|
+
]), _ = $((e) => e.charts.funnel?.chartType) || "funnel", v = $((e) => e.charts.funnel?.chartConfig), y = z(() => v || {}, [v]), b = $((e) => e.flowCube), x = $((e) => e.flowBindingKey), S = $((e) => e.flowTimeDimension), ee = $((e) => e.eventDimension), te = $((e) => e.startingStep), C = $((e) => e.stepsBefore), ne = $((e) => e.stepsAfter), w = $((e) => e.joinStrategy), T = $((e) => e.charts.flow?.displayConfig), E = z(() => T || {
|
|
3444
3428
|
showLegend: !0,
|
|
3445
3429
|
showGrid: !0,
|
|
3446
3430
|
showTooltip: !0
|
|
3447
|
-
}, [T]), re = $((e) => e.charts.flow?.chartType) || "sankey",
|
|
3431
|
+
}, [T]), re = $((e) => e.charts.flow?.chartType) || "sankey", ie = $((e) => e.buildFunnelQueryFromSteps), D = z(() => d === "funnel" ? ie() : null, [
|
|
3448
3432
|
d,
|
|
3449
|
-
|
|
3433
|
+
ie,
|
|
3450
3434
|
p
|
|
3451
|
-
]),
|
|
3435
|
+
]), O = $((e) => e.buildFlowQuery), k = z(() => d === "flow" ? O() : null, [
|
|
3452
3436
|
d,
|
|
3453
|
-
|
|
3437
|
+
O,
|
|
3454
3438
|
b,
|
|
3455
3439
|
x,
|
|
3440
|
+
S,
|
|
3456
3441
|
ee,
|
|
3457
3442
|
te,
|
|
3458
|
-
S,
|
|
3459
|
-
ne,
|
|
3460
3443
|
C,
|
|
3444
|
+
ne,
|
|
3461
3445
|
re,
|
|
3462
3446
|
w
|
|
3463
|
-
]),
|
|
3447
|
+
]), A = $((e) => e.retentionCube), j = $((e) => e.retentionBindingKey), ae = $((e) => e.retentionTimeDimension), oe = $((e) => e.retentionDateRange), M = $((e) => e.retentionCohortFilters), N = $((e) => e.retentionActivityFilters), P = $((e) => e.retentionBreakdowns), se = $((e) => e.retentionViewGranularity), ce = $((e) => e.retentionPeriods), F = $((e) => e.retentionType), I = $((e) => e.buildRetentionQuery), le = $((e) => e.getRetentionValidation), ue = $((e) => e.charts.retention?.displayConfig), R = $((e) => e.setRetentionCube), V = $((e) => e.setRetentionBindingKey), H = $((e) => e.setRetentionTimeDimension), U = $((e) => e.setRetentionDateRange), W = $((e) => e.setRetentionCohortFilters), de = $((e) => e.setRetentionActivityFilters), fe = $((e) => e.setRetentionBreakdowns), G = $((e) => e.addRetentionBreakdown), pe = $((e) => e.removeRetentionBreakdown), me = $((e) => e.setRetentionViewGranularity), he = $((e) => e.setRetentionPeriods), ge = $((e) => e.setRetentionType), _e = z(() => d === "retention" ? I() : null, [
|
|
3464
3448
|
d,
|
|
3465
|
-
|
|
3449
|
+
I,
|
|
3450
|
+
A,
|
|
3466
3451
|
j,
|
|
3467
|
-
|
|
3468
|
-
ie,
|
|
3469
|
-
N,
|
|
3470
|
-
F,
|
|
3452
|
+
ae,
|
|
3471
3453
|
oe,
|
|
3472
|
-
I,
|
|
3473
|
-
se,
|
|
3474
3454
|
P,
|
|
3475
|
-
|
|
3476
|
-
]), _e = B(() => d === "retention" ? ce() : null, [
|
|
3477
|
-
d,
|
|
3455
|
+
se,
|
|
3478
3456
|
ce,
|
|
3479
|
-
|
|
3457
|
+
F,
|
|
3480
3458
|
M,
|
|
3481
|
-
ie,
|
|
3482
3459
|
N
|
|
3483
|
-
]),
|
|
3460
|
+
]), K = z(() => d === "retention" ? le() : null, [
|
|
3484
3461
|
d,
|
|
3485
|
-
|
|
3462
|
+
le,
|
|
3486
3463
|
A,
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3464
|
+
j,
|
|
3465
|
+
ae,
|
|
3466
|
+
oe
|
|
3467
|
+
]), ve = z(() => d === "retention" ? _e !== null : d === "flow" ? k !== null : d === "funnel" ? D !== null : s.isValidQuery ?? !1, [
|
|
3468
|
+
d,
|
|
3469
|
+
_e,
|
|
3470
|
+
k,
|
|
3471
|
+
D,
|
|
3472
|
+
s.isValidQuery
|
|
3473
|
+
]), q = tn({
|
|
3474
|
+
currentQuery: s.currentQuery,
|
|
3475
|
+
allQueries: s.allQueries,
|
|
3476
|
+
multiQueryConfig: s.multiQueryConfig,
|
|
3477
|
+
isMultiQueryMode: s.isMultiQueryMode,
|
|
3494
3478
|
isValidQuery: ve,
|
|
3495
3479
|
initialData: t,
|
|
3496
|
-
mergeStrategy:
|
|
3480
|
+
mergeStrategy: s.mergeStrategy,
|
|
3497
3481
|
funnelBindingKey: u,
|
|
3498
3482
|
isFunnelModeEnabled: g,
|
|
3499
3483
|
analysisType: d,
|
|
3500
|
-
serverFunnelQuery:
|
|
3501
|
-
serverFlowQuery:
|
|
3502
|
-
serverRetentionQuery:
|
|
3503
|
-
retentionValidation:
|
|
3504
|
-
}), J =
|
|
3484
|
+
serverFunnelQuery: D,
|
|
3485
|
+
serverFlowQuery: k,
|
|
3486
|
+
serverRetentionQuery: _e,
|
|
3487
|
+
retentionValidation: K
|
|
3488
|
+
}), J = nn({
|
|
3505
3489
|
externalColorPalette: n,
|
|
3506
3490
|
combinedMetrics: l.combinedMetrics,
|
|
3507
3491
|
combinedBreakdowns: l.combinedBreakdowns,
|
|
3508
3492
|
hasDebounced: q.hasDebounced
|
|
3509
|
-
}), Y =
|
|
3510
|
-
|
|
3511
|
-
currentQuery:
|
|
3512
|
-
isValidQuery:
|
|
3493
|
+
}), Y = rn();
|
|
3494
|
+
gn({
|
|
3495
|
+
currentQuery: s.currentQuery,
|
|
3496
|
+
isValidQuery: s.isValidQuery ?? !1,
|
|
3513
3497
|
chartType: J.chartType,
|
|
3514
3498
|
chartConfig: J.chartConfig,
|
|
3515
3499
|
displayConfig: J.displayConfig,
|
|
3516
3500
|
onQueryChange: r,
|
|
3517
3501
|
onChartConfigChange: i
|
|
3518
3502
|
});
|
|
3519
|
-
let ye = $((e) => e.openMetricsModal), be = $((e) => e.addMetric), xe = $((e) => e.removeMetric), Se = $((e) => e.toggleMetric), Ce = $((e) => e.reorderMetrics), we = $((e) => e.openBreakdownsModal), Te = $((e) => e.addBreakdown), Ee = $((e) => e.removeBreakdown), De = $((e) => e.toggleBreakdown), Oe = $((e) => e.setBreakdownGranularity), ke = $((e) => e.toggleBreakdownComparison), Ae = $((e) => e.reorderBreakdowns), je = $((e) => e.setFilters), Me = $((e) => e.dropFieldToFilter), Ne = $((e) => e.setOrder), Pe = $((e) => e.setLimit), Fe = $((e) => e.clearQuery), Ie = $((e) => e.clearCurrentMode), Le = $((e) => e.setFunnelBindingKey), Re = $((e) => e.setAnalysisType), ze = $((e) => e.setFunnelCube), Be = $((e) => e.addFunnelStep), Ve = $((e) => e.removeFunnelStep), He = $((e) => e.updateFunnelStep), Ue = $((e) => e.setActiveFunnelStepIndex), We = $((e) => e.reorderFunnelSteps), Ge = $((e) => e.setFunnelTimeDimension), Ke = $((e) => e.charts.funnel?.displayConfig), qe =
|
|
3503
|
+
let ye = $((e) => e.openMetricsModal), be = $((e) => e.addMetric), xe = $((e) => e.removeMetric), Se = $((e) => e.toggleMetric), Ce = $((e) => e.reorderMetrics), we = $((e) => e.openBreakdownsModal), Te = $((e) => e.addBreakdown), Ee = $((e) => e.removeBreakdown), De = $((e) => e.toggleBreakdown), Oe = $((e) => e.setBreakdownGranularity), ke = $((e) => e.toggleBreakdownComparison), Ae = $((e) => e.reorderBreakdowns), je = $((e) => e.setFilters), Me = $((e) => e.dropFieldToFilter), Ne = $((e) => e.setOrder), Pe = $((e) => e.setLimit), Fe = $((e) => e.clearQuery), Ie = $((e) => e.clearCurrentMode), Le = $((e) => e.setFunnelBindingKey), Re = $((e) => e.setAnalysisType), ze = $((e) => e.setFunnelCube), Be = $((e) => e.addFunnelStep), Ve = $((e) => e.removeFunnelStep), He = $((e) => e.updateFunnelStep), Ue = $((e) => e.setActiveFunnelStepIndex), We = $((e) => e.reorderFunnelSteps), Ge = $((e) => e.setFunnelTimeDimension), Ke = $((e) => e.charts.funnel?.displayConfig), qe = z(() => Ke || {
|
|
3520
3504
|
showLegend: !0,
|
|
3521
3505
|
showGrid: !0,
|
|
3522
3506
|
showTooltip: !0
|
|
3523
|
-
}, [Ke]), Je = $((e) => e.setFunnelDisplayConfig), Ye = $((e) => e.setFlowCube), Xe = $((e) => e.setFlowBindingKey), Ze = $((e) => e.setFlowTimeDimension), Qe = $((e) => e.setEventDimension), $e = $((e) => e.setStartingStepName), et = $((e) => e.setStartingStepFilters), tt = $((e) => e.setStepsBefore), nt = $((e) => e.setStepsAfter), rt = $((e) => e.setJoinStrategy), it =
|
|
3507
|
+
}, [Ke]), Je = $((e) => e.setFunnelDisplayConfig), Ye = $((e) => e.setFlowCube), Xe = $((e) => e.setFlowBindingKey), Ze = $((e) => e.setFlowTimeDimension), Qe = $((e) => e.setEventDimension), $e = $((e) => e.setStartingStepName), et = $((e) => e.setStartingStepFilters), tt = $((e) => e.setStepsBefore), nt = $((e) => e.setStepsAfter), rt = $((e) => e.setJoinStrategy), it = L((e) => {
|
|
3524
3508
|
o.setState((t) => ({ charts: {
|
|
3525
3509
|
...t.charts,
|
|
3526
3510
|
flow: {
|
|
@@ -3532,7 +3516,7 @@ function gn(e = {}) {
|
|
|
3532
3516
|
displayConfig: e
|
|
3533
3517
|
}
|
|
3534
3518
|
} }));
|
|
3535
|
-
}, [o]), at =
|
|
3519
|
+
}, [o]), at = L((e) => {
|
|
3536
3520
|
o.setState((t) => ({ charts: {
|
|
3537
3521
|
...t.charts,
|
|
3538
3522
|
retention: {
|
|
@@ -3544,32 +3528,32 @@ function gn(e = {}) {
|
|
|
3544
3528
|
displayConfig: e
|
|
3545
3529
|
}
|
|
3546
3530
|
} }));
|
|
3547
|
-
}, [o]), ot = $((e) => e.aiState), st = $((e) => e.openAI), ct = $((e) => e.closeAI), lt = $((e) => e.setAIPrompt), ut = $((e) => e.setAIGenerating), dt = $((e) => e.setAIError), ft = $((e) => e.setAIHasGeneratedQuery),
|
|
3548
|
-
|
|
3549
|
-
|
|
3531
|
+
}, [o]), ot = $((e) => e.aiState), st = $((e) => e.openAI), ct = $((e) => e.closeAI), lt = $((e) => e.setAIPrompt), ut = $((e) => e.setAIGenerating), dt = $((e) => e.setAIError), ft = $((e) => e.setAIHasGeneratedQuery), pt = $((e) => e.saveAIPreviousState), X = $((e) => e.restoreAIPreviousState), Z = B("idle"), mt = ve, ht = $((e) => e.getValidation), Q = z(() => ht(), [
|
|
3532
|
+
ht,
|
|
3533
|
+
s.queryStates,
|
|
3550
3534
|
d,
|
|
3551
3535
|
p,
|
|
3552
3536
|
u,
|
|
3553
3537
|
h,
|
|
3554
3538
|
b,
|
|
3555
3539
|
x,
|
|
3540
|
+
S,
|
|
3556
3541
|
ee,
|
|
3557
3542
|
te,
|
|
3558
|
-
S,
|
|
3559
|
-
ne,
|
|
3560
3543
|
C,
|
|
3544
|
+
ne,
|
|
3561
3545
|
w
|
|
3562
|
-
]), gt =
|
|
3563
|
-
Y.fieldModalMode === "metrics" && t === "measure" ? Se(e.name) : Y.fieldModalMode === "breakdown" && (d === "retention" && t === "dimension" ?
|
|
3546
|
+
]), gt = L((e, t, n, r) => {
|
|
3547
|
+
Y.fieldModalMode === "metrics" && t === "measure" ? Se(e.name) : Y.fieldModalMode === "breakdown" && (d === "retention" && t === "dimension" ? G({ field: e.name }) : De(e.name, t === "timeDimension")), r || Y.closeFieldModal();
|
|
3564
3548
|
}, [
|
|
3565
3549
|
Y,
|
|
3566
3550
|
Se,
|
|
3567
3551
|
De,
|
|
3568
|
-
|
|
3552
|
+
G,
|
|
3569
3553
|
d
|
|
3570
|
-
]), _t =
|
|
3554
|
+
]), _t = L(async () => {
|
|
3571
3555
|
if (a?.aiEndpoint) {
|
|
3572
|
-
|
|
3556
|
+
pt(), ut(!0), dt(null);
|
|
3573
3557
|
try {
|
|
3574
3558
|
await new Promise((e) => setTimeout(e, 1e3)), ft(!0);
|
|
3575
3559
|
} catch (e) {
|
|
@@ -3580,19 +3564,19 @@ function gn(e = {}) {
|
|
|
3580
3564
|
}
|
|
3581
3565
|
}, [
|
|
3582
3566
|
a?.aiEndpoint,
|
|
3583
|
-
|
|
3567
|
+
pt,
|
|
3584
3568
|
ut,
|
|
3585
3569
|
dt,
|
|
3586
3570
|
ft
|
|
3587
|
-
]), vt =
|
|
3571
|
+
]), vt = L(() => {
|
|
3588
3572
|
ct(), ft(!1);
|
|
3589
|
-
}, [ct, ft]), yt =
|
|
3590
|
-
|
|
3591
|
-
}, [
|
|
3592
|
-
|
|
3593
|
-
|
|
3573
|
+
}, [ct, ft]), yt = L(() => {
|
|
3574
|
+
X(), ct();
|
|
3575
|
+
}, [X, ct]), bt = L(async () => {
|
|
3576
|
+
Z.current = "copied", setTimeout(() => {
|
|
3577
|
+
Z.current = "idle";
|
|
3594
3578
|
}, 2e3);
|
|
3595
|
-
}, []), xt =
|
|
3579
|
+
}, []), xt = L(() => {
|
|
3596
3580
|
let e = o.getState();
|
|
3597
3581
|
return e.analysisType === "funnel" ? e.buildFunnelQueryFromSteps() || e.buildCurrentQuery() : e.queryStates.length > 1 ? {
|
|
3598
3582
|
queries: e.buildAllQueries(),
|
|
@@ -3602,7 +3586,7 @@ function gn(e = {}) {
|
|
|
3602
3586
|
funnelBindingKey: e.funnelBindingKey,
|
|
3603
3587
|
stepTimeToConvert: e.stepTimeToConvert
|
|
3604
3588
|
} : e.buildCurrentQuery();
|
|
3605
|
-
}, [o]), St =
|
|
3589
|
+
}, [o]), St = L(() => {
|
|
3606
3590
|
let e = o.getState(), t = e.charts[e.analysisType];
|
|
3607
3591
|
return t ? {
|
|
3608
3592
|
chartType: t.chartType,
|
|
@@ -3618,18 +3602,18 @@ function gn(e = {}) {
|
|
|
3618
3602
|
J.chartType,
|
|
3619
3603
|
J.chartConfig,
|
|
3620
3604
|
J.displayConfig
|
|
3621
|
-
]), Ct =
|
|
3605
|
+
]), Ct = L(() => o.getState().analysisType, [o]);
|
|
3622
3606
|
return {
|
|
3623
|
-
queryState:
|
|
3624
|
-
queryStates:
|
|
3625
|
-
activeQueryIndex:
|
|
3626
|
-
mergeStrategy:
|
|
3627
|
-
isMultiQueryMode:
|
|
3628
|
-
mergeKeys:
|
|
3629
|
-
currentQuery:
|
|
3630
|
-
allQueries:
|
|
3631
|
-
multiQueryConfig:
|
|
3632
|
-
multiQueryValidation:
|
|
3607
|
+
queryState: s.queryState,
|
|
3608
|
+
queryStates: s.queryStates,
|
|
3609
|
+
activeQueryIndex: s.activeQueryIndex,
|
|
3610
|
+
mergeStrategy: s.mergeStrategy,
|
|
3611
|
+
isMultiQueryMode: s.isMultiQueryMode,
|
|
3612
|
+
mergeKeys: s.mergeKeys,
|
|
3613
|
+
currentQuery: s.currentQuery,
|
|
3614
|
+
allQueries: s.allQueries,
|
|
3615
|
+
multiQueryConfig: s.multiQueryConfig,
|
|
3616
|
+
multiQueryValidation: s.multiQueryValidation,
|
|
3633
3617
|
funnelBindingKey: u,
|
|
3634
3618
|
isFunnelModeEnabled: g,
|
|
3635
3619
|
analysisType: d,
|
|
@@ -3642,24 +3626,24 @@ function gn(e = {}) {
|
|
|
3642
3626
|
funnelDisplayConfig: qe,
|
|
3643
3627
|
flowCube: b,
|
|
3644
3628
|
flowBindingKey: x,
|
|
3645
|
-
flowTimeDimension:
|
|
3646
|
-
eventDimension:
|
|
3647
|
-
startingStep:
|
|
3648
|
-
stepsBefore:
|
|
3649
|
-
stepsAfter:
|
|
3629
|
+
flowTimeDimension: S,
|
|
3630
|
+
eventDimension: ee,
|
|
3631
|
+
startingStep: te,
|
|
3632
|
+
stepsBefore: C,
|
|
3633
|
+
stepsAfter: ne,
|
|
3650
3634
|
joinStrategy: w,
|
|
3651
3635
|
flowDisplayConfig: E,
|
|
3652
|
-
retentionCube:
|
|
3653
|
-
retentionBindingKey:
|
|
3654
|
-
retentionTimeDimension:
|
|
3655
|
-
retentionDateRange:
|
|
3656
|
-
retentionCohortFilters:
|
|
3657
|
-
retentionActivityFilters:
|
|
3658
|
-
retentionBreakdowns:
|
|
3659
|
-
retentionViewGranularity:
|
|
3660
|
-
retentionPeriods:
|
|
3661
|
-
retentionType:
|
|
3662
|
-
retentionDisplayConfig:
|
|
3636
|
+
retentionCube: A,
|
|
3637
|
+
retentionBindingKey: j,
|
|
3638
|
+
retentionTimeDimension: ae,
|
|
3639
|
+
retentionDateRange: oe,
|
|
3640
|
+
retentionCohortFilters: M,
|
|
3641
|
+
retentionActivityFilters: N,
|
|
3642
|
+
retentionBreakdowns: P,
|
|
3643
|
+
retentionViewGranularity: se,
|
|
3644
|
+
retentionPeriods: ce,
|
|
3645
|
+
retentionType: F,
|
|
3646
|
+
retentionDisplayConfig: ue,
|
|
3663
3647
|
executionStatus: q.executionStatus,
|
|
3664
3648
|
executionResults: q.executionResults,
|
|
3665
3649
|
perQueryResults: q.perQueryResults,
|
|
@@ -3702,12 +3686,12 @@ function gn(e = {}) {
|
|
|
3702
3686
|
error: ot.error,
|
|
3703
3687
|
hasGeneratedQuery: ot.hasGeneratedQuery
|
|
3704
3688
|
},
|
|
3705
|
-
shareButtonState:
|
|
3689
|
+
shareButtonState: Z.current,
|
|
3706
3690
|
canShare: mt,
|
|
3707
|
-
adapterValidation:
|
|
3691
|
+
adapterValidation: Q,
|
|
3708
3692
|
actions: {
|
|
3709
|
-
setActiveQueryIndex:
|
|
3710
|
-
setMergeStrategy:
|
|
3693
|
+
setActiveQueryIndex: s.setActiveQueryIndex,
|
|
3694
|
+
setMergeStrategy: s.setMergeStrategy,
|
|
3711
3695
|
openMetricsModal: ye,
|
|
3712
3696
|
addMetric: be,
|
|
3713
3697
|
removeMetric: xe,
|
|
@@ -3724,8 +3708,8 @@ function gn(e = {}) {
|
|
|
3724
3708
|
dropFieldToFilter: Me,
|
|
3725
3709
|
setOrder: Ne,
|
|
3726
3710
|
setLimit: Pe,
|
|
3727
|
-
addQuery:
|
|
3728
|
-
removeQuery:
|
|
3711
|
+
addQuery: s.addQuery,
|
|
3712
|
+
removeQuery: s.removeQuery,
|
|
3729
3713
|
setFunnelBindingKey: Le,
|
|
3730
3714
|
setAnalysisType: Re,
|
|
3731
3715
|
setFunnelCube: ze,
|
|
@@ -3746,14 +3730,14 @@ function gn(e = {}) {
|
|
|
3746
3730
|
setStepsAfter: nt,
|
|
3747
3731
|
setJoinStrategy: rt,
|
|
3748
3732
|
setFlowDisplayConfig: it,
|
|
3749
|
-
setRetentionCube:
|
|
3750
|
-
setRetentionBindingKey:
|
|
3751
|
-
setRetentionTimeDimension:
|
|
3752
|
-
setRetentionDateRange:
|
|
3753
|
-
setRetentionCohortFilters:
|
|
3754
|
-
setRetentionActivityFilters:
|
|
3755
|
-
setRetentionBreakdowns:
|
|
3756
|
-
addRetentionBreakdown:
|
|
3733
|
+
setRetentionCube: R,
|
|
3734
|
+
setRetentionBindingKey: V,
|
|
3735
|
+
setRetentionTimeDimension: H,
|
|
3736
|
+
setRetentionDateRange: U,
|
|
3737
|
+
setRetentionCohortFilters: W,
|
|
3738
|
+
setRetentionActivityFilters: de,
|
|
3739
|
+
setRetentionBreakdowns: fe,
|
|
3740
|
+
addRetentionBreakdown: G,
|
|
3757
3741
|
removeRetentionBreakdown: pe,
|
|
3758
3742
|
setRetentionViewGranularity: me,
|
|
3759
3743
|
setRetentionPeriods: he,
|
|
@@ -3787,7 +3771,7 @@ function gn(e = {}) {
|
|
|
3787
3771
|
}
|
|
3788
3772
|
//#endregion
|
|
3789
3773
|
//#region src/client/utils/funnelValidation.ts
|
|
3790
|
-
function
|
|
3774
|
+
function vn(e, t) {
|
|
3791
3775
|
let n = [];
|
|
3792
3776
|
if (!t?.cubes) return n;
|
|
3793
3777
|
if (typeof e.dimension == "string") {
|
|
@@ -3811,7 +3795,7 @@ function _n(e, t) {
|
|
|
3811
3795
|
}
|
|
3812
3796
|
return n;
|
|
3813
3797
|
}
|
|
3814
|
-
function
|
|
3798
|
+
function yn(e) {
|
|
3815
3799
|
let t = [];
|
|
3816
3800
|
for (let n = 0; n < e.length; n++) {
|
|
3817
3801
|
let r = e[n], i = r.query;
|
|
@@ -3823,17 +3807,17 @@ function vn(e) {
|
|
|
3823
3807
|
}
|
|
3824
3808
|
return t;
|
|
3825
3809
|
}
|
|
3826
|
-
function
|
|
3810
|
+
function bn(e, t) {
|
|
3827
3811
|
if (typeof e.dimension == "string") return !0;
|
|
3828
|
-
let n =
|
|
3812
|
+
let n = C(t);
|
|
3829
3813
|
return n ? e.dimension.some((e) => e.cube === n) : !1;
|
|
3830
3814
|
}
|
|
3831
|
-
function
|
|
3815
|
+
function xn(e, t) {
|
|
3832
3816
|
let n = [];
|
|
3833
3817
|
for (let r = 0; r < t.length; r++) {
|
|
3834
3818
|
let i = t[r];
|
|
3835
|
-
if (!
|
|
3836
|
-
let e =
|
|
3819
|
+
if (!bn(e, i.query)) {
|
|
3820
|
+
let e = C(i.query) || "unknown";
|
|
3837
3821
|
n.push({
|
|
3838
3822
|
type: "cross_cube",
|
|
3839
3823
|
message: `Step ${r + 1} uses cube "${e}" but no binding key mapping exists for it`,
|
|
@@ -3843,26 +3827,26 @@ function bn(e, t) {
|
|
|
3843
3827
|
}
|
|
3844
3828
|
return n;
|
|
3845
3829
|
}
|
|
3846
|
-
function
|
|
3830
|
+
function Sn(e) {
|
|
3847
3831
|
return e ? /^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/.test(e) ? null : {
|
|
3848
3832
|
type: "time_window",
|
|
3849
3833
|
message: `Invalid time window format "${e}". Expected ISO 8601 duration (e.g., P7D, PT1H)`
|
|
3850
3834
|
} : null;
|
|
3851
3835
|
}
|
|
3852
|
-
function
|
|
3836
|
+
function Cn(e, t) {
|
|
3853
3837
|
let n = [], r = [];
|
|
3854
3838
|
e.steps.length < 2 && n.push({
|
|
3855
3839
|
type: "general",
|
|
3856
3840
|
message: "Funnel requires at least 2 steps"
|
|
3857
|
-
}), e.bindingKey?.dimension ? (n.push(...
|
|
3841
|
+
}), e.bindingKey?.dimension ? (n.push(...vn(e.bindingKey, t)), n.push(...xn(e.bindingKey, e.steps))) : n.push({
|
|
3858
3842
|
type: "binding_key",
|
|
3859
3843
|
message: "Binding key dimension is required"
|
|
3860
|
-
}), n.push(...
|
|
3844
|
+
}), n.push(...yn(e.steps));
|
|
3861
3845
|
for (let t = 0; t < e.steps.length; t++) {
|
|
3862
|
-
let r = e.steps[t], i =
|
|
3846
|
+
let r = e.steps[t], i = Sn(r.timeToConvert);
|
|
3863
3847
|
i && (i.stepIndex = t, n.push(i));
|
|
3864
3848
|
}
|
|
3865
|
-
let i =
|
|
3849
|
+
let i = Sn(e.globalTimeWindow);
|
|
3866
3850
|
return i && n.push(i), e.steps.length > 5 && r.push({
|
|
3867
3851
|
type: "general",
|
|
3868
3852
|
message: "Funnels with more than 5 steps may have reduced performance"
|
|
@@ -3872,7 +3856,7 @@ function Sn(e, t) {
|
|
|
3872
3856
|
warnings: r
|
|
3873
3857
|
};
|
|
3874
3858
|
}
|
|
3875
|
-
function
|
|
3859
|
+
function wn(e, t) {
|
|
3876
3860
|
return t < 2 ? {
|
|
3877
3861
|
isValid: !1,
|
|
3878
3862
|
message: "Add at least 2 steps for funnel"
|
|
@@ -3881,7 +3865,7 @@ function Cn(e, t) {
|
|
|
3881
3865
|
message: "Select a binding key dimension"
|
|
3882
3866
|
} : { isValid: !0 };
|
|
3883
3867
|
}
|
|
3884
|
-
function
|
|
3868
|
+
function Tn(e) {
|
|
3885
3869
|
if (!e?.cubes) return [];
|
|
3886
3870
|
let t = [];
|
|
3887
3871
|
for (let n of e.cubes) if (n.dimensions) for (let e of n.dimensions) (e.type === "string" || e.type === "number") && t.push({
|
|
@@ -3891,7 +3875,7 @@ function wn(e) {
|
|
|
3891
3875
|
});
|
|
3892
3876
|
return t;
|
|
3893
3877
|
}
|
|
3894
|
-
function
|
|
3878
|
+
function En(e) {
|
|
3895
3879
|
if (!e?.dimension) return "Select binding key...";
|
|
3896
3880
|
if (typeof e.dimension == "string") return e.dimension.split(".")[1] || e.dimension;
|
|
3897
3881
|
if (e.dimension.length > 0) {
|
|
@@ -3901,6 +3885,6 @@ function Tn(e) {
|
|
|
3901
3885
|
return "Select binding key...";
|
|
3902
3886
|
}
|
|
3903
3887
|
//#endregion
|
|
3904
|
-
export {
|
|
3888
|
+
export { Ut as A, Ft as C, Bt as D, Lt as E, it as F, Re as I, $ as M, It as N, Wt as O, at as P, Kt as S, Vt as T, Jt as _, xn as a, qt as b, _n as c, ln as d, fn as f, Yt as g, hn as h, vn as i, Ht as j, Rt as k, cn as l, pn as m, En as n, Cn as o, un as p, wn as r, yn as s, Tn as t, dn as u, Qt as v, zt as w, Xt as x, Zt as y };
|
|
3905
3889
|
|
|
3906
|
-
//# sourceMappingURL=analysis-builder-shared-
|
|
3890
|
+
//# sourceMappingURL=analysis-builder-shared-C-C-rOgu.js.map
|