UNPKG

@helping-desk/web-sdk

Version:

Web SDK for Helping Desk - Ticket creation and support widget integration

88 lines (87 loc) 2.29 kB
/** * Helping Desk Web SDK * * A JavaScript SDK for integrating Helping Desk ticket creation functionality * into any website or web application. */ export interface SDKConfig { /** Tenant ID (schema name) - required for all requests. Get this from your .env file */ tenantId: string; /** API URL - optional, will be read from environment variable HELPING_DESK_API_URL if not provided */ apiUrl?: string; /** Show support widget automatically (default: true) */ showWidget?: boolean; /** Widget position (default: 'bottom-right') */ widgetPosition?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; /** Widget primary color (default: '#667eea') */ widgetColor?: string; /** Widget bubble icon (default: '💬') */ widgetIcon?: string; } export interface CreateTicketData { title: string; description: string; priority?: 'low' | 'medium' | 'high' | 'urgent'; category?: string; tags?: string[]; } export interface Ticket { id: string; title: string; description: string; status: string; priority: string; category: string; created_at: string; updated_at: string; assigned_to?: { id: string; email: string; first_name: string; last_name: string; full_name: string; }; created_by?: { id: string; email: string; first_name: string; last_name: string; full_name: string; }; tags?: string[]; } export interface SDKError { message: string; status?: number; details?: any; } export declare class HelpingDeskSDK { private config; private widget; constructor(config: SDKConfig); /** * Initialize the support widget */ private initWidget; /** * Create a ticket */ createTicket(data: CreateTicketData): Promise<Ticket>; /** * Update configuration */ updateConfig(config: Partial<SDKConfig>): void; /** * Get current configuration */ getConfig(): SDKConfig; /** * Show the support widget (if it was hidden) */ showWidget(): void; /** * Hide the support widget */ hideWidget(): void; } export declare function createSDK(config: SDKConfig): HelpingDeskSDK;