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
| Method | Signature | Returns | Description |
|---|
configure | configure(apiKey: string, env?: AppDNAEnvironment, options?: AppDNAOptions) | Promise<void> | Initialize the SDK |
identify | identify(userId: string, traits?: Record<string, unknown>) | Promise<void> | Identify the current user |
reset | reset() | Promise<void> | Clear user identity and flush events |
track | track(event: string, properties?: Record<string, unknown>) | Promise<void> | Track a custom event |
flush | flush() | Promise<void> | Force flush all queued events |
onReady | onReady() | Promise<void> | Wait for SDK initialization to complete |
shutdown | shutdown() | Promise<void> | Shut down the SDK and release resources |
getSdkVersion | getSdkVersion() | Promise<string> | Get the SDK version string |
setLogLevel | setLogLevel(level: AppDNALogLevel) | void | Set log verbosity (synchronous) |
setConsent | setConsent(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
| Method | Signature | Returns | Description |
|---|
getRemoteConfig | getRemoteConfig(key: string) | Promise<unknown> | Get a remote config value by key |
isFeatureEnabled | isFeatureEnabled(flag: string) | Promise<boolean> | Check if a feature flag is enabled |
Experiment Methods
| Method | Signature | Returns | Description |
|---|
getExperimentVariant | getExperimentVariant(experimentId: string) | Promise<string> | Get the assigned variant for an experiment |
isInVariant | isInVariant(experimentId: string, variantId: string) | Promise<boolean> | Check if user is in a specific variant |
getExperimentConfig | getExperimentConfig(experimentId: string, key: string) | Promise<unknown> | Get config value for an experiment variant |
Push Methods (Static)
| Method | Signature | Returns | Description |
|---|
setPushToken | setPushToken(token: string) | Promise<void> | Register a device push token |
setPushPermission | setPushPermission(granted: boolean) | Promise<void> | Update push permission status |
trackPushDelivered | trackPushDelivered(pushId: string) | Promise<void> | Track push notification delivery |
trackPushTapped | trackPushTapped(pushId: string, action?: string) | Promise<void> | Track push notification tap |
Presentation Methods
| Method | Signature | Returns | Description |
|---|
presentOnboarding | presentOnboarding(flowId: string) | Promise<void> | Present an onboarding flow |
presentPaywall | presentPaywall(id: string, context?: PaywallContext) | Promise<void> | Present a paywall |
Web Entitlement Methods
| Method | Signature | Returns | Description |
|---|
getWebEntitlement | getWebEntitlement() | Promise<WebEntitlement | null> | Get the current web entitlement |
onWebEntitlementChanged | onWebEntitlementChanged(callback: (ent: WebEntitlement) => void) | () => void | Listen for web entitlement changes |
Deep Link Methods
| Method | Signature | Returns | Description |
|---|
checkDeferredDeepLink | checkDeferredDeepLink() | Promise<DeferredDeepLink | null> | Check for a deferred deep link |
Module Namespaces
The AppDNA class exposes the following module namespaces as properties:
| Namespace | Type | Description |
|---|
push | PushModule | Push notification management |
billing | BillingModule | In-app purchases and entitlements |
onboarding | OnboardingModule | Server-driven onboarding flows |
paywall | PaywallModule | Server-driven paywalls |
remoteConfig | RemoteConfigModule | Remote configuration values |
features | FeaturesModule | Feature flags |
experiments | ExperimentsModule | A/B testing and experiments |
inAppMessages | InAppMessagesModule | In-app messaging |
surveys | SurveysModule | User surveys |
deepLinks | DeepLinksModule | Deep 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;
}
DeferredDeepLink
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
| Event | Payload |
|---|
onReady | {} |
onConfigUpdated | { config: Record<string, unknown> } |
onIdentify | { userId: string } |
onReset | {} |
onConsentChanged | { analytics: boolean } |
Push Events
| Event | Payload |
|---|
onPushTokenRegistered | { token: string } |
onPushReceived | PushPayload & { inForeground: boolean } |
onPushTapped | PushPayload & { actionId?: string } |
onPushPermissionChanged | { granted: boolean } |
Billing Events
| Event | Payload |
|---|
onBillingPurchaseCompleted | { productId: string, transaction: object } |
onBillingPurchaseFailed | { productId: string, error: string } |
onBillingEntitlementsChanged | { entitlements: Entitlement[] } |
onBillingRestoreCompleted | { restoredProducts: string[] } |
Onboarding Events
| Event | Payload |
|---|
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
| Event | Payload |
|---|
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
| Event | Payload |
|---|
onInAppMessagePresented | { messageId: string } |
onInAppMessageDismissed | { messageId: string } |
onInAppMessageAction | { messageId: string, action: string } |
Survey Events
| Event | Payload |
|---|
onSurveyPresented | { surveyId: string } |
onSurveyCompleted | { surveyId: string, responses: Record<string, unknown> } |
onSurveyDismissed | { surveyId: string } |
Web Entitlement Events
| Event | Payload |
|---|
onWebEntitlementChanged | WebEntitlement |
Deep Link Events
| Event | Payload |
|---|
onDeferredDeepLink | DeferredDeepLink |
Experiment Events
| Event | Payload |
|---|
onExperimentAssigned | { experimentId: string, variantId: string } |
onExperimentConfigUpdated | { experimentId: string, config: Record<string, unknown> } |