@coursebuilder/analytics 1.1.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/LICENSE +21 -0
- package/dist/api/index.d.ts +158 -0
- package/dist/api/index.js +317 -0
- package/dist/api/index.js.map +1 -0
- package/dist/catalog.d.ts +14 -0
- package/dist/catalog.js +209 -0
- package/dist/catalog.js.map +1 -0
- package/dist/components/index.d.ts +172 -0
- package/dist/components/index.js +1258 -0
- package/dist/components/index.js.map +1 -0
- package/dist/engine.d.ts +20 -0
- package/dist/engine.js +350 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +353 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/database.d.ts +79 -0
- package/dist/providers/database.js +533 -0
- package/dist/providers/database.js.map +1 -0
- package/dist/providers/derived.d.ts +45 -0
- package/dist/providers/derived.js +32 -0
- package/dist/providers/derived.js.map +1 -0
- package/dist/providers/ga4.d.ts +43 -0
- package/dist/providers/ga4.js +220 -0
- package/dist/providers/ga4.js.map +1 -0
- package/dist/providers/index.d.ts +8 -0
- package/dist/providers/index.js +1239 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/mux.d.ts +103 -0
- package/dist/providers/mux.js +241 -0
- package/dist/providers/mux.js.map +1 -0
- package/dist/providers/survey.d.ts +102 -0
- package/dist/providers/survey.js +233 -0
- package/dist/providers/survey.js.map +1 -0
- package/dist/types.d.ts +303 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +101 -0
- package/src/api/catalog-handler.ts +321 -0
- package/src/api/index.ts +4 -0
- package/src/api/token-handler.ts +71 -0
- package/src/catalog.ts +223 -0
- package/src/components/country-chart.tsx +114 -0
- package/src/components/index.ts +5 -0
- package/src/components/omnibus-dashboard.tsx +1460 -0
- package/src/components/revenue-chart.tsx +251 -0
- package/src/components/use-chart-colors.ts +75 -0
- package/src/engine.ts +201 -0
- package/src/index.ts +7 -0
- package/src/providers/database.ts +795 -0
- package/src/providers/derived.ts +79 -0
- package/src/providers/ga4.ts +173 -0
- package/src/providers/index.ts +44 -0
- package/src/providers/mux.ts +438 -0
- package/src/providers/survey.ts +487 -0
- package/src/types.ts +333 -0
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// src/catalog.ts
|
|
2
|
+
var catalog = {
|
|
3
|
+
summary: {
|
|
4
|
+
name: "summary",
|
|
5
|
+
description: "Revenue overview: total, purchase count, AOV",
|
|
6
|
+
category: "revenue",
|
|
7
|
+
provider: "database",
|
|
8
|
+
fn: "getRevenueSummary"
|
|
9
|
+
},
|
|
10
|
+
"revenue/daily": {
|
|
11
|
+
name: "revenue/daily",
|
|
12
|
+
description: "Revenue and purchase count per day",
|
|
13
|
+
category: "revenue",
|
|
14
|
+
provider: "database",
|
|
15
|
+
fn: "getRevenueByDay"
|
|
16
|
+
},
|
|
17
|
+
"revenue/products": {
|
|
18
|
+
name: "revenue/products",
|
|
19
|
+
description: "Revenue grouped by product",
|
|
20
|
+
category: "revenue",
|
|
21
|
+
provider: "database",
|
|
22
|
+
fn: "getRevenueByProduct"
|
|
23
|
+
},
|
|
24
|
+
"revenue/countries": {
|
|
25
|
+
name: "revenue/countries",
|
|
26
|
+
description: "Revenue grouped by country",
|
|
27
|
+
category: "revenue",
|
|
28
|
+
provider: "database",
|
|
29
|
+
fn: "getRevenueByCountry"
|
|
30
|
+
},
|
|
31
|
+
"purchases/recent": {
|
|
32
|
+
name: "purchases/recent",
|
|
33
|
+
description: "Last N purchases",
|
|
34
|
+
category: "revenue",
|
|
35
|
+
provider: "database",
|
|
36
|
+
fn: "getRecentPurchases"
|
|
37
|
+
},
|
|
38
|
+
attribution: {
|
|
39
|
+
name: "attribution",
|
|
40
|
+
description: "Attribution event counts by type",
|
|
41
|
+
category: "attribution",
|
|
42
|
+
provider: "database",
|
|
43
|
+
fn: "getAttributionSummary"
|
|
44
|
+
},
|
|
45
|
+
"attribution/shortlinks": {
|
|
46
|
+
name: "attribution/shortlinks",
|
|
47
|
+
description: "Per-shortlink click performance",
|
|
48
|
+
category: "attribution",
|
|
49
|
+
provider: "database",
|
|
50
|
+
fn: "getShortlinkPerformance"
|
|
51
|
+
},
|
|
52
|
+
"attribution/sources": {
|
|
53
|
+
name: "attribution/sources",
|
|
54
|
+
description: "Revenue by first-touch source/medium/campaign",
|
|
55
|
+
category: "attribution",
|
|
56
|
+
provider: "database",
|
|
57
|
+
fn: "getRevenueBySource"
|
|
58
|
+
},
|
|
59
|
+
"attribution/funnel": {
|
|
60
|
+
name: "attribution/funnel",
|
|
61
|
+
description: "Signup \u2192 purchase conversion funnel",
|
|
62
|
+
category: "attribution",
|
|
63
|
+
provider: "database",
|
|
64
|
+
fn: "getConversionFunnel"
|
|
65
|
+
},
|
|
66
|
+
"attribution/content": {
|
|
67
|
+
name: "attribution/content",
|
|
68
|
+
description: "Content consumed by purchasers",
|
|
69
|
+
category: "attribution",
|
|
70
|
+
provider: "database",
|
|
71
|
+
fn: "getContentPurchaseCorrelation"
|
|
72
|
+
},
|
|
73
|
+
"attribution/coverage": {
|
|
74
|
+
name: "attribution/coverage",
|
|
75
|
+
description: "Attributed vs dark revenue",
|
|
76
|
+
category: "attribution",
|
|
77
|
+
provider: "database",
|
|
78
|
+
fn: "getAttributedRevenueSummary"
|
|
79
|
+
},
|
|
80
|
+
traffic: {
|
|
81
|
+
name: "traffic",
|
|
82
|
+
description: "GA4 traffic overview",
|
|
83
|
+
category: "traffic",
|
|
84
|
+
provider: "ga4",
|
|
85
|
+
fn: "getTrafficOverview"
|
|
86
|
+
},
|
|
87
|
+
"traffic/daily": {
|
|
88
|
+
name: "traffic/daily",
|
|
89
|
+
description: "GA4 daily sessions",
|
|
90
|
+
category: "traffic",
|
|
91
|
+
provider: "ga4",
|
|
92
|
+
fn: "getSessionsByDay"
|
|
93
|
+
},
|
|
94
|
+
"traffic/pages": {
|
|
95
|
+
name: "traffic/pages",
|
|
96
|
+
description: "Top pages by pageviews",
|
|
97
|
+
category: "traffic",
|
|
98
|
+
provider: "ga4",
|
|
99
|
+
fn: "getTopPages"
|
|
100
|
+
},
|
|
101
|
+
"traffic/sources": {
|
|
102
|
+
name: "traffic/sources",
|
|
103
|
+
description: "Traffic sources",
|
|
104
|
+
category: "traffic",
|
|
105
|
+
provider: "ga4",
|
|
106
|
+
fn: "getTrafficSources"
|
|
107
|
+
},
|
|
108
|
+
youtube: {
|
|
109
|
+
name: "youtube",
|
|
110
|
+
description: "Channel overview (\u224848h lag)",
|
|
111
|
+
category: "youtube",
|
|
112
|
+
provider: "youtube",
|
|
113
|
+
fn: "getChannelOverview",
|
|
114
|
+
unavailableFix: "Complete OAuth at /api/analytics/youtube-auth"
|
|
115
|
+
},
|
|
116
|
+
"youtube/videos": {
|
|
117
|
+
name: "youtube/videos",
|
|
118
|
+
description: "Per-video performance (\u224848h lag)",
|
|
119
|
+
category: "youtube",
|
|
120
|
+
provider: "youtube",
|
|
121
|
+
fn: "getVideoPerformance",
|
|
122
|
+
unavailableFix: "Complete OAuth at /api/analytics/youtube-auth"
|
|
123
|
+
},
|
|
124
|
+
"youtube/daily": {
|
|
125
|
+
name: "youtube/daily",
|
|
126
|
+
description: "Daily views + watch minutes (\u224848h lag)",
|
|
127
|
+
category: "youtube",
|
|
128
|
+
provider: "youtube",
|
|
129
|
+
fn: "getChannelTimeseries",
|
|
130
|
+
unavailableFix: "Complete OAuth at /api/analytics/youtube-auth"
|
|
131
|
+
},
|
|
132
|
+
"youtube/sources": {
|
|
133
|
+
name: "youtube/sources",
|
|
134
|
+
description: "YouTube traffic sources (\u224848h lag)",
|
|
135
|
+
category: "youtube",
|
|
136
|
+
provider: "youtube",
|
|
137
|
+
fn: "getYouTubeTrafficSources",
|
|
138
|
+
unavailableFix: "Complete OAuth at /api/analytics/youtube-auth"
|
|
139
|
+
},
|
|
140
|
+
"correlation/traffic-revenue": {
|
|
141
|
+
name: "correlation/traffic-revenue",
|
|
142
|
+
description: "GA4 sessions + revenue by day",
|
|
143
|
+
category: "correlation",
|
|
144
|
+
provider: "derived",
|
|
145
|
+
fn: "getTrafficRevenueCorrelation"
|
|
146
|
+
},
|
|
147
|
+
"correlation/youtube-revenue": {
|
|
148
|
+
name: "correlation/youtube-revenue",
|
|
149
|
+
description: "YouTube (\u224848h lag) + GA4 + revenue overlay",
|
|
150
|
+
category: "correlation",
|
|
151
|
+
provider: "derived",
|
|
152
|
+
fn: "getYouTubeRevenueCorrelation"
|
|
153
|
+
},
|
|
154
|
+
surveys: {
|
|
155
|
+
name: "surveys",
|
|
156
|
+
description: "Survey overview: total surveys, responses, respondents",
|
|
157
|
+
category: "survey",
|
|
158
|
+
provider: "survey",
|
|
159
|
+
fn: "getSurveySummary"
|
|
160
|
+
},
|
|
161
|
+
"surveys/list": {
|
|
162
|
+
name: "surveys/list",
|
|
163
|
+
description: "All surveys with response counts",
|
|
164
|
+
category: "survey",
|
|
165
|
+
provider: "survey",
|
|
166
|
+
fn: "getSurveyList"
|
|
167
|
+
},
|
|
168
|
+
"surveys/daily": {
|
|
169
|
+
name: "surveys/daily",
|
|
170
|
+
description: "Daily survey response volume",
|
|
171
|
+
category: "survey",
|
|
172
|
+
provider: "survey",
|
|
173
|
+
fn: "getSurveyResponsesByDay"
|
|
174
|
+
},
|
|
175
|
+
"surveys/questions": {
|
|
176
|
+
name: "surveys/questions",
|
|
177
|
+
description: "Top questions by response count with answer distribution",
|
|
178
|
+
category: "survey",
|
|
179
|
+
provider: "survey",
|
|
180
|
+
fn: "getSurveyQuestionBreakdown"
|
|
181
|
+
},
|
|
182
|
+
"surveys/responses": {
|
|
183
|
+
name: "surveys/responses",
|
|
184
|
+
description: "Individual survey responses as flat rows (multi-choice and open-ended)",
|
|
185
|
+
category: "survey",
|
|
186
|
+
provider: "survey",
|
|
187
|
+
fn: "getSurveyResponses"
|
|
188
|
+
},
|
|
189
|
+
"attribution/email-campaigns": {
|
|
190
|
+
name: "attribution/email-campaigns",
|
|
191
|
+
description: "Kit email broadcasts \u2192 shortlink clicks \u2192 signups \u2192 purchases \u2192 revenue per campaign",
|
|
192
|
+
category: "attribution",
|
|
193
|
+
provider: "newsletter",
|
|
194
|
+
fn: "getEmailCampaignAttribution"
|
|
195
|
+
},
|
|
196
|
+
"correlation/survey-revenue": {
|
|
197
|
+
name: "correlation/survey-revenue",
|
|
198
|
+
description: "Survey respondents \u2192 purchase conversion by question/answer",
|
|
199
|
+
category: "correlation",
|
|
200
|
+
provider: "derived",
|
|
201
|
+
fn: "getSurveyRevenueCorrelation"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var ANALYTICS_CATALOG = catalog;
|
|
205
|
+
export {
|
|
206
|
+
ANALYTICS_CATALOG,
|
|
207
|
+
catalog
|
|
208
|
+
};
|
|
209
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/catalog.ts"],"sourcesContent":["import type { SurfaceName } from './types'\n\nexport interface SurfaceEntry {\n\tname: SurfaceName\n\tdescription: string\n\tcategory:\n\t\t| 'revenue'\n\t\t| 'attribution'\n\t\t| 'traffic'\n\t\t| 'youtube'\n\t\t| 'correlation'\n\t\t| 'survey'\n\tprovider: 'database' | 'ga4' | 'youtube' | 'derived' | 'newsletter' | 'survey'\n\tfn: string\n\tunavailableFix?: string\n}\n\nexport const catalog: Record<SurfaceName, SurfaceEntry> = {\n\tsummary: {\n\t\tname: 'summary',\n\t\tdescription: 'Revenue overview: total, purchase count, AOV',\n\t\tcategory: 'revenue',\n\t\tprovider: 'database',\n\t\tfn: 'getRevenueSummary',\n\t},\n\t'revenue/daily': {\n\t\tname: 'revenue/daily',\n\t\tdescription: 'Revenue and purchase count per day',\n\t\tcategory: 'revenue',\n\t\tprovider: 'database',\n\t\tfn: 'getRevenueByDay',\n\t},\n\t'revenue/products': {\n\t\tname: 'revenue/products',\n\t\tdescription: 'Revenue grouped by product',\n\t\tcategory: 'revenue',\n\t\tprovider: 'database',\n\t\tfn: 'getRevenueByProduct',\n\t},\n\t'revenue/countries': {\n\t\tname: 'revenue/countries',\n\t\tdescription: 'Revenue grouped by country',\n\t\tcategory: 'revenue',\n\t\tprovider: 'database',\n\t\tfn: 'getRevenueByCountry',\n\t},\n\t'purchases/recent': {\n\t\tname: 'purchases/recent',\n\t\tdescription: 'Last N purchases',\n\t\tcategory: 'revenue',\n\t\tprovider: 'database',\n\t\tfn: 'getRecentPurchases',\n\t},\n\tattribution: {\n\t\tname: 'attribution',\n\t\tdescription: 'Attribution event counts by type',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getAttributionSummary',\n\t},\n\t'attribution/shortlinks': {\n\t\tname: 'attribution/shortlinks',\n\t\tdescription: 'Per-shortlink click performance',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getShortlinkPerformance',\n\t},\n\t'attribution/sources': {\n\t\tname: 'attribution/sources',\n\t\tdescription: 'Revenue by first-touch source/medium/campaign',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getRevenueBySource',\n\t},\n\t'attribution/funnel': {\n\t\tname: 'attribution/funnel',\n\t\tdescription: 'Signup → purchase conversion funnel',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getConversionFunnel',\n\t},\n\t'attribution/content': {\n\t\tname: 'attribution/content',\n\t\tdescription: 'Content consumed by purchasers',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getContentPurchaseCorrelation',\n\t},\n\t'attribution/coverage': {\n\t\tname: 'attribution/coverage',\n\t\tdescription: 'Attributed vs dark revenue',\n\t\tcategory: 'attribution',\n\t\tprovider: 'database',\n\t\tfn: 'getAttributedRevenueSummary',\n\t},\n\ttraffic: {\n\t\tname: 'traffic',\n\t\tdescription: 'GA4 traffic overview',\n\t\tcategory: 'traffic',\n\t\tprovider: 'ga4',\n\t\tfn: 'getTrafficOverview',\n\t},\n\t'traffic/daily': {\n\t\tname: 'traffic/daily',\n\t\tdescription: 'GA4 daily sessions',\n\t\tcategory: 'traffic',\n\t\tprovider: 'ga4',\n\t\tfn: 'getSessionsByDay',\n\t},\n\t'traffic/pages': {\n\t\tname: 'traffic/pages',\n\t\tdescription: 'Top pages by pageviews',\n\t\tcategory: 'traffic',\n\t\tprovider: 'ga4',\n\t\tfn: 'getTopPages',\n\t},\n\t'traffic/sources': {\n\t\tname: 'traffic/sources',\n\t\tdescription: 'Traffic sources',\n\t\tcategory: 'traffic',\n\t\tprovider: 'ga4',\n\t\tfn: 'getTrafficSources',\n\t},\n\tyoutube: {\n\t\tname: 'youtube',\n\t\tdescription: 'Channel overview (≈48h lag)',\n\t\tcategory: 'youtube',\n\t\tprovider: 'youtube',\n\t\tfn: 'getChannelOverview',\n\t\tunavailableFix: 'Complete OAuth at /api/analytics/youtube-auth',\n\t},\n\t'youtube/videos': {\n\t\tname: 'youtube/videos',\n\t\tdescription: 'Per-video performance (≈48h lag)',\n\t\tcategory: 'youtube',\n\t\tprovider: 'youtube',\n\t\tfn: 'getVideoPerformance',\n\t\tunavailableFix: 'Complete OAuth at /api/analytics/youtube-auth',\n\t},\n\t'youtube/daily': {\n\t\tname: 'youtube/daily',\n\t\tdescription: 'Daily views + watch minutes (≈48h lag)',\n\t\tcategory: 'youtube',\n\t\tprovider: 'youtube',\n\t\tfn: 'getChannelTimeseries',\n\t\tunavailableFix: 'Complete OAuth at /api/analytics/youtube-auth',\n\t},\n\t'youtube/sources': {\n\t\tname: 'youtube/sources',\n\t\tdescription: 'YouTube traffic sources (≈48h lag)',\n\t\tcategory: 'youtube',\n\t\tprovider: 'youtube',\n\t\tfn: 'getYouTubeTrafficSources',\n\t\tunavailableFix: 'Complete OAuth at /api/analytics/youtube-auth',\n\t},\n\t'correlation/traffic-revenue': {\n\t\tname: 'correlation/traffic-revenue',\n\t\tdescription: 'GA4 sessions + revenue by day',\n\t\tcategory: 'correlation',\n\t\tprovider: 'derived',\n\t\tfn: 'getTrafficRevenueCorrelation',\n\t},\n\t'correlation/youtube-revenue': {\n\t\tname: 'correlation/youtube-revenue',\n\t\tdescription: 'YouTube (≈48h lag) + GA4 + revenue overlay',\n\t\tcategory: 'correlation',\n\t\tprovider: 'derived',\n\t\tfn: 'getYouTubeRevenueCorrelation',\n\t},\n\tsurveys: {\n\t\tname: 'surveys',\n\t\tdescription: 'Survey overview: total surveys, responses, respondents',\n\t\tcategory: 'survey',\n\t\tprovider: 'survey',\n\t\tfn: 'getSurveySummary',\n\t},\n\t'surveys/list': {\n\t\tname: 'surveys/list',\n\t\tdescription: 'All surveys with response counts',\n\t\tcategory: 'survey',\n\t\tprovider: 'survey',\n\t\tfn: 'getSurveyList',\n\t},\n\t'surveys/daily': {\n\t\tname: 'surveys/daily',\n\t\tdescription: 'Daily survey response volume',\n\t\tcategory: 'survey',\n\t\tprovider: 'survey',\n\t\tfn: 'getSurveyResponsesByDay',\n\t},\n\t'surveys/questions': {\n\t\tname: 'surveys/questions',\n\t\tdescription: 'Top questions by response count with answer distribution',\n\t\tcategory: 'survey',\n\t\tprovider: 'survey',\n\t\tfn: 'getSurveyQuestionBreakdown',\n\t},\n\t'surveys/responses': {\n\t\tname: 'surveys/responses',\n\t\tdescription:\n\t\t\t'Individual survey responses as flat rows (multi-choice and open-ended)',\n\t\tcategory: 'survey',\n\t\tprovider: 'survey',\n\t\tfn: 'getSurveyResponses',\n\t},\n\t'attribution/email-campaigns': {\n\t\tname: 'attribution/email-campaigns',\n\t\tdescription:\n\t\t\t'Kit email broadcasts → shortlink clicks → signups → purchases → revenue per campaign',\n\t\tcategory: 'attribution',\n\t\tprovider: 'newsletter',\n\t\tfn: 'getEmailCampaignAttribution',\n\t},\n\t'correlation/survey-revenue': {\n\t\tname: 'correlation/survey-revenue',\n\t\tdescription: 'Survey respondents → purchase conversion by question/answer',\n\t\tcategory: 'correlation',\n\t\tprovider: 'derived',\n\t\tfn: 'getSurveyRevenueCorrelation',\n\t},\n} as const satisfies Record<SurfaceName, SurfaceEntry>\n\nexport const ANALYTICS_CATALOG = catalog\n"],"mappings":"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","names":["catalog","summary","name","description","category","provider","fn","attribution","traffic","youtube","unavailableFix","surveys","ANALYTICS_CATALOG"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AnalyticsRange } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data structure for the Mux video dashboard, inlined here so the shared
|
|
6
|
+
* component does not depend on the app-level mux-data module.
|
|
7
|
+
*/
|
|
8
|
+
interface VideoDashboardData {
|
|
9
|
+
overview: {
|
|
10
|
+
totalViews: number;
|
|
11
|
+
uniqueViewers: number;
|
|
12
|
+
totalWatchTimeMs: number;
|
|
13
|
+
totalPlayingTimeMs: number;
|
|
14
|
+
viewerExperienceScore: number;
|
|
15
|
+
globalExperienceScore: number | null;
|
|
16
|
+
};
|
|
17
|
+
watchTimeSeries: {
|
|
18
|
+
date: string;
|
|
19
|
+
watchTimeMs: number;
|
|
20
|
+
}[];
|
|
21
|
+
topVideos: {
|
|
22
|
+
title: string;
|
|
23
|
+
views: number;
|
|
24
|
+
watchTimeMs: number;
|
|
25
|
+
playingTimeMs: number;
|
|
26
|
+
}[];
|
|
27
|
+
countries: {
|
|
28
|
+
country: string;
|
|
29
|
+
views: number;
|
|
30
|
+
watchTimeMs: number;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
interface DashboardData {
|
|
34
|
+
summary: {
|
|
35
|
+
totalRevenue: number;
|
|
36
|
+
purchaseCount: number;
|
|
37
|
+
avgOrderValue: number;
|
|
38
|
+
};
|
|
39
|
+
daily: {
|
|
40
|
+
date: string;
|
|
41
|
+
revenue: number;
|
|
42
|
+
count: number;
|
|
43
|
+
}[];
|
|
44
|
+
previousDaily: {
|
|
45
|
+
date: string;
|
|
46
|
+
revenue: number;
|
|
47
|
+
count: number;
|
|
48
|
+
}[];
|
|
49
|
+
byProduct: {
|
|
50
|
+
productId: string;
|
|
51
|
+
productName: string;
|
|
52
|
+
revenue: number;
|
|
53
|
+
count: number;
|
|
54
|
+
}[];
|
|
55
|
+
byCountry: {
|
|
56
|
+
country: string;
|
|
57
|
+
revenue: number;
|
|
58
|
+
count: number;
|
|
59
|
+
}[];
|
|
60
|
+
recentPurchases: {
|
|
61
|
+
id: string;
|
|
62
|
+
createdAt: Date;
|
|
63
|
+
totalAmount: number;
|
|
64
|
+
productName: string;
|
|
65
|
+
productId: string;
|
|
66
|
+
country: string | null;
|
|
67
|
+
couponId: string | null;
|
|
68
|
+
userName: string | null;
|
|
69
|
+
userEmail: string | null;
|
|
70
|
+
isTeam: boolean;
|
|
71
|
+
seats: number | null;
|
|
72
|
+
}[];
|
|
73
|
+
attribution: {
|
|
74
|
+
type: string;
|
|
75
|
+
count: number;
|
|
76
|
+
}[];
|
|
77
|
+
shortlinks: {
|
|
78
|
+
shortlinkId: string;
|
|
79
|
+
slug: string;
|
|
80
|
+
url: string;
|
|
81
|
+
clicks: number;
|
|
82
|
+
signups: number;
|
|
83
|
+
purchases: number;
|
|
84
|
+
}[];
|
|
85
|
+
traffic: {
|
|
86
|
+
sessions: number;
|
|
87
|
+
totalUsers: number;
|
|
88
|
+
newUsers: number;
|
|
89
|
+
pageviews: number;
|
|
90
|
+
} | null;
|
|
91
|
+
attributionCoverage: {
|
|
92
|
+
totalRevenue: number;
|
|
93
|
+
attributedRevenue: number;
|
|
94
|
+
unattributedRevenue: number;
|
|
95
|
+
attributionRate: number;
|
|
96
|
+
totalPurchases: number;
|
|
97
|
+
} | null;
|
|
98
|
+
mux: VideoDashboardData | null;
|
|
99
|
+
muxThumbnails: Record<string, string>;
|
|
100
|
+
surveySegments: {
|
|
101
|
+
questionId: string;
|
|
102
|
+
question: string;
|
|
103
|
+
type: string | null;
|
|
104
|
+
responses: number;
|
|
105
|
+
answerDistribution: {
|
|
106
|
+
answer: string;
|
|
107
|
+
count: number;
|
|
108
|
+
}[];
|
|
109
|
+
}[] | null;
|
|
110
|
+
surveyCorrelation: {
|
|
111
|
+
totalRespondents: number;
|
|
112
|
+
respondentsWhoPurchased: number;
|
|
113
|
+
overallConversionRate: number;
|
|
114
|
+
totalRevenueFromRespondents: number;
|
|
115
|
+
prePurchaseRespondents: number;
|
|
116
|
+
postPurchaseRespondents: number;
|
|
117
|
+
neverPurchasedRespondents: number;
|
|
118
|
+
baselineConversionRate: number;
|
|
119
|
+
byQuestion: {
|
|
120
|
+
questionId: string;
|
|
121
|
+
questionTitle: string | null;
|
|
122
|
+
answer: string;
|
|
123
|
+
respondents: number;
|
|
124
|
+
purchasers: number;
|
|
125
|
+
conversionRate: number;
|
|
126
|
+
revenue: number;
|
|
127
|
+
prePurchaseCount: number;
|
|
128
|
+
postPurchaseCount: number;
|
|
129
|
+
}[];
|
|
130
|
+
} | null;
|
|
131
|
+
}
|
|
132
|
+
declare function OmnibusDashboard({ data, initialRange, appName, surveyDrilldownHref, }: {
|
|
133
|
+
data: DashboardData;
|
|
134
|
+
initialRange: AnalyticsRange;
|
|
135
|
+
appName?: string;
|
|
136
|
+
/** Link to the analytics survey list page (e.g. /admin/analytics/surveys).
|
|
137
|
+
* When set, the Survey Segments header becomes a clickable link. */
|
|
138
|
+
surveyDrilldownHref?: string;
|
|
139
|
+
}): react_jsx_runtime.JSX.Element;
|
|
140
|
+
|
|
141
|
+
interface DayData {
|
|
142
|
+
date: string;
|
|
143
|
+
revenue: number;
|
|
144
|
+
count: number;
|
|
145
|
+
}
|
|
146
|
+
interface RevenueChartProps {
|
|
147
|
+
data: DayData[];
|
|
148
|
+
previousData?: DayData[];
|
|
149
|
+
}
|
|
150
|
+
declare function RevenueChart({ data, previousData }: RevenueChartProps): react_jsx_runtime.JSX.Element;
|
|
151
|
+
|
|
152
|
+
interface CountryChartProps {
|
|
153
|
+
data: {
|
|
154
|
+
country: string;
|
|
155
|
+
revenue: number;
|
|
156
|
+
count: number;
|
|
157
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
declare function CountryChart({ data }: CountryChartProps): react_jsx_runtime.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface ChartColors {
|
|
162
|
+
primary: string;
|
|
163
|
+
primaryMuted: string;
|
|
164
|
+
foreground: string;
|
|
165
|
+
mutedForeground: string;
|
|
166
|
+
gridLine: string;
|
|
167
|
+
cardBg: string;
|
|
168
|
+
hoverBg: string;
|
|
169
|
+
}
|
|
170
|
+
declare function useChartColors(): ChartColors;
|
|
171
|
+
|
|
172
|
+
export { type ChartColors, CountryChart, type DashboardData, OmnibusDashboard, RevenueChart, type VideoDashboardData, useChartColors };
|