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:
Alireza Hassani
2026-09-01 11:10:52 +03:30
co-authored by Cursor
parent d9bdfbbb12
commit 6be867ea7a
11 changed files with 410 additions and 17 deletions
@@ -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 },
)
}