import { FC } from 'react'; import { Extension, WebViewLoadOptions } from '@dynamic-labs/client'; import { WebViewProps } from '../components/WebView'; export type ReactNativeExtensionProps = { /** * The URL to load in the WebView. */ webviewUrl?: string; /** * Enable debugging in the WebView. */ webviewDebuggingEnabled?: boolean; /** * The web origin of the app (e.g., 'https://demo.dynamic.xyz'). * Used for SIWE messages, fetch Origin headers, and passkey operations. * Note: Deep link redirects use the auto-configured redirectUrl from expo-linking. */ appOrigin?: string; /** * When true on iOS / Android, the SDK hosts the webview-controller in a * native WKWebView (iOS) or android.webkit.WebView (Android) owned by a * dedicated overlay window outside the React Native view tree. This * isolates the webview from RN re-renders, navigation transitions, and * other lifecycle events. * * Always render the `WebView` returned under * `extension.reactNative.WebView`. When the native overlay is active it is a * no-op component that renders nothing — the native overlay is created * lazily and retained for the process lifetime, and subsequent extension * factory invocations re-bind the JS bridge to the same native overlay (e.g. * when the consumer recreates the client with a new `environmentId`). * * The native module was introduced mid-version, so an over-the-air JS update * can land on an older native binary that predates it. When the module is not * linked, this flag is transparently ignored and the returned `WebView` * becomes the regular react-native-webview component, which must be mounted * for the SDK to initialise — hence always render it. * * On the native overlay path there is no automatic load recovery. Any HTTP * error, network failure, blocked navigation, SSL error, or process * termination surfaces as `core.initialization.error` with * `WebViewFailedToLoadError` — consumers should treat the SDK as * un-initialised and react accordingly. * * On platforms other than iOS / Android (e.g. web), this flag is ignored. * Defaults to false. */ embeddedWebView?: boolean; /** * Customer-tunable budgets of the webview load engine (how long each * load attempt may take and how long the SDK inside the webview may take * to become ready). Applies to both webview paths. When a budget is * exhausted on the final attempt, the SDK raises * `WebViewFailedToLoadError`. See `WebViewLoadOptions` for the per-field * documentation and defaults. Only tune this for pathological networks. */ webviewLoad?: WebViewLoadOptions; }; export type IReactNativeExtension = { reactNative: { WebView: FC | (() => null); }; }; export declare const ReactNativeExtension: ({ webviewUrl, webviewDebuggingEnabled, appOrigin, embeddedWebView, webviewLoad, }?: ReactNativeExtensionProps) => Extension;