import { Mapping as Mapping$1, Destination as Destination$1 } from '@walkeros/core'; import { DestinationServer } from '@walkeros/server-core'; /** * Mock-friendly interface for the TrackClient methods the * destination actually calls. Tests provide this via env.trackClient * instead of the real SDK. */ interface CustomerIoTrackClientMock { identify: (customerId: string | number, attributes: Record) => Promise; track: (customerId: string | number, eventData: { name: string; data?: Record; timestamp?: number; }) => Promise; trackAnonymous: (anonymousId: string, eventData: { name: string; data?: Record; timestamp?: number; }) => Promise; trackPageView: (customerId: string | number, url: string, data?: Record) => Promise; destroy: (customerId: string | number) => Promise; suppress: (customerId: string | number) => Promise; unsuppress: (customerId: string | number) => Promise; addDevice: (customerId: string | number, deviceId: string, platform: string, data?: Record) => Promise; deleteDevice: (customerId: string | number, deviceId: string, platform: string) => Promise; mergeCustomers: (primaryType: string, primaryId: string, secondaryType: string, secondaryId: string) => Promise; } /** * Mock-friendly interface for the APIClient methods the * destination actually calls. Tests provide this via env.apiClient * instead of the real SDK. */ interface CustomerIoApiClientMock { sendEmail: (request: unknown) => Promise; sendPush: (request: unknown) => Promise; } interface Settings { /** Customer.io Site ID (required for Track API). */ siteId: string; /** Customer.io API Key (required for Track API). */ apiKey: string; /** App API Key for transactional messaging (optional). */ appApiKey?: string; /** Region: 'us' or 'eu'. Default: 'us'. */ region?: 'us' | 'eu'; /** HTTP request timeout in ms. Default: 10000. */ timeout?: number; /** walkerOS mapping value path to resolve customerId from each event. */ customerId?: string; /** walkerOS mapping value path to resolve anonymousId from each event. */ anonymousId?: string; /** Destination-level identify mapping (fires identify() on first push / change). */ identify?: Mapping$1.Value; /** Runtime state -- not user-facing. */ _trackClient?: CustomerIoTrackClientMock; _apiClient?: CustomerIoApiClientMock; _state?: RuntimeState; } interface RuntimeState { lastIdentity?: { customerId?: string; attributesHash?: string; }; } type InitSettings = Partial; /** * Per-rule mapping settings. Controls which Customer.io methods are called * beyond the default track(). Resolved via getMappingValue() in push(). */ interface Mapping { /** Per-event identify attributes. Resolves to { email?, first_name?, ... }. */ identify?: Mapping$1.Value; /** Fire trackPageView(). Resolves to { url, ... }. */ page?: Mapping$1.Value; /** Fire destroy(). Boolean true triggers deletion. */ destroy?: boolean; /** Fire suppress(). Boolean true triggers suppression. */ suppress?: boolean; /** Fire unsuppress(). Boolean true triggers unsuppression. */ unsuppress?: boolean; /** Fire addDevice(). Resolves to { deviceId, platform, data? }. */ addDevice?: Mapping$1.Value; /** Fire deleteDevice(). Resolves to { deviceId, platform }. */ deleteDevice?: Mapping$1.Value; /** Fire mergeCustomers(). Resolves to { primaryType, primaryId, secondaryType, secondaryId }. */ merge?: Mapping$1.Value; /** Fire sendEmail(). Resolves to { to, transactional_message_id, message_data?, identifiers? }. */ sendEmail?: Mapping$1.Value; /** Fire sendPush(). Resolves to { transactional_message_id, message_data?, identifiers? }. */ sendPush?: Mapping$1.Value; } /** * Env -- optional SDK override. Production leaves this undefined and the * destination creates real TrackClient/APIClient instances. Tests provide * mocks via env.trackClient and env.apiClient. */ interface Env extends DestinationServer.Env { trackClient?: CustomerIoTrackClientMock; apiClient?: CustomerIoApiClientMock; } type Types = Destination$1.Types; interface Destination extends DestinationServer.Destination { init: DestinationServer.InitFn; } type Config = { settings: Settings; } & DestinationServer.Config; type InitFn = DestinationServer.InitFn; type PushFn = DestinationServer.PushFn; type PartialConfig = DestinationServer.PartialConfig; type PushEvents = DestinationServer.PushEvents; type Rule = Mapping$1.Rule; type Rules = Mapping$1.Rules; type index_Config = Config; type index_CustomerIoApiClientMock = CustomerIoApiClientMock; type index_CustomerIoTrackClientMock = CustomerIoTrackClientMock; type index_Destination = Destination; type index_Env = Env; type index_InitFn = InitFn; type index_InitSettings = InitSettings; type index_Mapping = Mapping; type index_PartialConfig = PartialConfig; type index_PushEvents = PushEvents; type index_PushFn = PushFn; type index_Rule = Rule; type index_Rules = Rules; type index_RuntimeState = RuntimeState; type index_Settings = Settings; type index_Types = Types; declare namespace index { export type { index_Config as Config, index_CustomerIoApiClientMock as CustomerIoApiClientMock, index_CustomerIoTrackClientMock as CustomerIoTrackClientMock, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_RuntimeState as RuntimeState, index_Settings as Settings, index_Types as Types }; } declare const destinationCustomerIo: Destination; export { index as DestinationCustomerIo, destinationCustomerIo as default, destinationCustomerIo };