Skip to main content
Complete reference for all classes, methods, types, and events in the @appdna/react-native-sdk package.

AppDNA Class

The primary interface for the SDK. All methods are static and return Promise unless otherwise noted.

Core Methods

MethodSignatureReturnsDescription
configureconfigure(apiKey: string, env?: AppDNAEnvironment, options?: AppDNAOptions)Promise<void>Initialize the SDK
identifyidentify(userId: string, traits?: Record<string, unknown>)Promise<void>Identify the current user
resetreset()Promise<void>Clear user identity and flush events
tracktrack(event: string, properties?: Record<string, unknown>)Promise<void>Track a custom event
flushflush()Promise<void>Force flush all queued events
onReadyonReady()Promise<void>Wait for SDK initialization to complete
shutdownshutdown()Promise<void>Shut down the SDK and release resources
getSdkVersiongetSdkVersion()Promise<string>Get the SDK version string
setLogLevelsetLogLevel(level: AppDNALogLevel)voidSet log verbosity (synchronous)
setConsentsetConsent(analytics: boolean)Promise<void>Set analytics consent status
setLogLevel is the only synchronous method on the AppDNA class. All other methods return Promises and should be awaited.

Config Methods

MethodSignatureReturnsDescription
getRemoteConfiggetRemoteConfig(key: string)Promise<unknown>Get a remote config value by key
isFeatureEnabledisFeatureEnabled(flag: string)Promise<boolean>Check if a feature flag is enabled

Experiment Methods

MethodSignatureReturnsDescription
getExperimentVariantgetExperimentVariant(experimentId: string)Promise<string>Get the assigned variant for an experiment
isInVariantisInVariant(experimentId: string, variantId: string)Promise<boolean>Check if user is in a specific variant
getExperimentConfiggetExperimentConfig(experimentId: string, key: string)Promise<unknown>Get config value for an experiment variant

Push Methods (Static)

MethodSignatureReturnsDescription
setPushTokensetPushToken(token: string)Promise<void>Register a device push token
setPushPermissionsetPushPermission(granted: boolean)Promise<void>Update push permission status
trackPushDeliveredtrackPushDelivered(pushId: string)Promise<void>Track push notification delivery
trackPushTappedtrackPushTapped(pushId: string, action?: string)Promise<void>Track push notification tap

Presentation Methods

MethodSignatureReturnsDescription
presentOnboardingpresentOnboarding(flowId: string)Promise<void>Present an onboarding flow
presentPaywallpresentPaywall(id: string, context?: PaywallContext)Promise<void>Present a paywall

Web Entitlement Methods

MethodSignatureReturnsDescription
getWebEntitlementgetWebEntitlement()Promise<WebEntitlement | null>Get the current web entitlement
onWebEntitlementChangedonWebEntitlementChanged(callback: (ent: WebEntitlement) => void)() => voidListen for web entitlement changes
MethodSignatureReturnsDescription
checkDeferredDeepLinkcheckDeferredDeepLink()Promise<DeferredDeepLink | null>Check for a deferred deep link

Module Namespaces

The AppDNA class exposes the following module namespaces as properties:
NamespaceTypeDescription
pushPushModulePush notification management
billingBillingModuleIn-app purchases and entitlements
onboardingOnboardingModuleServer-driven onboarding flows
paywallPaywallModuleServer-driven paywalls
remoteConfigRemoteConfigModuleRemote configuration values
featuresFeaturesModuleFeature flags
experimentsExperimentsModuleA/B testing and experiments
inAppMessagesInAppMessagesModuleIn-app messaging
surveysSurveysModuleUser surveys
deepLinksDeepLinksModuleDeep link handling

Delegate Interfaces

AppDNAPushDelegate

interface AppDNAPushDelegate {
  onPushTokenRegistered(token: string): void;
  onPushReceived(notification: Record<string, unknown>, inForeground: boolean): void;
  onPushTapped(notification: Record<string, unknown>, actionId?: string): void;
}

AppDNABillingDelegate

interface AppDNABillingDelegate {
  onPurchaseCompleted(productId: string, transaction: Record<string, unknown>): void;
  onPurchaseFailed(productId: string, error: Error): void;
  onEntitlementsChanged(entitlements: Entitlement[]): void;
  onRestoreCompleted(restoredProducts: string[]): void;
}

AppDNAOnboardingDelegate

interface AppDNAOnboardingDelegate {
  onOnboardingStarted(flowId: string): void;
  onOnboardingStepChanged(
    flowId: string,
    stepId: string,
    stepIndex: number,
    totalSteps: number
  ): void;
  onOnboardingCompleted(flowId: string, responses: Record<string, unknown>): void;
  onOnboardingDismissed(flowId: string, atStep: number): void;
}

AppDNAPaywallDelegate

interface AppDNAPaywallDelegate {
  onPaywallPresented(paywallId: string): void;
  onPaywallAction(paywallId: string, action: string): void;
  onPaywallPurchaseStarted(paywallId: string, productId: string): void;
  onPaywallPurchaseCompleted(
    paywallId: string,
    productId: string,
    transaction: Record<string, unknown>
  ): void;
  onPaywallPurchaseFailed(paywallId: string, error: Error): void;
  onPaywallDismissed(paywallId: string): void;
}

