SansiStore’s analytics module consolidates multiple report surfaces within the admin area. Rather than a single dashboard, each report type is an independent panel driven by its own Firestore service or server-side API route. All endpoints require a valid admin Bearer token and return JSON. The sections below describe each report panel, its data source, and the shape of data it exposes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProcesosAgilesUMSS/sansistore/llms.txt
Use this file to discover all available pages before exploring further.
Sales Reports
Sales Reports
The
Cancelled statuses:To inspect the full timeline for a specific order (buyer, seller, items, payment, and delivery records), use the separate
SalesReport component visualises revenue over time using getSalesByDateRange from salesService.ts. It queries the orders collection filtered by createdAt within the selected date range and groups results into completed vs. cancelled buckets.Completed statuses (generate revenue): ENTREGADO, COMPLETADO, PAGADOCancelled statuses:
CANCELADO, NO ENTREGADOThe service returns a SalesSummary object:GET /api/admin/order_history?orderId=<id> endpoint available under the Orders section.Top Products
Top Products
The
Response shape:The
TopSellingProducts component fetches the bestseller ranking from GET /api/admin/top_products. Products are ordered by soldCount descending from the products collection (filtered to active == true). Category names are resolved via a parallel categories collection query.Query parameters:| Parameter | Default | Max | Description |
|---|---|---|---|
limit | 10 | 50 | Number of products to return |
categoryId | — | — | Filter to a specific category |
useTopProducts hook (ventas/top-products/hooks/useTopProducts.ts) wraps getTopProducts from topProductServices.ts and manages loading/error state for the UI component.Demand Analysis
Demand Analysis
The An optional
DemandPanel component calls getDemandByHour from demandService.ts. It queries orders by createdAt range, counts orders per hour of day, and returns a DemandSummary:categoryId filter (passed as DemandFilterInput.categoryId) narrows the analysis to orders whose items belong to a specific category. Passing 'todas' returns the full dataset.Cancelled Orders Report
Cancelled Orders Report
The The summary endpoint
CancelledOrdersReport component uses getCancelledOrdersByPeriod and getCancelledOrdersSummary from cancelledOrdersService.ts.Period options: 'day' (today), 'week' (last 7 days), 'month' (current month from the 1st). Custom date ranges are also accepted via startDate / endDate.The service returns CancelledOrder[]:getCancelledOrdersSummary returns:Messenger Performance
Messenger Performance
The
MessengerPerformancePage surface is powered by messengerPerformanceService.ts. It reads the deliveries Firestore collection (statuses delivered / DELIVERED) and correlates deliveries to couriers via the courierId field.Two functions are exposed:getMessengerPerformanceByDay(messengerId, date) — Returns a MessengerPerformanceReport for a single courier on a given day:listenRecentCompletedDeliveries(callback) — Real-time Firestore listener returning the 10 most recently completed deliveries across all couriers, ordered by deliveredAt descending. Elapsed time is calculated as deliveredAt - assignedAt (or createdAt as fallback) in minutes.getMessengers() returns active users with roles containing mensajero for the courier filter dropdown.Courier Sessions Overview
Courier Sessions Overview
The
Response shape:To approve or reject a closure,
CourierSessionsValidation component fetches from GET /api/admin/courier_sessions via getPendingClosures in sessionsService.ts. Sessions are sourced from the messenger_shift_closures Firestore collection.Query parameters:| Parameter | Default | Description |
|---|---|---|
status | 'closed' | Filter by closure status (closed, validated, rejected) |
limit | 20 | Page size (max 50) |
cursor | — | Document ID of the last item for cursor-based pagination |
PATCH /api/admin/courier_sessions is called with { closureId, action: "approve" | "reject", rejectionReason? }. A closure that has already been validated or rejected cannot be modified (returns 409).Seller Activity Logs
Seller Activity Logs
The
Filter support: by
SellerActivityPanel subscribes to the sellerActivityLogs Firestore collection via getSellerActivityLogs in sellerActivityService.ts. Each document records a single action taken by a seller on an order.SellerActivityLog fields:| Field | Type | Description |
|---|---|---|
logId | string | Firestore document ID |
sellerId | string | UID of the seller |
sellerName | string | Display name at time of action |
sellerEmail | string | Email at time of action |
actionType | SellerActionType | One of the action types below |
orderId | string | Affected order ID |
previousStatus | string | Order status before the action |
newStatus | string | Order status after the action |
timestamp | Date | Server-side timestamp |
SellerActionType values:| Value | Label |
|---|---|
RESERVAR | Reservar |
CANCELAR | Cancelar |
MARCAR_LISTO | Marcar listo |
ASIGNAR | Asignar mensajero |
REASIGNAR | Reasignar mensajero |
MARCAR_PAGADA | Marcar pagada |
MARCAR_DEVUELTA | Marcar devuelta |
sellerId, actionType, and startDate/endDate. getSellersFromLogs() derives the unique seller list from existing log documents without querying the users collection.Orders List View
Orders List View
The
Response shape:Buyer names are resolved server-side by batch-fetching
useOrdersList hook drives a paginated table of all orders via GET /api/admin/orders_list.Query parameters:| Parameter | Default | Description |
|---|---|---|
status | — | Filter by order status string |
limit | 20 | Page size (max 50) |
cursor | — | orderId of the last document for pagination |
users documents in parallel, so customerName is always the human-readable display name when available.