import type { Logger } from './logger'; export interface MapLike { [key: string]: T; } export type TypedAny = Record< string, | string | number | boolean | string[] | boolean[] | number[] | Record >; export type EventProcessorFn = (payload: TypedAny) => void; export interface AppCustomerInfo { first_name?: string; last_name?: string; email?: string; phone_number: number; country_code: number; city?: string; state?: string; country?: string; } export interface AppPageLoad { page_name: string; page_url?: string; is_entry?: number; deep_link_url?: string; app_version?: string; } export interface DeJsvHelper { log: typeof Logger.logDbg; err: typeof Logger.logError; } export interface QcInfoItem { nm: string; id: string; st: boolean; } export interface TagInfoItem { id: string; nm: string; pr: string; prNm: string; status: boolean; qc: string | string[]; } export type ReplaceMode = 'kph' | 'rph'; export interface HydrateTagInfo { isInError: boolean; content: string | number | null; errCd: string; // error code errMsg: string; // any descriptive error message } export interface ReportTagItem { st: 200 | 900 | 1000 | number; // what happened to this tag? t: string; // tag id p: string; // provider id tNm: string; req: any; // request payload } export interface Report { envName: string; // environment name inside magic pixel envId: string; // environment id inside magic pixel pname?: string; // page name evt: string; // dcr event if that triggered this report evtId: string; // event id dt?: number; // device type (converted to int) ln?: number; // language (converted to int) bw?: number; // browser name (converted to int) dm?: string; // clean domain name items: ReportTagItem[]; // list of tag items fired on that page for that condition tagCt: number; // expected tag count on this page dws: 'j' | 'n'; // down stream configuration. java or node v: string; // client sdk version for this call devPayload?: string; // base64 encoded developer payload } export interface UrlInfo { tfUrl: string; errUrl: string; rptUrl: string; infoUrl: string; baseUrl: string; attrInfoUrl: string; idlUrl: string; geoUrl?: string; baseUrlV4?: string; baseUrlV6?: string; } export interface VisitInfo { visitId: string; visitTs: number; visitCt: number; visitDepth: number; visitVer: number; } export interface VisitorInfo { dId: string; mId: string; st: number; } export interface SdkInitOptions { orgId: string; env: string; projectId: string; baseUrl: string; logLevel: string; /** * @deprecated device_type is now auto-detected and cannot be overridden * This field is ignored. The SDK uses Expo/react-native-device-info for reliable detection. */ device_type?: string; /** * @deprecated app_version is now auto-detected and cannot be overridden * This field is ignored. The SDK will always use the actual app version from the device. */ app_version?: string; /** * @deprecated os_version is now auto-detected and cannot be overridden * This field is ignored. The SDK will always use the actual OS version from the device. */ os_version?: string; /** * Event deduplication window in milliseconds * If the same event (name + payload) fires within this window, it will be skipped * Purchase events are deduplicated by transaction_id regardless of other fields * Default: 5000ms (5 seconds) * Set to 0 to disable deduplication */ eventDeduplicationWindowMs?: number; /** * Callback invoked when SDK initialization fails after all retries * Use this to handle initialization failures gracefully in your app * @param error The error that caused the failure */ onInitFailure?: (error: Error) => void; } export interface MpDeviceInfo { package_name?: string; // app package name like com.company.starter short_version?: string; long_version?: string; os_version?: string; // Will be auto-detected if not provided device_model_name?: string; // Will be auto-detected if not provided locale?: string; timezone_abbreviation?: string; carrier?: string; screen_width?: number; screen_height?: number; screen_density?: number; cpu_cores?: number; ext_storage?: number; free_storage?: number; device_timezone?: string; } export type EventBusCallback = (event: string, payload: any) => void;