@agentman/chat-widget
Version:
Agentman Chat Widget for easy integration with web applications
66 lines (65 loc) • 2.02 kB
TypeScript
/**
* HeaderButtonManager - Manages header button lifecycle and positioning
*
* Centralized management of all header buttons with:
* - Automatic positioning based on view and variant
* - Button lifecycle management
* - Consistent ordering
* - Dynamic show/hide based on context
*/
import { HeaderButton, ButtonType } from './HeaderButton';
/**
* Button position context
*/
export type ButtonContext = 'conversation-header' | 'conversation-list-header' | 'welcome-standalone';
/**
* HeaderButtonManager Class
*/
export declare class HeaderButtonManager {
private buttons;
private variant;
private currentContext;
private headerElement;
constructor(variant?: string);
/**
* Register a button
*/
registerButton(type: ButtonType, button: HeaderButton): void;
/**
* Get a registered button
*/
getButton(type: ButtonType): HeaderButton | undefined;
/**
* Set the current context and header element
*/
setContext(context: ButtonContext, headerElement?: HTMLElement | null): void;
/**
* Position buttons in the header based on context
* Maintains consistent order: [Chats] [New] [Collapse]
*/
positionButtons(buttonTypes: ButtonType[]): void;
/**
* Position collapse button standalone (for welcome view in input-bar-sheet)
*/
positionCollapseStandalone(container: HTMLElement): void;
/**
* Show/hide specific buttons
*/
setButtonVisibility(type: ButtonType, visible: boolean): void;
/**
* Clear dynamic buttons from header actions
*/
private clearHeaderActions;
/**
* Get button order for current context
*/
getButtonOrderForContext(context: ButtonContext, hasConversations?: boolean): ButtonType[];
/**
* Update buttons based on view transition
*/
updateForView(view: 'welcome' | 'conversation', headerElement: HTMLElement | null, hasConversations?: boolean): void;
/**
* Destroy all buttons
*/
destroy(): void;
}