/** * Error returned by the API */ export interface ApiError { /** Error message */ message: string; /** HTTP status code */ status: number; } /** * Generic API response wrapper */ export interface ApiResponse { /** Error object, if any */ err?: ApiError; /** Response payload */ res: T; } /** * Analytics event payload sent to backend */ export interface AnalyticsPayload { /** Name of the event */ eventName: string; /** Widget instance identifier */ widgetId: string; /** Post identifier (optional) */ postId?: string; /** Product identifier (optional) */ productId?: string; /** Carousel direction (optional) */ direction?: 'left' | 'right'; /** Position in carousel (optional) */ position?: number; /** ISO timestamp of the event */ timestamp: string; /** User agent string (optional) */ userAgent?: string; /** Referrer URL (optional) */ referrer?: string; /** Page location URL (optional) */ pageLocation?: string; /** Page title (optional) */ pageTitle?: string; /** Device category (optional) */ deviceCategory?: 'desktop' | 'mobile'; /** Whether analytics consent was granted (optional) */ consent?: boolean; /** Visitor/session identity (optional) */ identity?: { visitor_id: string; session_id: string; }; } /** * Item in an order request payload */ export interface OrderRequestItem { /** Product identifier */ productId: string; /** Quantity ordered (optional) */ quantity?: number; /** Price per item (optional) */ price?: number; } /** * Order payload sent to backend for conversion tracking */ export interface OrderRequestPayload { /** Unique order identifier */ order_id: string; /** Total revenue for the order */ revenue: number; /** Currency code */ currency: string; /** Visitor identifier (optional) */ visitor_id?: string; /** Session identifier (optional) */ session_id?: string; /** List of items in the order (optional) */ items?: OrderRequestItem[]; /** Page location URL (optional) */ page_location?: string; /** Referrer URL (optional) */ page_referrer?: string; }