import { Item } from './gtag.cjs'; import { EventName, TrackName, TrackProperties } from './types.cjs'; /** https://business.reddithelp.com/s/article/about-event-metadata */ type Product = { /** * (Required) Product ID: Either the SKU or GTIN, which represents the variant ID, not the * parent ID. If there are no variants, pass the assigned ID for that item. */ id: string; /** (Optional) Product Category: The group the product belongs to. */ name?: string; /** (Optional) Product Name: The title of the product. */ category?: string; }; /** * https://business.reddithelp.com/s/article/supported-conversion-events#supported-conversion-events * https://business.reddithelp.com/s/article/about-event-metadata * https://business.reddithelp.com/s/article/map-a-catalog-to-a-signal-source */ type StandardEvents = { PageVisit: { conversionId?: string; products?: Product[]; }; ViewContent: { conversionId?: string; products?: Product[]; }; Search: { conversionId?: string; products?: Product[]; }; AddToCart: { value?: number; currency?: string; itemCount?: number; conversionId?: string; products?: Product[]; }; AddToWishlist: { value?: number; currency?: string; itemCount?: number; conversionId?: string; products?: Product[]; }; Purchase: { value?: number; currency?: string; itemCount?: number; conversionId?: string; products?: Product[]; }; Lead: { value?: number; currency?: string; conversionId?: string; products?: Product[]; }; SignUp: { value?: number; currency?: string; conversionId?: string; products?: Product[]; }; }; type PixelId = `a2_${string}`; type MatchKeys = { email?: string; phoneNumber?: string; externalId?: string; idfa?: string; aaid?: string; }; type CustomEventParams = { customEventName: T; value?: number; currency?: string; itemCount?: number; conversionId?: string; products?: Product[]; }; interface RDT { rdt(event: 'init', pixelId: PixelId, matchKeys?: MatchKeys): void; rdt(event: 'track', type: T, params?: StandardEvents[T]): void; rdt(event: 'track', type: 'Custom', params: CustomEventParams): void; } type Mapped = [F, StandardEvents[F]]; type Missed = ['Custom', CustomEventParams]; declare function mapItems(items?: Item[]): undefined | Product[]; declare function mapRDTEvent(name: TrackName, properties?: TrackProperties, eventId?: string): Mapped | Missed>; type ServerStandardEvent = 'PAGE_VISIT' | 'VIEW_CONTENT' | 'SEARCH' | 'ADD_TO_CART' | 'ADD_TO_WISHLIST' | 'PURCHASE' | 'LEAD' | 'SIGN_UP'; declare function mapServerStandardEvent(name: keyof StandardEvents): ServerStandardEvent; export { type CustomEventParams, type MatchKeys, type PixelId, type Product, type RDT, type ServerStandardEvent, type StandardEvents, mapItems, mapRDTEvent, mapServerStandardEvent };