UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

49 lines (48 loc) 1.22 kB
export type SheetState = 'collapsed' | 'expanding' | 'expanded' | 'collapsing'; export type ViewState = 'welcome' | 'conversation' | 'transitioning'; export declare class SheetStateMachine { private sheetState; private viewState; private listeners; /** * Check if the sheet can be collapsed */ canCollapse(): boolean; /** * Check if the sheet can be expanded */ canExpand(): boolean; /** * Check if currently in a transition state */ isTransitioning(): boolean; /** * Attempt to transition to a new sheet state * Returns true if transition is valid, false otherwise */ transitionTo(newState: SheetState): boolean; /** * Set the current view state */ setViewState(view: ViewState): void; /** * Get current sheet state */ getSheetState(): SheetState; /** * Get current view state */ getViewState(): ViewState; /** * Subscribe to state changes */ subscribe(listener: (state: SheetState) => void): () => void; /** * Reset to initial state */ reset(): void; /** * Notify all listeners of state change */ private notifyListeners; }