import { type ComputedRef, type MaybeRefOrGetter } from 'vue'; import type { TypeToSeverityMap } from '../../components/wt-toast/types'; /** [Claude] locale keys of the action's toasts */ export interface ProgressActionMessages { /** [Claude] gets `loaded` and `total` */ inProgress: string; /** [Claude] gets `count`; used when the total is unknown, falls back to `inProgress` if not set */ inProgressCount?: string; success: string; error: string; } export interface ActionProgress { loaded: MaybeRefOrGetter; /** [Claude] leave empty when the total is unknown – only the loaded count is shown then */ total?: MaybeRefOrGetter; } export interface ProgressActionNotification { type: keyof typeof TypeToSeverityMap; text: string; } export interface RunProgressActionOptions { /** [Claude] separates parallel actions on one page, e.g. a table row id */ key?: unknown; /** [Claude] shows a sticky "in progress" toast with the counter while the action runs */ progress?: ActionProgress; /** [Claude] replaces the default success toast when it returns one, e.g. a warning for a partial download */ getNotification?: (result: T) => ProgressActionNotification | undefined; } export type RunProgressAction = (action: () => Promise, options?: RunProgressActionOptions) => Promise; export interface UseProgressActionReturn { isLoading: ComputedRef; isKeyLoading: (key: unknown) => boolean; run: RunProgressAction; } /** * [Claude] Loader state + progress/success/error toasts around an async action. * Errors are reported with a toast and swallowed, so template handlers can call it without `await`. */ export declare const useProgressAction: ({ messages, }: { messages: ProgressActionMessages; }) => UseProgressActionReturn;