@contractspec/example.analytics-dashboard 3.7.6 → 3.8.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.
Files changed (65) hide show
  1. package/README.md +64 -271
  2. package/dist/browser/dashboard.feature.js +592 -0
  3. package/dist/browser/events.js +1 -1
  4. package/dist/browser/index.js +1171 -627
  5. package/dist/browser/ui/AnalyticsDashboard.js +826 -194
  6. package/dist/browser/ui/AnalyticsDashboard.widgets.js +94 -0
  7. package/dist/browser/ui/AnalyticsQueriesTable.js +99 -0
  8. package/dist/browser/ui/hooks/index.js +594 -3
  9. package/dist/browser/ui/hooks/useAnalyticsData.js +594 -3
  10. package/dist/browser/ui/index.js +964 -440
  11. package/dist/browser/ui/renderers/analytics.markdown.js +620 -138
  12. package/dist/browser/ui/renderers/index.js +620 -138
  13. package/dist/browser/visualizations/catalog.js +457 -0
  14. package/dist/browser/visualizations/index.js +611 -0
  15. package/dist/browser/visualizations/specs.breakdown.js +140 -0
  16. package/dist/browser/visualizations/specs.performance.js +198 -0
  17. package/dist/browser/visualizations/widgets.js +595 -0
  18. package/dist/dashboard/index.d.ts +3 -3
  19. package/dist/dashboard.feature.js +592 -0
  20. package/dist/events.js +1 -1
  21. package/dist/index.d.ts +4 -3
  22. package/dist/index.js +1171 -627
  23. package/dist/node/dashboard.feature.js +592 -0
  24. package/dist/node/events.js +1 -1
  25. package/dist/node/index.js +1171 -627
  26. package/dist/node/ui/AnalyticsDashboard.js +826 -194
  27. package/dist/node/ui/AnalyticsDashboard.widgets.js +94 -0
  28. package/dist/node/ui/AnalyticsQueriesTable.js +99 -0
  29. package/dist/node/ui/hooks/index.js +594 -3
  30. package/dist/node/ui/hooks/useAnalyticsData.js +594 -3
  31. package/dist/node/ui/index.js +964 -440
  32. package/dist/node/ui/renderers/analytics.markdown.js +620 -138
  33. package/dist/node/ui/renderers/index.js +620 -138
  34. package/dist/node/visualizations/catalog.js +457 -0
  35. package/dist/node/visualizations/index.js +611 -0
  36. package/dist/node/visualizations/specs.breakdown.js +140 -0
  37. package/dist/node/visualizations/specs.performance.js +198 -0
  38. package/dist/node/visualizations/widgets.js +595 -0
  39. package/dist/query/index.d.ts +1 -1
  40. package/dist/query-engine/index.d.ts +1 -1
  41. package/dist/ui/AnalyticsDashboard.js +826 -194
  42. package/dist/ui/AnalyticsDashboard.widgets.d.ts +5 -0
  43. package/dist/ui/AnalyticsDashboard.widgets.js +95 -0
  44. package/dist/ui/AnalyticsQueriesTable.d.ts +4 -0
  45. package/dist/ui/AnalyticsQueriesTable.js +100 -0
  46. package/dist/ui/hooks/index.d.ts +1 -1
  47. package/dist/ui/hooks/index.js +594 -3
  48. package/dist/ui/hooks/useAnalyticsData.js +594 -3
  49. package/dist/ui/index.d.ts +1 -1
  50. package/dist/ui/index.js +964 -440
  51. package/dist/ui/renderers/analytics.markdown.d.ts +0 -9
  52. package/dist/ui/renderers/analytics.markdown.js +620 -138
  53. package/dist/ui/renderers/index.js +620 -138
  54. package/dist/visualizations/catalog.d.ts +9 -0
  55. package/dist/visualizations/catalog.js +458 -0
  56. package/dist/visualizations/index.d.ts +4 -0
  57. package/dist/visualizations/index.js +612 -0
  58. package/dist/visualizations/specs.breakdown.d.ts +4 -0
  59. package/dist/visualizations/specs.breakdown.js +141 -0
  60. package/dist/visualizations/specs.performance.d.ts +5 -0
  61. package/dist/visualizations/specs.performance.js +199 -0
  62. package/dist/visualizations/widgets.d.ts +24 -0
  63. package/dist/visualizations/widgets.js +596 -0
  64. package/dist/visualizations/widgets.test.d.ts +1 -0
  65. package/package.json +105 -7
