import type { DismissalPolicy, LiveActivityVariants } from './types.js'; export type SharedLiveActivityOptions = { /** * Unix timestamp in milliseconds */ staleDate?: number; /** * Double value between 0.0 and 1.0 * @default 0.0 */ relevanceScore?: number; /** * How the Live Activity should be dismissed after ending * @default 'immediate' */ dismissalPolicy?: DismissalPolicy; }; export type StartLiveActivityOptions = { /** * The name of the Live Activity. * Allows you to rebind to the same activity on app restart. */ activityName?: string; /** * URL to open when the Live Activity is tapped. */ deepLinkUrl?: string; } & SharedLiveActivityOptions; export type UpdateLiveActivityOptions = SharedLiveActivityOptions; export type EndLiveActivityOptions = { dismissalPolicy?: DismissalPolicy; }; export type UseLiveActivityOptions = { /** * The name of the Live Activity. * Allows you to rebind to the same activity on app restart. */ activityName?: string; /** * Automatically start the Live Activity when the component mounts. */ autoStart?: boolean; /** * Automatically update the Live Activity when the component updates. */ autoUpdate?: boolean; /** * URL to open when the Live Activity is tapped. */ deepLinkUrl?: string; }; export type UseLiveActivityResult = { start: (options?: StartLiveActivityOptions) => Promise; update: (options?: UpdateLiveActivityOptions) => Promise; end: (options?: EndLiveActivityOptions) => Promise; isActive: boolean; }; /** * React hook for managing Live Activities with automatic lifecycle handling. * * @param variants - The Live Activity content variants to display * @param options - Configuration options for the hook * @returns Object with start, update, end methods and isActive state * * @example * ```tsx * import { useLiveActivity, Voltra } from 'voltra' * * const MyLiveActivity = () => { * const { start, update, end, isActive } = useLiveActivity({ * minimal: Live Activity, * compact: ..., * expanded: ... * }, { * activityName: 'my-activity', * autoStart: true, * autoUpdate: true * }) * * return ( * *