API Reference

Detailed reference for all exported APIs, including the Singleton, Hook, and Provider.

Singleton API: DeepLinkManager

The core singleton instance for managing deep links throughout your application. Access it via DeepLinkManager.getInstance().

MethodDescription
getInstance()Returns the singleton instance.
init(config)Initializes the manager with apiKey and optional debug flag. Must be called first.
addUrlListener(cb)Subscribes to URL changes. The callback receives url and data. Returns an unsubscribe function.
removeAllListeners()Removes all registered listeners.
getInitialUrl()Returns and consumes the first link that launched the app.
getCurrentUrl()Returns the most recent deep link without consuming it.
setLogging(enabled)Enables or disables debug logging.
destroy()Resets internal state (mainly for testing).

Hook API: useDeepLink

A React hook for handling deep links within functional components. It automatically manages the subscription lifecycle.

typescript
useDeepLink(callback: (url: string | null, data: UrlSchemeMetaData) => void): void
ParameterTypeDescription
callback(url, data) => voidA function that is called every time a new deep link is received. It receives the URL string and metadata.

Provider API: DeepLinkProvider

A React component to wrap your app and handle deep links globally.

PropTypeDescription
onLink(url, data) => voidCallback for every deep link event.
enableLoggingbooleanEnables or disables debug logging globally.
childrenReact.ReactNodeYour app's component tree.

Type Definitions

Core TypeScript types used throughout the SDK.

typescript
export type UrlCallback = (
  url: string | null,
  data?: UrlSchemeMetaData
) => void;

export type Unsubscribe = () => void;

export interface DeepLinkManagerConfig {
  apiKey: string;
  debug?: boolean;
}

export interface UrlSchemeMetaData {
  [x: string]: any;
}