AppDNARemoteConfigDelegate

interface AppDNARemoteConfigDelegate {
  onConfigUpdated(config: Record<string, unknown>): void;
}

AppDNAInAppMessagesDelegate

interface AppDNAInAppMessagesDelegate {
  onMessagePresented(messageId: string): void;
  onMessageDismissed(messageId: string): void;
  onMessageAction(messageId: string, action: string): void;
}

AppDNASurveysDelegate

interface AppDNASurveysDelegate {
  onSurveyPresented(surveyId: string): void;
  onSurveyCompleted(surveyId: string, responses: Record<string, unknown>): void;
  onSurveyDismissed(surveyId: string): void;
}

TypeScript Types

AppDNAEnvironment

type AppDNAEnvironment = 'production' | 'staging';

AppDNALogLevel

type AppDNALogLevel = 'none' | 'error' | 'warning' | 'info' | 'debug';

AppDNABillingProvider

type AppDNABillingProvider = 'storeKit2' | 'revenueCat' | 'none';

AppDNAOptions

interface AppDNAOptions {
  flushInterval?: number;       // Default: 30
  batchSize?: number;           // Default: 20
  configTTL?: number;           // Default: 300
  logLevel?: AppDNALogLevel;    // Default: 'warning'
  billingProvider?: AppDNABillingProvider;
}

PaywallContext

interface PaywallContext {
  placement?: string;
  customData?: Record<string, unknown>;
}

OnboardingContext

interface OnboardingContext {
  source?: string;
  campaign?: string;
  referrer?: string;
  userProperties?: Record<string, unknown>;
  experimentOverrides?: Record<string, string>;
}

WebEntitlement

interface WebEntitlement {
  productId: string;
  status: string;
  expiresAt: string | null;
  isTrial: boolean;
}
interface DeferredDeepLink {
  url: string;
  campaign?: string;
  medium?: string;
  source?: string;
  data?: Record<string, unknown>;
}

PushPayload

interface PushPayload {
  push_id: string;
  title: string;
  body: string;
  image_url?: string;
  data?: Record<string, unknown>;
  action_type?: string;
  action_value?: string;
}

Entitlement

interface Entitlement {
  productId: string;
  store: string;
  status: string;
  expiresAt: string | null;
  isTrial: boolean;
  offerType: string | null;
}

PurchaseResult

interface PurchaseResult {
  status: 'purchased' | 'cancelled' | 'pending' | 'unknown';
  entitlement?: Entitlement;
}

ProductInfo

interface ProductInfo {
  id: string;
  name: string;
  description: string;
  displayPrice: string;
  price: number;
  offerToken?: string;
}

NativeEventEmitter Events

The SDK emits the following events through React Native’s NativeEventEmitter. These are bridged automatically by the delegate interfaces and listener methods — you typically do not need to subscribe to them directly.

Core Events

EventPayload
onReady{}
onConfigUpdated{ config: Record<string, unknown> }
onIdentify{ userId: string }
onReset{}
onConsentChanged{ analytics: boolean }

Push Events

EventPayload
onPushTokenRegistered{ token: string }
onPushReceivedPushPayload & { inForeground: boolean }
onPushTappedPushPayload & { actionId?: string }
onPushPermissionChanged{ granted: boolean }

Billing Events

EventPayload
onBillingPurchaseCompleted{ productId: string, transaction: object }
onBillingPurchaseFailed{ productId: string, error: string }
onBillingEntitlementsChanged{ entitlements: Entitlement[] }
onBillingRestoreCompleted{ restoredProducts: string[] }

Onboarding Events

EventPayload
onOnboardingStarted{ flowId: string }
onOnboardingStepChanged{ flowId: string, stepId: string, stepIndex: number, totalSteps: number }
onOnboardingCompleted{ flowId: string, responses: Record<string, unknown> }
onOnboardingDismissed{ flowId: string, atStep: number }

Paywall Events

EventPayload
onPaywallPresented{ paywallId: string }
onPaywallAction{ paywallId: string, action: string }
onPaywallPurchaseStarted{ paywallId: string, productId: string }
onPaywallPurchaseCompleted{ paywallId: string, productId: string, transaction: object }
onPaywallPurchaseFailed{ paywallId: string, error: string }
onPaywallDismissed{ paywallId: string }

In-App Message Events

EventPayload
onInAppMessagePresented{ messageId: string }
onInAppMessageDismissed{ messageId: string }
onInAppMessageAction{ messageId: string, action: string }

Survey Events

EventPayload
onSurveyPresented{ surveyId: string }
onSurveyCompleted{ surveyId: string, responses: Record<string, unknown> }
onSurveyDismissed{ surveyId: string }

Web Entitlement Events

EventPayload
onWebEntitlementChangedWebEntitlement
EventPayload
onDeferredDeepLinkDeferredDeepLink

Experiment Events

EventPayload
onExperimentAssigned{ experimentId: string, variantId: string }
onExperimentConfigUpdated{ experimentId: string, config: Record<string, unknown> }