@@ -0,0 +1,140 @@
1
+ // src/visualizations/specs.breakdown.ts
2
+ import { defineVisualization } from "@contractspec/lib.contracts-spec/visualizations";
3
+ var QUERY_REF = { key: "analytics.query.execute", version: "1.0.0" };
4
+ var META = {
5
+ version: "1.0.0",
6
+ domain: "analytics",
7
+ stability: "experimental",
8
+ owners: ["@example.analytics-dashboard"],
9
+ tags: ["analytics", "dashboard", "visualization"]
10
+ };
11
+ var ChannelMixVisualization = defineVisualization({
12
+ meta: {
13
+ ...META,
14
+ key: "analytics.visualization.channel-mix",
15
+ title: "Channel Mix",
16
+ description: "Session distribution across acquisition channels.",
17
+ goal: "Explain which channels currently drive the largest share of traffic.",
18
+ context: "Marketing attribution dashboard."
19
+ },
20
+ source: { primary: QUERY_REF, resultPath: "data" },
21
+ visualization: {
22
+ kind: "pie",
23
+ nameDimension: "channel",
24
+ valueMeasure: "sessions",
25
+ dimensions: [
26
+ {
27
+ key: "channel",
28
+ label: "Channel",
29
+ dataPath: "channel",
30
+ type: "category"
31
+ }
32
+ ],
33
+ measures: [{ key: "sessions", label: "Sessions", dataPath: "sessions" }],
34
+ table: { caption: "Sessions by acquisition channel." }
35
+ }
36
+ });
37
+ var EngagementHeatmapVisualization = defineVisualization({
38
+ meta: {
39
+ ...META,
40
+ key: "analytics.visualization.engagement-heatmap",
41
+ title: "Engagement Heatmap",
42
+ description: "Average engagement score by weekday and time band.",
43
+ goal: "Reveal the highest-engagement time windows for product activity.",
44
+ context: "Usage analytics dashboard."
45
+ },
46
+ source: { primary: QUERY_REF, resultPath: "data" },
47
+ visualization: {
48
+ kind: "heatmap",
49
+ xDimension: "timeBand",
50
+ yDimension: "weekday",
51
+ valueMeasure: "engagementScore",
52
+ dimensions: [
53
+ {
54
+ key: "timeBand",
55
+ label: "Time Band",
56
+ dataPath: "timeBand",
57
+ type: "category"
58
+ },
59
+ {
60
+ key: "weekday",
61
+ label: "Weekday",
62
+ dataPath: "weekday",
63
+ type: "category"
64
+ }
65
+ ],
66
+ measures: [
67
+ {
68
+ key: "engagementScore",
69
+ label: "Engagement",
70
+ dataPath: "engagementScore"
71
+ }
72
+ ],
73
+ table: { caption: "Engagement score by weekday and time band." }
74
+ }
75
+ });
76
+ var ConversionFunnelVisualization = defineVisualization({
77
+ meta: {
78
+ ...META,
79
+ key: "analytics.visualization.conversion-funnel",
80
+ title: "Conversion Funnel",
81
+ description: "Progression through the main acquisition funnel.",
82
+ goal: "Show where the product is losing the largest share of prospects.",
83
+ context: "Growth dashboard."
84
+ },
85
+ source: { primary: QUERY_REF, resultPath: "data" },
86
+ visualization: {
87
+ kind: "funnel",
88
+ nameDimension: "stage",
89
+ valueMeasure: "users",
90
+ sort: "descending",
91
+ dimensions: [
92
+ { key: "stage", label: "Stage", dataPath: "stage", type: "category" }
93
+ ],
94
+ measures: [{ key: "users", label: "Users", dataPath: "users" }],
95
+ table: { caption: "Users per conversion stage." }
96
+ }
97
+ });
98
+ var AccountCoverageGeoVisualization = defineVisualization({
99
+ meta: {
100
+ ...META,
101
+ key: "analytics.visualization.account-coverage-geo",
102
+ title: "Account Coverage",
103
+ description: "High-value accounts plotted on a slippy-map surface.",
104
+ goal: "Locate where active commercial concentration is strongest.",
105
+ context: "Territory coverage dashboard."
106
+ },
107
+ source: { primary: QUERY_REF, resultPath: "data" },
108
+ visualization: {
109
+ kind: "geo",
110
+ mode: "slippy-map",
111
+ variant: "scatter",
112
+ nameDimension: "city",
113
+ latitudeDimension: "latitude",
114
+ longitudeDimension: "longitude",
115
+ valueMeasure: "accounts",
116
+ dimensions: [
117
+ { key: "city", label: "City", dataPath: "city", type: "category" },
118
+ {
119
+ key: "latitude",
120
+ label: "Latitude",
121
+ dataPath: "latitude",
122
+ type: "latitude"
123
+ },
124
+ {
125
+ key: "longitude",
126
+ label: "Longitude",
127
+ dataPath: "longitude",
128
+ type: "longitude"
129
+ }
130
+ ],
131
+ measures: [{ key: "accounts", label: "Accounts", dataPath: "accounts" }],
132
+ table: { caption: "Account concentration by city." }
133
+ }
134
+ });
135
+ export {
136
+ EngagementHeatmapVisualization,
137
+ ConversionFunnelVisualization,
138
+ ChannelMixVisualization,
139
+ AccountCoverageGeoVisualization
140
+ };
@@ -0,0 +1,198 @@
1
+ // src/visualizations/specs.performance.ts
2
+ import { defineVisualization } from "@contractspec/lib.contracts-spec/visualizations";
3
+ var QUERY_REF = { key: "analytics.query.execute", version: "1.0.0" };
4
+ var META = {
5
+ version: "1.0.0",
6
+ domain: "analytics",
7
+ stability: "experimental",
8
+ owners: ["@example.analytics-dashboard"],
9
+ tags: ["analytics", "dashboard", "visualization"]
10
+ };
11
+ var RevenueMetricVisualization = defineVisualization({
12
+ meta: {
13
+ ...META,
14
+ key: "analytics.visualization.revenue-metric",
15
+ title: "Revenue Snapshot",
16
+ description: "Current recurring revenue with prior-period comparison.",
17
+ goal: "Highlight the headline commercial metric for the dashboard.",
18
+ context: "Executive revenue overview."
19
+ },
20
+ source: { primary: QUERY_REF, resultPath: "data" },
21
+ visualization: {
22
+ kind: "metric",
23
+ measure: "totalRevenue",
24
+ comparisonMeasure: "priorRevenue",
25
+ dimensions: [
26
+ { key: "period", label: "Period", dataPath: "period", type: "time" }
27
+ ],
28
+ measures: [
29
+ {
30
+ key: "totalRevenue",
31
+ label: "Revenue",
32
+ dataPath: "totalRevenue",
33
+ format: "currency"
34
+ },
35
+ {
36
+ key: "priorRevenue",
37
+ label: "Prior Revenue",
38
+ dataPath: "priorRevenue",
39
+ format: "currency"
40
+ }
41
+ ],
42
+ sparkline: { dimension: "period", measure: "totalRevenue" },
43
+ table: { caption: "Revenue trend and prior period values." }
44
+ }
45
+ });
46
+ var RevenueTrendVisualization = defineVisualization({
47
+ meta: {
48
+ ...META,
49
+ key: "analytics.visualization.revenue-trend",
50
+ title: "Revenue Trend",
51
+ description: "Monthly revenue progression for the current quarter.",
52
+ goal: "Track whether revenue growth is accelerating or stalling.",
53
+ context: "Quarterly commercial dashboard."
54
+ },
55
+ source: { primary: QUERY_REF, resultPath: "data" },
56
+ visualization: {
57
+ kind: "cartesian",
58
+ variant: "line",
59
+ xDimension: "date",
60
+ yMeasures: ["revenue"],
61
+ dimensions: [
62
+ { key: "date", label: "Month", dataPath: "date", type: "time" }
63
+ ],
64
+ measures: [
65
+ {
66
+ key: "revenue",
67
+ label: "Revenue",
68
+ dataPath: "revenue",
69
+ format: "currency",
70
+ color: "#0f766e"
71
+ }
72
+ ],
73
+ thresholds: [
74
+ { key: "target", value: 140000, label: "Target", color: "#dc2626" }
75
+ ],
76
+ table: { caption: "Monthly revenue values." }
77
+ }
78
+ });
79
+ var RegionalRevenueVisualization = defineVisualization({
80
+ meta: {
81
+ ...META,
82
+ key: "analytics.visualization.regional-revenue",
83
+ title: "Regional Revenue",
84
+ description: "Revenue split by sales territory.",
85
+ goal: "Compare the strongest and weakest performing territories.",
86
+ context: "Territory planning and commercial comparison."
87
+ },
88
+ source: { primary: QUERY_REF, resultPath: "data" },
89
+ visualization: {
90
+ kind: "cartesian",
91
+ variant: "bar",
92
+ xDimension: "region",
93
+ yMeasures: ["revenue"],
94
+ dimensions: [
95
+ { key: "region", label: "Region", dataPath: "region", type: "category" }
96
+ ],
97
+ measures: [
98
+ {
99
+ key: "revenue",
100
+ label: "Revenue",
101
+ dataPath: "revenue",
102
+ format: "currency",
103
+ color: "#1d4ed8"
104
+ }
105
+ ],
106
+ table: { caption: "Revenue by region." }
107
+ }
108
+ });
109
+ var RetentionAreaVisualization = defineVisualization({
110
+ meta: {
111
+ ...META,
112
+ key: "analytics.visualization.retention-area",
113
+ title: "Retention Curve",
114
+ description: "Weekly retention progression across the active cohort.",
115
+ goal: "Show whether user retention remains above the desired floor.",
116
+ context: "Product health dashboard."
117
+ },
118
+ source: { primary: QUERY_REF, resultPath: "data" },
119
+ visualization: {
120
+ kind: "cartesian",
121
+ variant: "area",
122
+ xDimension: "week",
123
+ yMeasures: ["retentionRate"],
124
+ dimensions: [
125
+ { key: "week", label: "Week", dataPath: "week", type: "category" }
126
+ ],
127
+ measures: [
128
+ {
129
+ key: "retentionRate",
130
+ label: "Retention",
131
+ dataPath: "retentionRate",
132
+ format: "percentage",
133
+ color: "#16a34a"
134
+ }
135
+ ],
136
+ thresholds: [
137
+ { key: "floor", value: 0.5, label: "Floor", color: "#f59e0b" }
138
+ ],
139
+ table: { caption: "Weekly retention rate." }
140
+ }
141
+ });
142
+ var PipelineScatterVisualization = defineVisualization({
143
+ meta: {
144
+ ...META,
145
+ key: "analytics.visualization.pipeline-scatter",
146
+ title: "Pipeline Velocity",
147
+ description: "Deal-cycle length against win rate for active accounts.",
148
+ goal: "Spot outliers where the sales cycle is long but conversion remains weak.",
149
+ context: "Commercial operations dashboard."
150
+ },
151
+ source: { primary: QUERY_REF, resultPath: "data" },
152
+ visualization: {
153
+ kind: "cartesian",
154
+ variant: "scatter",
155
+ xDimension: "cycleDays",
156
+ yMeasures: ["winRate"],
157
+ dimensions: [
158
+ {
159
+ key: "cycleDays",
160
+ label: "Cycle Days",
161
+ dataPath: "cycleDays",
162
+ type: "number"
163
+ }
164
+ ],
165
+ measures: [
166
+ {
167
+ key: "winRate",
168
+ label: "Win Rate",
169
+ dataPath: "winRate",
170
+ format: "percentage",
171
+ color: "#7c3aed"
172
+ },
173
+ {
174
+ key: "arr",
175
+ label: "ARR",
176
+ dataPath: "arr",
177
+ format: "currency"
178
+ }
179
+ ],
180
+ series: [
181
+ {
182
+ key: "pipeline",
183
+ label: "Accounts",
184
+ measure: "winRate",
185
+ type: "scatter",
186
+ color: "#7c3aed"
187
+ }
188
+ ],
189
+ table: { caption: "Sales cycle and win rate per account." }
190
+ }
191
+ });
192
+ export {
193
+ RevenueTrendVisualization,
194
+ RevenueMetricVisualization,
195
+ RetentionAreaVisualization,
196
+ RegionalRevenueVisualization,
197
+ PipelineScatterVisualization
198
+ };