API Reference
Complete TypeScript API reference for the WarpLink React Native SDK.
WarpLink
The main entry point. Exported from @warplink/react-native.
import { WarpLink } from '@warplink/react-native';configure(options)
configure(options: WarpLinkConfig): voidInitialize the SDK. Synchronous — validates key format locally, delegates async validation to native SDK.
| Parameter | Type | Description |
|---|---|---|
options | WarpLinkConfig | Configuration with API key and optional settings. |
Throws: WarpLinkError with code E_INVALID_API_KEY_FORMAT if the key is invalid.
handleDeepLink(url)
handleDeepLink(url: string): Promise<WarpLinkDeepLink | null>Resolve a deep link URL to its link data.
Errors: E_NOT_CONFIGURED, E_INVALID_URL, E_LINK_NOT_FOUND, E_NETWORK_ERROR, E_SERVER_ERROR, E_INVALID_API_KEY, E_DECODING_ERROR
checkDeferredDeepLink()
checkDeferredDeepLink(): Promise<WarpLinkDeepLink | null>Check for a deferred deep link on first launch. Returns null on subsequent launches (cached).
Errors: E_NOT_CONFIGURED, E_NETWORK_ERROR, E_SERVER_ERROR, E_INVALID_API_KEY, E_DECODING_ERROR
getAttributionResult()
getAttributionResult(): Promise<AttributionResult | null>Get install attribution data. Returns null if no attribution match found.
isConfigured()
isConfigured(): Promise<boolean>Check whether the SDK has been configured.
onDeepLink(listener)
onDeepLink(listener: DeepLinkListener): () => voidRegister a listener for warm-start deep link events. Returns an unsubscribe function.
getInitialDeepLink()
getInitialDeepLink(): Promise<WarpLinkDeepLink | null>Get the deep link that launched the app (cold start). Returns null if not launched via a link.
Types
WarpLinkConfig
interface WarpLinkConfig {
apiKey: string;
apiEndpoint?: string; // Default: "https://api.warplink.app/v1"
debugLogging?: boolean; // Default: false
matchWindowHours?: number; // Default: 72
}WarpLinkDeepLink
interface WarpLinkDeepLink {
linkId: string;
destination: string;
deepLinkUrl: string | null;
customParams: Record<string, unknown>;
isDeferred: boolean;
matchType: 'deterministic' | 'probabilistic' | null;
matchConfidence: number | null;
}AttributionResult
interface AttributionResult {
linkId: string;
matchType: 'deterministic' | 'probabilistic';
matchConfidence: number;
isDeferred: boolean;
installId: string | null;
}DeepLinkEvent
Discriminated union — exactly one of deepLink or error is present.
type DeepLinkEvent =
| { deepLink: WarpLinkDeepLink; error?: undefined }
| { deepLink?: undefined; error: WarpLinkError };DeepLinkListener
type DeepLinkListener = (event: DeepLinkEvent) => void;Error Types
WarpLinkError
class WarpLinkError extends Error {
readonly code: ErrorCode;
constructor(code: ErrorCode, message: string);
}ErrorCodes
const ErrorCodes = {
E_NOT_CONFIGURED: 'E_NOT_CONFIGURED',
E_INVALID_API_KEY_FORMAT: 'E_INVALID_API_KEY_FORMAT',
E_INVALID_API_KEY: 'E_INVALID_API_KEY',
E_NETWORK_ERROR: 'E_NETWORK_ERROR',
E_SERVER_ERROR: 'E_SERVER_ERROR',
E_INVALID_URL: 'E_INVALID_URL',
E_LINK_NOT_FOUND: 'E_LINK_NOT_FOUND',
E_DECODING_ERROR: 'E_DECODING_ERROR',
} as const;| Code | Description |
|---|---|
E_NOT_CONFIGURED | SDK not initialized. |
E_INVALID_API_KEY_FORMAT | Key format invalid. |
E_INVALID_API_KEY | Key rejected by server. |
E_NETWORK_ERROR | Network unreachable or timeout. |
E_SERVER_ERROR | Server returned 5xx. |
E_INVALID_URL | Not a recognized WarpLink domain. |
E_LINK_NOT_FOUND | Link not found or inactive. |
E_DECODING_ERROR | Malformed server response. |