import { AdaptyIOSPresentationStyle, AdaptyUiDialogActionType, AdaptyUiDialogConfig, CreateFlowViewParamsInput, FlowEventHandlers } from './types'; export declare const DEFAULT_PARAMS: CreateFlowViewParamsInput; /** * Provides methods to control created flow view * @public */ export declare class FlowViewController { private id; private viewEmitter; /** * The localization the view was actually built with. * * @remarks * May differ from the requested localization if it is not available in the flow. */ locale?: string; private handle; /** * Presents a flow view as a modal * * @param {Object} options - Presentation options * @param {AdaptyIOSPresentationStyle} [options.iosPresentationStyle] - iOS presentation style. * Available options: 'full_screen' (default) or 'page_sheet'. * Only affects iOS platform. * * @remarks * Calling `present` upon already visible flow view * would result in an error * * @throws {AdaptyError} */ present(options?: { iosPresentationStyle?: AdaptyIOSPresentationStyle; }): Promise; /** * Dismisses a flow view * * @remarks * By default the native view is destroyed along with the flow: the controller cannot be * presented afterwards, its event handlers are cleared. * * Pass `destroy: false` to keep the view alive instead. It can be presented again with * {@link FlowViewController.present}, resuming on the screen the user left and with the * state the flow had built up, and its event handlers stay active. Such a view is held * until it is released with {@link FlowViewController.destroy}. * * @param {Object} options - Dismiss options * @param {boolean} [options.destroy] - Destroy the native view as well. Defaults to `true`. * * @throws {AdaptyError} * * @example * ```ts * // close the flow and destroy its native view * await view.dismiss(); * * // close the flow, keeping it ready to be shown again * await view.dismiss({ destroy: false }); * await view.present(); // resumes where the user left off * await view.dismiss({ destroy: true }); // destroys the view for good * ``` */ dismiss(options?: { destroy?: boolean; }): Promise; /** * Releases a native flow view that was kept alive by `dismiss({ destroy: false })`. * * @remarks * By default {@link FlowViewController.dismiss} releases the view on its own, so there * is no need to call `destroy()` after it. * * The controller cannot be presented afterwards. Event handlers are cleared. * * @throws {AdaptyError} if the view reference is invalid, or if the native view was * already released. * * @example * ```ts * const view = await createFlowView(flow); * await view.present(); * await view.dismiss({ destroy: false }); * // ... later * await view.destroy(); * ``` */ destroy(): Promise; /** * Presents an alert dialog * * @param {AdaptyUiDialogConfig} config - A config for showing the dialog. * * @remarks * Use this method instead of RN alert dialogs when flow view is presented. * On Android, built-in RN alerts appear behind the flow view, making them invisible to users. * This method ensures proper dialog presentation above the flow view on all platforms. * * If you provide two actions in the config, be sure `primaryAction` cancels the operation * and leaves things unchanged. * * @returns {Promise} A Promise that resolves to the {@link AdaptyUiDialogActionType} object * * @throws {AdaptyError} */ showDialog(config: AdaptyUiDialogConfig): Promise; private onRequestClose; /** * Sets event handlers for flow view events * * @see {@link https://adapty.io/docs/react-native-handling-events-1 | [DOC] Handling View Events} * * @remarks * Each event type can have only one handler — new handlers replace existing ones. * Default handlers are set during view creation: {@link DEFAULT_FLOW_EVENT_HANDLERS} * - `onCloseButtonPress` - closes the view (returns `true`) * - `onAndroidSystemBack` - keeps the view open (returns `false`) * - `onRestoreCompleted` - keeps the view open (returns `false`) * - `onError` - closes the view (returns `true`) * - `onPurchaseCompleted` - keeps the view open (returns `false`) * - `onUrlPress` - opens URL and keeps the view open (returns `false`) * * To retain default behavior in a custom listener, return the same value as the default implementation. * * **Important**: Calling this method multiple times will override only the handlers you provide, * keeping previously set handlers intact. * * @param {Partial} [eventHandlers] - set of event handling callbacks * @returns {() => void} unsubscribe - function to unsubscribe all listeners */ setEventHandlers(eventHandlers?: Partial): () => void; private errNoViewReference; } //# sourceMappingURL=flow-view-controller.d.ts.map