Add a Statistics page for storefront visits and instruction 1:1/3:2 crops.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
d9bdfbbb12
commit
6be867ea7a
@@ -73,3 +73,33 @@ export async function getViewDailyActivity(
|
||||
{ auth: true, signal },
|
||||
)
|
||||
}
|
||||
|
||||
export type ViewSummaryGroupId =
|
||||
| 'all'
|
||||
| 'home'
|
||||
| 'products'
|
||||
| 'blog'
|
||||
| 'portfolio'
|
||||
| 'videos'
|
||||
|
||||
export interface ViewPeriodCounts {
|
||||
today: number
|
||||
week: number
|
||||
month: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface ViewSummaryResponse {
|
||||
rows: Record<ViewSummaryGroupId, ViewPeriodCounts>
|
||||
}
|
||||
|
||||
export async function getViewSummary(signal?: AbortSignal) {
|
||||
const businessId = getActiveBusinessId()
|
||||
if (!businessId) {
|
||||
throw new Error('No active business selected. Please sign in again.')
|
||||
}
|
||||
return apiRequest<ViewSummaryResponse>(
|
||||
`/businesses/${businessId}/analytics/views/summary`,
|
||||
{ auth: true, signal },
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user