@contractspec/example.analytics-dashboard 1.57.0 → 1.58.0
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/browser/dashboard/dashboard.enum.js +34 -0
- package/dist/browser/dashboard/dashboard.operation.js +289 -0
- package/dist/browser/dashboard/dashboard.presentation.js +197 -0
- package/dist/browser/dashboard/dashboard.schema.js +126 -0
- package/dist/browser/dashboard/dashboard.test-spec.js +213 -0
- package/dist/browser/dashboard/index.js +299 -0
- package/dist/browser/dashboard.feature.js +84 -0
- package/dist/browser/datasource/posthog-datasource.js +289 -0
- package/dist/browser/docs/analytics-dashboard.docblock.js +103 -0
- package/dist/browser/docs/index.js +103 -0
- package/dist/browser/events.js +81 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/analytics.handlers.js +278 -0
- package/dist/browser/handlers/index.js +571 -0
- package/dist/browser/handlers/query.handlers.js +294 -0
- package/dist/browser/index.js +1677 -0
- package/dist/browser/query/index.js +159 -0
- package/dist/browser/query/query.enum.js +11 -0
- package/dist/browser/query/query.operation.js +154 -0
- package/dist/browser/query/query.presentation.js +119 -0
- package/dist/browser/query/query.schema.js +70 -0
- package/dist/browser/query/query.test-spec.js +113 -0
- package/dist/browser/query-engine/index.js +491 -0
- package/dist/browser/seeders/index.js +20 -0
- package/dist/browser/ui/AnalyticsDashboard.js +394 -0
- package/dist/browser/ui/hooks/index.js +69 -0
- package/dist/browser/ui/hooks/useAnalyticsData.js +66 -0
- package/dist/browser/ui/index.js +671 -0
- package/dist/browser/ui/renderers/analytics.markdown.js +275 -0
- package/dist/browser/ui/renderers/index.js +275 -0
- package/dist/dashboard/dashboard.enum.d.ts +3 -8
- package/dist/dashboard/dashboard.enum.d.ts.map +1 -1
- package/dist/dashboard/dashboard.enum.js +31 -39
- package/dist/dashboard/dashboard.operation.d.ts +444 -450
- package/dist/dashboard/dashboard.operation.d.ts.map +1 -1
- package/dist/dashboard/dashboard.operation.js +284 -207
- package/dist/dashboard/dashboard.presentation.d.ts +3 -8
- package/dist/dashboard/dashboard.presentation.d.ts.map +1 -1
- package/dist/dashboard/dashboard.presentation.js +193 -85
- package/dist/dashboard/dashboard.schema.d.ts +289 -294
- package/dist/dashboard/dashboard.schema.d.ts.map +1 -1
- package/dist/dashboard/dashboard.schema.js +119 -228
- package/dist/dashboard/dashboard.test-spec.d.ts +4 -9
- package/dist/dashboard/dashboard.test-spec.d.ts.map +1 -1
- package/dist/dashboard/dashboard.test-spec.js +209 -228
- package/dist/dashboard/index.d.ts +7 -4
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +299 -4
- package/dist/dashboard.feature.d.ts +1 -6
- package/dist/dashboard.feature.d.ts.map +1 -1
- package/dist/dashboard.feature.js +83 -175
- package/dist/datasource/posthog-datasource.d.ts +15 -19
- package/dist/datasource/posthog-datasource.d.ts.map +1 -1
- package/dist/datasource/posthog-datasource.js +274 -238
- package/dist/docs/analytics-dashboard.docblock.d.ts +2 -1
- package/dist/docs/analytics-dashboard.docblock.d.ts.map +1 -0
- package/dist/docs/analytics-dashboard.docblock.js +45 -56
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +104 -1
- package/dist/events.d.ts +109 -115
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +74 -120
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/analytics.handlers.d.ts +110 -109
- package/dist/handlers/analytics.handlers.d.ts.map +1 -1
- package/dist/handlers/analytics.handlers.js +267 -298
- package/dist/handlers/index.d.ts +3 -3
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +571 -3
- package/dist/handlers/query.handlers.d.ts +7 -11
- package/dist/handlers/query.handlers.d.ts.map +1 -1
- package/dist/handlers/query.handlers.js +292 -7
- package/dist/index.d.ts +12 -13
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1678 -14
- package/dist/node/dashboard/dashboard.enum.js +34 -0
- package/dist/node/dashboard/dashboard.operation.js +289 -0
- package/dist/node/dashboard/dashboard.presentation.js +197 -0
- package/dist/node/dashboard/dashboard.schema.js +126 -0
- package/dist/node/dashboard/dashboard.test-spec.js +213 -0
- package/dist/node/dashboard/index.js +299 -0
- package/dist/node/dashboard.feature.js +84 -0
- package/dist/node/datasource/posthog-datasource.js +289 -0
- package/dist/node/docs/analytics-dashboard.docblock.js +103 -0
- package/dist/node/docs/index.js +103 -0
- package/dist/node/events.js +81 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/analytics.handlers.js +278 -0
- package/dist/node/handlers/index.js +571 -0
- package/dist/node/handlers/query.handlers.js +294 -0
- package/dist/node/index.js +1677 -0
- package/dist/node/query/index.js +159 -0
- package/dist/node/query/query.enum.js +11 -0
- package/dist/node/query/query.operation.js +154 -0
- package/dist/node/query/query.presentation.js +119 -0
- package/dist/node/query/query.schema.js +70 -0
- package/dist/node/query/query.test-spec.js +113 -0
- package/dist/node/query-engine/index.js +491 -0
- package/dist/node/seeders/index.js +20 -0
- package/dist/node/ui/AnalyticsDashboard.js +394 -0
- package/dist/node/ui/hooks/index.js +69 -0
- package/dist/node/ui/hooks/useAnalyticsData.js +66 -0
- package/dist/node/ui/index.js +671 -0
- package/dist/node/ui/renderers/analytics.markdown.js +275 -0
- package/dist/node/ui/renderers/index.js +275 -0
- package/dist/query/index.d.ts +7 -4
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +159 -4
- package/dist/query/query.enum.d.ts +1 -6
- package/dist/query/query.enum.d.ts.map +1 -1
- package/dist/query/query.enum.js +10 -14
- package/dist/query/query.operation.d.ts +148 -154
- package/dist/query/query.operation.d.ts.map +1 -1
- package/dist/query/query.operation.js +151 -109
- package/dist/query/query.presentation.d.ts +2 -7
- package/dist/query/query.presentation.d.ts.map +1 -1
- package/dist/query/query.presentation.js +116 -56
- package/dist/query/query.schema.d.ts +121 -126
- package/dist/query/query.schema.d.ts.map +1 -1
- package/dist/query/query.schema.js +66 -152
- package/dist/query/query.test-spec.d.ts +2 -7
- package/dist/query/query.test-spec.d.ts.map +1 -1
- package/dist/query/query.test-spec.js +111 -121
- package/dist/query-engine/index.d.ts +84 -88
- package/dist/query-engine/index.d.ts.map +1 -1
- package/dist/query-engine/index.js +489 -188
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +18 -16
- package/dist/ui/AnalyticsDashboard.d.ts +1 -6
- package/dist/ui/AnalyticsDashboard.d.ts.map +1 -1
- package/dist/ui/AnalyticsDashboard.js +389 -259
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +69 -4
- package/dist/ui/hooks/useAnalyticsData.d.ts +16 -20
- package/dist/ui/hooks/useAnalyticsData.d.ts.map +1 -1
- package/dist/ui/hooks/useAnalyticsData.js +63 -69
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +671 -5
- package/dist/ui/renderers/analytics.markdown.d.ts +13 -14
- package/dist/ui/renderers/analytics.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/analytics.markdown.js +266 -254
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +275 -2
- package/package.json +328 -67
- package/dist/dashboard/dashboard.enum.js.map +0 -1
- package/dist/dashboard/dashboard.operation.js.map +0 -1
- package/dist/dashboard/dashboard.presentation.js.map +0 -1
- package/dist/dashboard/dashboard.schema.js.map +0 -1
- package/dist/dashboard/dashboard.test-spec.js.map +0 -1
- package/dist/dashboard.feature.js.map +0 -1
- package/dist/datasource/posthog-datasource.js.map +0 -1
- package/dist/docs/analytics-dashboard.docblock.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/analytics.handlers.js.map +0 -1
- package/dist/handlers/query.handlers.js.map +0 -1
- package/dist/query/query.enum.js.map +0 -1
- package/dist/query/query.operation.js.map +0 -1
- package/dist/query/query.presentation.js.map +0 -1
- package/dist/query/query.schema.js.map +0 -1
- package/dist/query/query.test-spec.js.map +0 -1
- package/dist/query-engine/index.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/ui/AnalyticsDashboard.js.map +0 -1
- package/dist/ui/hooks/useAnalyticsData.js.map +0 -1
- package/dist/ui/renderers/analytics.markdown.js.map +0 -1
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Markdown renderers for Analytics Dashboard presentations
|
|
3
|
+
*/
|
|
4
|
+
import type { PresentationRenderer } from '@contractspec/lib.contracts';
|
|
4
5
|
/**
|
|
5
6
|
* Markdown renderer for Analytics Dashboard Overview
|
|
6
7
|
*/
|
|
7
|
-
declare const analyticsDashboardMarkdownRenderer: PresentationRenderer<{
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export declare const analyticsDashboardMarkdownRenderer: PresentationRenderer<{
|
|
9
|
+
mimeType: string;
|
|
10
|
+
body: string;
|
|
10
11
|
}>;
|
|
11
12
|
/**
|
|
12
13
|
* Markdown renderer for Dashboard List
|
|
13
14
|
*/
|
|
14
|
-
declare const dashboardListMarkdownRenderer: PresentationRenderer<{
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export declare const dashboardListMarkdownRenderer: PresentationRenderer<{
|
|
16
|
+
mimeType: string;
|
|
17
|
+
body: string;
|
|
17
18
|
}>;
|
|
18
19
|
/**
|
|
19
20
|
* Markdown renderer for Query Builder
|
|
20
21
|
*/
|
|
21
|
-
declare const queryBuilderMarkdownRenderer: PresentationRenderer<{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export declare const queryBuilderMarkdownRenderer: PresentationRenderer<{
|
|
23
|
+
mimeType: string;
|
|
24
|
+
body: string;
|
|
24
25
|
}>;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer };
|
|
27
26
|
//# sourceMappingURL=analytics.markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.markdown.d.ts","
|
|
1
|
+
{"version":3,"file":"analytics.markdown.d.ts","sourceRoot":"","sources":["../../../src/ui/renderers/analytics.markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAyIxE;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,oBAAoB,CAAC;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAgFA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CA2CA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,oBAAoB,CAAC;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAyDA,CAAC"}
|
|
@@ -1,264 +1,276 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/renderers/analytics.markdown.ts
|
|
3
|
+
var mockDashboards = [
|
|
4
|
+
{
|
|
5
|
+
id: "dash-1",
|
|
6
|
+
name: "Sales Overview",
|
|
7
|
+
slug: "sales-overview",
|
|
8
|
+
status: "PUBLISHED",
|
|
9
|
+
widgetCount: 8,
|
|
10
|
+
viewCount: 1250,
|
|
11
|
+
lastViewedAt: "2024-01-16T12:00:00Z"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "dash-2",
|
|
15
|
+
name: "User Engagement",
|
|
16
|
+
slug: "user-engagement",
|
|
17
|
+
status: "PUBLISHED",
|
|
18
|
+
widgetCount: 6,
|
|
19
|
+
viewCount: 890,
|
|
20
|
+
lastViewedAt: "2024-01-16T10:00:00Z"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "dash-3",
|
|
24
|
+
name: "Product Analytics",
|
|
25
|
+
slug: "product-analytics",
|
|
26
|
+
status: "PUBLISHED",
|
|
27
|
+
widgetCount: 10,
|
|
28
|
+
viewCount: 560,
|
|
29
|
+
lastViewedAt: "2024-01-15T14:00:00Z"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "dash-4",
|
|
33
|
+
name: "Finance Report",
|
|
34
|
+
slug: "finance-report",
|
|
35
|
+
status: "DRAFT",
|
|
36
|
+
widgetCount: 4,
|
|
37
|
+
viewCount: 0,
|
|
38
|
+
lastViewedAt: null
|
|
39
|
+
}
|
|
39
40
|
];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
41
|
+
var mockWidgets = [
|
|
42
|
+
{
|
|
43
|
+
id: "w-1",
|
|
44
|
+
dashboardId: "dash-1",
|
|
45
|
+
name: "Total Revenue",
|
|
46
|
+
type: "METRIC",
|
|
47
|
+
value: 125000,
|
|
48
|
+
change: 12.5
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "w-2",
|
|
52
|
+
dashboardId: "dash-1",
|
|
53
|
+
name: "Active Users",
|
|
54
|
+
type: "METRIC",
|
|
55
|
+
value: 4500,
|
|
56
|
+
change: 8.2
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "w-3",
|
|
60
|
+
dashboardId: "dash-1",
|
|
61
|
+
name: "Revenue Trend",
|
|
62
|
+
type: "LINE_CHART",
|
|
63
|
+
dataPoints: 30
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "w-4",
|
|
67
|
+
dashboardId: "dash-1",
|
|
68
|
+
name: "Top Products",
|
|
69
|
+
type: "BAR_CHART",
|
|
70
|
+
dataPoints: 10
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "w-5",
|
|
74
|
+
dashboardId: "dash-2",
|
|
75
|
+
name: "Daily Active Users",
|
|
76
|
+
type: "LINE_CHART",
|
|
77
|
+
dataPoints: 30
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "w-6",
|
|
81
|
+
dashboardId: "dash-2",
|
|
82
|
+
name: "Session Duration",
|
|
83
|
+
type: "METRIC",
|
|
84
|
+
value: 245,
|
|
85
|
+
change: -3.1
|
|
86
|
+
}
|
|
86
87
|
];
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
88
|
+
var mockQueries = [
|
|
89
|
+
{
|
|
90
|
+
id: "q-1",
|
|
91
|
+
name: "Monthly Revenue",
|
|
92
|
+
type: "AGGREGATION",
|
|
93
|
+
isShared: true,
|
|
94
|
+
executionCount: 1500
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "q-2",
|
|
98
|
+
name: "User Growth",
|
|
99
|
+
type: "METRIC",
|
|
100
|
+
isShared: true,
|
|
101
|
+
executionCount: 890
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "q-3",
|
|
105
|
+
name: "Product Sales",
|
|
106
|
+
type: "SQL",
|
|
107
|
+
isShared: false,
|
|
108
|
+
executionCount: 340
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "q-4",
|
|
112
|
+
name: "Conversion Funnel",
|
|
113
|
+
type: "AGGREGATION",
|
|
114
|
+
isShared: true,
|
|
115
|
+
executionCount: 450
|
|
116
|
+
}
|
|
116
117
|
];
|
|
117
118
|
function formatNumber(value) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
if (value >= 1e6) {
|
|
120
|
+
return `${(value / 1e6).toFixed(1)}M`;
|
|
121
|
+
}
|
|
122
|
+
if (value >= 1000) {
|
|
123
|
+
return `${(value / 1000).toFixed(1)}K`;
|
|
124
|
+
}
|
|
125
|
+
return value.toString();
|
|
121
126
|
}
|
|
122
127
|
function formatChange(change) {
|
|
123
|
-
|
|
128
|
+
const icon = change >= 0 ? "\uD83D\uDCC8" : "\uD83D\uDCC9";
|
|
129
|
+
const sign = change >= 0 ? "+" : "";
|
|
130
|
+
return `${icon} ${sign}${change.toFixed(1)}%`;
|
|
124
131
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
132
|
+
var analyticsDashboardMarkdownRenderer = {
|
|
133
|
+
target: "markdown",
|
|
134
|
+
render: async (desc) => {
|
|
135
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "AnalyticsDashboard") {
|
|
136
|
+
throw new Error("analyticsDashboardMarkdownRenderer: not AnalyticsDashboard");
|
|
137
|
+
}
|
|
138
|
+
const dashboards = mockDashboards;
|
|
139
|
+
const widgets = mockWidgets;
|
|
140
|
+
const queries = mockQueries;
|
|
141
|
+
const dashboard = dashboards[0];
|
|
142
|
+
if (!dashboard) {
|
|
143
|
+
return {
|
|
144
|
+
mimeType: "text/markdown",
|
|
145
|
+
body: `# No Dashboards
|
|
146
|
+
|
|
147
|
+
No dashboards available.`
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const dashboardWidgets = widgets.filter((w) => w.dashboardId === dashboard.id);
|
|
151
|
+
const publishedDashboards = dashboards.filter((d) => d.status === "PUBLISHED");
|
|
152
|
+
const totalViews = dashboards.reduce((sum, d) => sum + d.viewCount, 0);
|
|
153
|
+
const sharedQueries = queries.filter((q) => q.isShared);
|
|
154
|
+
const lines = [
|
|
155
|
+
`# ${dashboard.name}`,
|
|
156
|
+
"",
|
|
157
|
+
"> Analytics dashboard overview",
|
|
158
|
+
"",
|
|
159
|
+
"## Key Metrics",
|
|
160
|
+
""
|
|
161
|
+
];
|
|
162
|
+
const metricWidgets = dashboardWidgets.filter((w) => w.type === "METRIC");
|
|
163
|
+
for (const widget of metricWidgets) {
|
|
164
|
+
const w = widget;
|
|
165
|
+
lines.push(`### ${w.name}`);
|
|
166
|
+
lines.push(`**${formatNumber(w.value)}** ${formatChange(w.change)}`);
|
|
167
|
+
lines.push("");
|
|
168
|
+
}
|
|
169
|
+
lines.push("## Visualizations");
|
|
170
|
+
lines.push("");
|
|
171
|
+
const chartWidgets = dashboardWidgets.filter((w) => w.type !== "METRIC");
|
|
172
|
+
for (const widget of chartWidgets) {
|
|
173
|
+
const w = widget;
|
|
174
|
+
lines.push(`- **${w.name}** (${w.type.replace("_", " ")}) - ${w.dataPoints} data points`);
|
|
175
|
+
}
|
|
176
|
+
lines.push("");
|
|
177
|
+
lines.push("## Dashboard Stats");
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("| Metric | Value |");
|
|
180
|
+
lines.push("|--------|-------|");
|
|
181
|
+
lines.push(`| Total Dashboards | ${dashboards.length} |`);
|
|
182
|
+
lines.push(`| Published | ${publishedDashboards.length} |`);
|
|
183
|
+
lines.push(`| Total Views | ${totalViews.toLocaleString()} |`);
|
|
184
|
+
lines.push(`| Shared Queries | ${sharedQueries.length} |`);
|
|
185
|
+
return {
|
|
186
|
+
mimeType: "text/markdown",
|
|
187
|
+
body: lines.join(`
|
|
188
|
+
`)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
180
191
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
192
|
+
var dashboardListMarkdownRenderer = {
|
|
193
|
+
target: "markdown",
|
|
194
|
+
render: async (desc) => {
|
|
195
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "DashboardList") {
|
|
196
|
+
throw new Error("dashboardListMarkdownRenderer: not DashboardList");
|
|
197
|
+
}
|
|
198
|
+
const dashboards = mockDashboards;
|
|
199
|
+
const lines = [
|
|
200
|
+
"# Dashboards",
|
|
201
|
+
"",
|
|
202
|
+
"> Browse and manage analytics dashboards",
|
|
203
|
+
"",
|
|
204
|
+
"| Dashboard | Widgets | Views | Status | Last Viewed |",
|
|
205
|
+
"|-----------|---------|-------|--------|-------------|"
|
|
206
|
+
];
|
|
207
|
+
for (const dashboard of dashboards) {
|
|
208
|
+
const lastViewed = dashboard.lastViewedAt ? new Date(dashboard.lastViewedAt).toLocaleDateString() : "Never";
|
|
209
|
+
const statusIcon = dashboard.status === "PUBLISHED" ? "\uD83D\uDFE2" : "\u26AB";
|
|
210
|
+
lines.push(`| [${dashboard.name}](/dashboards/${dashboard.slug}) | ${dashboard.widgetCount} | ${dashboard.viewCount.toLocaleString()} | ${statusIcon} ${dashboard.status} | ${lastViewed} |`);
|
|
211
|
+
}
|
|
212
|
+
lines.push("");
|
|
213
|
+
lines.push("## Quick Actions");
|
|
214
|
+
lines.push("");
|
|
215
|
+
lines.push("- **Create Dashboard** - Start with a blank canvas");
|
|
216
|
+
lines.push("- **Import Template** - Use a pre-built template");
|
|
217
|
+
lines.push("- **Clone Dashboard** - Duplicate an existing dashboard");
|
|
218
|
+
return {
|
|
219
|
+
mimeType: "text/markdown",
|
|
220
|
+
body: lines.join(`
|
|
221
|
+
`)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
213
224
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
225
|
+
var queryBuilderMarkdownRenderer = {
|
|
226
|
+
target: "markdown",
|
|
227
|
+
render: async (desc) => {
|
|
228
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "QueryBuilder") {
|
|
229
|
+
throw new Error("queryBuilderMarkdownRenderer: not QueryBuilder");
|
|
230
|
+
}
|
|
231
|
+
const queries = mockQueries;
|
|
232
|
+
const lines = [
|
|
233
|
+
"# Query Builder",
|
|
234
|
+
"",
|
|
235
|
+
"> Create and manage data queries",
|
|
236
|
+
"",
|
|
237
|
+
"## Saved Queries",
|
|
238
|
+
"",
|
|
239
|
+
"| Query | Type | Shared | Executions |",
|
|
240
|
+
"|-------|------|--------|------------|"
|
|
241
|
+
];
|
|
242
|
+
for (const query of queries) {
|
|
243
|
+
const sharedIcon = query.isShared ? "\uD83C\uDF10" : "\uD83D\uDD12";
|
|
244
|
+
lines.push(`| ${query.name} | ${query.type} | ${sharedIcon} | ${query.executionCount.toLocaleString()} |`);
|
|
245
|
+
}
|
|
246
|
+
lines.push("");
|
|
247
|
+
lines.push("## Query Types");
|
|
248
|
+
lines.push("");
|
|
249
|
+
lines.push("### METRIC");
|
|
250
|
+
lines.push("Query usage metrics from the metering system.");
|
|
251
|
+
lines.push("");
|
|
252
|
+
lines.push("### AGGREGATION");
|
|
253
|
+
lines.push("Build aggregations with measures and dimensions without writing SQL.");
|
|
254
|
+
lines.push("");
|
|
255
|
+
lines.push("### SQL");
|
|
256
|
+
lines.push("Write custom SQL queries for advanced analysis.");
|
|
257
|
+
lines.push("");
|
|
258
|
+
lines.push("## Features");
|
|
259
|
+
lines.push("");
|
|
260
|
+
lines.push("- Visual query builder");
|
|
261
|
+
lines.push("- Auto-complete for fields and functions");
|
|
262
|
+
lines.push("- Query validation and optimization");
|
|
263
|
+
lines.push("- Result caching");
|
|
264
|
+
lines.push("- Query sharing and collaboration");
|
|
265
|
+
return {
|
|
266
|
+
mimeType: "text/markdown",
|
|
267
|
+
body: lines.join(`
|
|
268
|
+
`)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
export {
|
|
273
|
+
queryBuilderMarkdownRenderer,
|
|
274
|
+
dashboardListMarkdownRenderer,
|
|
275
|
+
analyticsDashboardMarkdownRenderer
|
|
260
276
|
};
|
|
261
|
-
|
|
262
|
-
//#endregion
|
|
263
|
-
export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer };
|
|
264
|
-
//# sourceMappingURL=analytics.markdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer, } from './analytics.markdown';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/renderers/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kCAAkC,EAClC,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC"}
|