import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core'; import { DestinationWeb } from '@walkeros/web-core'; import { Config as Config$1 } from 'mixpanel-browser'; /** * Destination-level settings. * * Extends Mixpanel's `Config` so every `mixpanel.init()` option flows through * without per-field plumbing. The destination adds walkerOS-specific keys: * - `apiKey` (required) — maps to the first arg of `mixpanel.init()` * - `identify` — destination-level identity mapping * - `include` — event sections flattened into `track()` properties * - `group` — destination-level group association * - `_state` — runtime state (not user-facing, mutated by init/push) */ interface Settings extends Partial { apiKey: string; identify?: Mapping$1.Value; group?: Mapping$1.Value; /** Runtime state — populated by init() and mutated by push(). Not user-facing. */ _state?: RuntimeState; } interface RuntimeState { /** Last-set distinct_id, used to skip redundant identify() calls. */ lastIdentity?: { distinctId?: string; }; } type InitSettings = Partial; /** * Per-rule mapping settings. Every feature here is a walkerOS mapping value * resolved via getMappingValue(). Keys follow Mixpanel's native method names: * - `identify` → `mixpanel.identify(distinctId)` * - `people` → `mixpanel.people.{set,set_once,increment,append,union,remove,unset,delete_user}` * - `group` → `mixpanel.set_group(key, id)` * - `groupProfile` → `mixpanel.get_group(key, id).{set,set_once,unset,union,remove,delete}` * - `reset` → `mixpanel.reset()` */ interface Mapping { identify?: Mapping$1.Value; people?: Mapping$1.Value; group?: Mapping$1.Value; groupProfile?: Mapping$1.Value; reset?: Mapping$1.Value | boolean; } /** * The `people` namespace on the mixpanel singleton. Mirrors the real SDK * shape so tests can spy each method individually. */ interface MixpanelPeople { set: (prop: string | Record, to?: unknown, callback?: () => void) => void; set_once: (prop: string | Record, to?: unknown, callback?: () => void) => void; increment: (prop: string | Record, by?: number, callback?: () => void) => void; append: (prop: string | Record, value?: unknown, callback?: () => void) => void; union: (prop: string | Record, value?: unknown[], callback?: () => void) => void; remove: (prop: string | Record, value?: unknown, callback?: () => void) => void; unset: (prop: string | string[], callback?: () => void) => void; delete_user: () => void; } /** * The handle returned by `mixpanel.get_group(key, id)`. Supports property * operations on the group profile. */ interface MixpanelGroup { set: (prop: string | Record, to?: unknown, callback?: () => void) => void; set_once: (prop: string | Record, to?: unknown, callback?: () => void) => void; unset: (prop: string | string[], callback?: () => void) => void; union: (prop: string | Record, value?: unknown[], callback?: () => void) => void; remove: (prop: string | Record, value?: unknown, callback?: () => void) => void; delete: () => void; } /** * Mixpanel SDK surface — the subset of `mixpanel-browser` the destination * actually uses. Mirrors the singleton's shape so tests can mock the whole * object via env.mixpanel. */ interface MixpanelSDK { init: (token: string, config?: Partial, name?: string) => void; track: (event: string, properties?: Record, callback?: () => void) => void; identify: (distinctId?: string) => void; reset: () => void; set_group: (groupKey: string, groupIds: string | string[], callback?: () => void) => void; get_group: (groupKey: string, groupId: string) => MixpanelGroup; opt_in_tracking: (options?: Record) => void; opt_out_tracking: (options?: Record) => void; stop_batch_senders?: () => void; people: MixpanelPeople; } /** * Env — optional SDK override. Production leaves this undefined and the * destination falls back to the real `mixpanel-browser` default export. * Tests provide a mock via env.mixpanel = { ... }. */ interface Env extends DestinationWeb.Env { mixpanel?: MixpanelSDK; } type Types = Destination$1.Types; type Destination = DestinationWeb.Destination; type Config = DestinationWeb.Config; interface MixpanelDestination extends Destination { env?: Env; } type Rule = Mapping$1.Rule; type Rules = Mapping$1.Rules; type index_Config = Config; type index_Destination = Destination; type index_Env = Env; type index_InitSettings = InitSettings; type index_Mapping = Mapping; type index_MixpanelDestination = MixpanelDestination; type index_MixpanelGroup = MixpanelGroup; type index_MixpanelPeople = MixpanelPeople; type index_MixpanelSDK = MixpanelSDK; 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_Destination as Destination, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_MixpanelDestination as MixpanelDestination, index_MixpanelGroup as MixpanelGroup, index_MixpanelPeople as MixpanelPeople, index_MixpanelSDK as MixpanelSDK, index_Rule as Rule, index_Rules as Rules, index_RuntimeState as RuntimeState, index_Settings as Settings, index_Types as Types }; } declare const destinationMixpanel: Destination; export { index as DestinationMixpanel, destinationMixpanel as default, destinationMixpanel };