/** * Shared types for the CLI TUI. */ import type { AppService } from "../services/app.js"; import type { AppConfig } from "../app.js"; /** * Screen names for navigation. */ export type ScreenName = | "seed-input" | "wallet" | "templates" | "wizard" | "invitations" | "transaction"; /** * Navigation context data that can be passed between screens. */ export interface NavigationData { /** Template identifier for wizard */ templateId?: string; /** Action identifier for wizard */ actionId?: string; /** Role identifier for wizard */ roleId?: string; /** Invitation ID for transaction screen */ invitationId?: string; /** Any additional data */ [key: string]: unknown; } /** * Navigation context interface. */ export interface NavigationContextType { /** Current screen name */ screen: ScreenName; /** Data passed to the current screen */ data: NavigationData; /** Navigation history stack */ history: ScreenName[]; /** Navigate to a new screen */ navigate: (screen: ScreenName, data?: NavigationData) => void; /** Go back to the previous screen */ goBack: () => void; /** Check if we can go back */ canGoBack: boolean; } /** * App context interface - provides access to AppService and app-level functions. */ export interface AppContextType { /** AppService instance (null before wallet initialization) */ appService: AppService | null; /** Initialize wallet with seed phrase and create AppService */ initializeWallet: (seed: string) => Promise; /** Whether the wallet is initialized */ isWalletInitialized: boolean; /** Application configuration */ config: AppConfig; /** Show an error message dialog */ showError: (message: string) => void; /** Show an info message dialog */ showInfo: (message: string) => void; /** Show a confirmation dialog */ confirm: ( message: string, options?: { title?: string; confirmLabel?: string; cancelLabel?: string; }, ) => Promise; /** Exit the application */ exit: () => Promise; /** Update status bar message */ setStatus: (message: string) => void; } /** * Dialog state for modals. */ export interface DialogState { /** Whether dialog is visible */ visible: boolean; /** Dialog type */ type: "error" | "info" | "confirm"; /** Dialog message */ message: string; /** Optional confirmation presentation labels. */ title?: string; confirmLabel?: string; cancelLabel?: string; /** Callback for confirm dialog */ onConfirm?: () => void; /** Callback for cancel/dismiss */ onCancel?: () => void; }