Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
22 lines
648 B
TypeScript
22 lines
648 B
TypeScript
import axiosInstance from '@/config/axios'
|
|
import type { TrafficSource } from '@/lib/trafficAttribution'
|
|
import { API_ROUTES } from '@/services/config'
|
|
|
|
export type TrafficPageKind = 'home' | 'event'
|
|
|
|
export interface ReportTrafficVisitPayload {
|
|
pageKind: TrafficPageKind
|
|
eventId?: string
|
|
source: TrafficSource
|
|
visitorKey: string
|
|
}
|
|
|
|
/** Fire-and-forget unique visit beacon. Errors are swallowed. */
|
|
export const reportTrafficVisit = async (payload: ReportTrafficVisitPayload): Promise<void> => {
|
|
try {
|
|
await axiosInstance.post(API_ROUTES.TRAFFIC_VISITS.CREATE, payload)
|
|
} catch {
|
|
// Attribution must never block the page.
|
|
}
|
|
}
|