/** Event names supported by CAPI providers. */ type EventName = 'PageView' | 'ViewContent' | 'AddToCart' | 'InitiateCheckout' | 'StartTrial' | 'Subscribe' | 'Purchase' | 'CompleteRegistration' | 'Search' | (string & {}); /** Parameters for tracking an event. */ interface TrackEventParams { /** Event name. */ name: EventName; /** Custom data to attach to the event. */ data?: Record; /** Monetary value of the event. */ value?: number; /** Currency code (e.g. "USD"). */ currency?: string; /** Deduplicate event across client/server using this ID. */ eventId?: string; } /** User identity for the identify call. */ interface IdentifyParams { /** Your internal user ID. */ userId?: string; /** User email (hashed server-side for privacy). */ email?: string; /** User phone number (hashed server-side for privacy). */ phone?: string; /** User display name. */ name?: string; } /** Server-side event params require a deviceId to identify the user. */ interface ServerTrackEventParams extends TrackEventParams { deviceId: string; userEmail?: string; userPhone?: string; clientIp?: string; } /** Server-side identify params require a deviceId. */ interface ServerIdentifyParams extends IdentifyParams { deviceId: string; clientIp?: string; geo?: Record; } /** * Server SDK — public entry. * * Wraps the vendored `../core/appcat-core-server` class in a defensive * subclass-style facade. The core constructor may throw (missing * `apiKey`), and auto-init of `appId` runs as an internal promise that * can reject later; both are caught here so nothing propagates into * consumer code or becomes an unhandled rejection. * * Return types mirror the core: `boolean` for mutation calls (true on * success, false on any failure path). */ /** Public server SDK configuration. */ interface AppCatConfig { /** Your API key from the AppCat dashboard. */ apiKey: string; /** App ID, resolved automatically from API key if omitted. */ appId?: string; /** Enable debug logging. */ debug?: boolean; } /** * Server-side SDK. Method signatures match the vendored core exactly; * only the call boundary is hardened. */ declare class AppCatServer { private readonly _core; constructor(config: AppCatConfig); trackEvent(params: ServerTrackEventParams): Promise; identify(params: ServerIdentifyParams): Promise; setTrackingConsent(params: { deviceId: string; granted: boolean; }): Promise; } export { type AppCatConfig, AppCatServer, type IdentifyParams, type ServerIdentifyParams, type ServerTrackEventParams, type TrackEventParams };