declare module '@product7/product7-js' { export interface FeedbackConfig { workspace: string; metadata?: Metadata; debug?: boolean; boardName?: string; siteId?: string; sessionToken?: string; position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; theme?: 'light' | 'dark'; apiUrl?: string; autoShow?: boolean; mock?: boolean; env?: string; widgets?: WidgetConfigMap; } export interface Metadata { user_id?: string; email?: string; name?: string; profile_picture?: string; custom_fields?: Record; company?: { id?: string; name?: string; monthly_spend?: number; custom_fields?: Record; }; } export interface ButtonWidgetOptions { enabled?: boolean; position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; theme?: 'light' | 'dark'; boardName?: string; displayMode?: 'panel' | 'modal'; size?: 'small' | 'medium' | 'large'; primaryColor?: string; backgroundColor?: string; textColor?: string; autoShow?: boolean; suppressAfterSubmission?: boolean; suppressionDays?: number; buttonText?: string; triggerText?: string; label?: string; text?: string; headless?: boolean; customStyles?: Record; trigger?: boolean | string | Element; } export interface FeedbackWidgetOptions extends ButtonWidgetOptions {} export interface WidgetConfigMap { feedback?: Partial | Record; button?: Partial | Record; survey?: Partial | Record; liveChat?: Partial | Record; changelog?: Partial | Record; [key: string]: Record | undefined; } export interface ButtonWidget { id: string; type: 'button'; mount(container?: string | HTMLElement): this; destroy(): void; show(): this; hide(): this; open(): this; close(): this; toggle(): this; openPanel(): void; closePanel(): void; openModal(): void; closeModal(): void; updateText(text: string): void; updatePosition( position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' ): void; } export interface FeedbackWidget extends ButtonWidget {} export class Product7 { constructor(config: FeedbackConfig); static create(config: FeedbackConfig): Product7; init(): Promise<{ initialized: boolean; config?: any; sessionToken?: string; expiresIn?: number; status?: boolean; message?: string | null; configVersion?: number | null; identified?: boolean; }>; identify(metadata: Metadata): Promise<{ identified: boolean; metadata: Metadata | null; response: any; }>; createFeedbackWidget(options?: FeedbackWidgetOptions): FeedbackWidget; createLiveChatWidget(options?: LiveChatWidgetOptions): LiveChatWidget; createChangelogWidget(options?: ChangelogWidgetOptions): ChangelogWidget; createSurveyWidget(options?: SurveyWidgetOptions): SurveyWidget; createWidget( type: 'feedback', options?: FeedbackWidgetOptions ): FeedbackWidget; createWidget(type: 'button', options?: ButtonWidgetOptions): ButtonWidget; createWidget(type: 'survey', options?: SurveyWidgetOptions): SurveyWidget; createWidget( type: 'liveChat', options?: LiveChatWidgetOptions ): LiveChatWidget; createWidget( type: 'changelog', options?: ChangelogWidgetOptions ): ChangelogWidget; createWidget(type: string, options?: Record): any; setMetadata(metadata: Metadata): void; getMetadata(): Metadata | null; destroy(): void; readonly initialized: boolean; } export type SurveyType = 'nps' | 'csat' | 'ces' | 'custom'; export interface SurveyQuestion { id?: string; label: string; type: 'select' | 'text'; placeholder?: string; options?: Array<{ value: string; label: string }>; } export interface SurveyRatingConfig { survey_type?: string; scale?: number; low_label?: string | null; high_label?: string | null; } export interface SurveyMultipleChoiceOption { id?: string; key?: string; value?: string; label?: string; text?: string; } export interface SurveyMultipleChoiceConfig { options?: SurveyMultipleChoiceOption[]; allow_multiple?: boolean; multiple?: boolean; } export interface SurveyPage { id?: string; type?: 'rating' | 'multiple_choice' | 'text' | string; title?: string; description?: string; required?: boolean; position?: number; ratingConfig?: SurveyRatingConfig | null; rating_config?: SurveyRatingConfig | null; multipleChoiceConfig?: SurveyMultipleChoiceConfig | null; multiple_choice_config?: SurveyMultipleChoiceConfig | null; afterThisPage?: { default?: string | number } | null; after_this_page?: { default?: string | number } | null; } export interface SurveyWidgetResponse { type: SurveyType; score: number | null; feedback: string; customAnswers: Record; pageAnswers?: Record; timestamp: string; } export interface SurveyWidgetOptions { enabled?: boolean; surveyId?: string | null; surveyType?: SurveyType; position?: 'bottom-right' | 'bottom-left' | 'center' | 'bottom'; title?: string | null; description?: string | null; lowLabel?: string | null; highLabel?: string | null; ratingScale?: number | null; showFeedbackInput?: boolean | null; showSubmitButton?: boolean | null; autoSubmitOnSelect?: boolean | null; showTitle?: boolean | null; showDescription?: boolean | null; customQuestions?: SurveyQuestion[]; pages?: SurveyPage[]; respondentId?: string | null; email?: string | null; theme?: 'light' | 'dark'; onSubmit?: (response: SurveyWidgetResponse) => void; onDismiss?: () => void; } export interface SurveyWidget { mount(container?: string | HTMLElement): this; show(): this; hide(): this; open(): this; close(): this; toggle(): this; destroy(): void; surveyOptions: SurveyWidgetOptions; surveyState: { score: number | null; feedback: string; customAnswers: Record; pageAnswers?: Record; currentPageIndex?: number; isSubmitting?: boolean; isVisible: boolean; }; } export interface SurveyConfig { workspace: string; metadata?: Metadata; debug?: boolean; apiUrl?: string; } export class SurveySDK { constructor(config: SurveyConfig); init(): Promise<{ initialized: boolean }>; createWidget(type: 'survey', options: SurveyWidgetOptions): SurveyWidget; setMetadata(metadata: Metadata): void; getMetadata(): Metadata | null; destroy(): void; readonly initialized: boolean; } interface Product7Export { Product7: typeof Product7; ButtonWidget: any; create: (config: FeedbackConfig) => Product7; initWithUser: ( config: Omit, metadata: Metadata ) => Promise; getInstance: () => Product7 | null; isReady: () => boolean; setMetadata: (metadata: Metadata) => void; onReady: (callback: (sdk: Product7) => void) => void; onError: (callback: (error: Error) => void) => void; version: string; instance: Product7 | null; } export interface ChangelogWidgetOptions { enabled?: boolean; position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; theme?: 'light' | 'dark'; headless?: boolean; showBackdrop?: boolean; triggerText?: string; showBadge?: boolean; title?: string; viewButtonText?: string; changelogBaseUrl?: string; openInNewTab?: boolean; customStyles?: Record; onViewUpdate?: (changelog: any) => void; } export interface ChangelogWidget { id: string; type: 'changelog'; mount(container?: string | HTMLElement): this; destroy(): void; open(): this; close(): this; toggle(): this; openModal(): void; closeModal(): void; openSidebar(): void; closeSidebar(): void; hideBadge(): void; showBadge(): void; nextChangelog(): void; prevChangelog(): void; refresh(): Promise; } export interface LiveChatWidgetOptions { enabled?: boolean; position?: 'bottom-right' | 'bottom-left'; theme?: 'light' | 'dark'; headless?: boolean; teamName?: string; teamAvatars?: string[]; greetingMessage?: string; welcomeMessage?: string; enableHelp?: boolean; enableChangelog?: boolean; enableNews?: boolean; autoLoadData?: boolean; initialView?: | 'home' | 'messages' | 'chat' | 'prechat' | 'help' | 'changelog'; previewData?: { conversations?: any[]; helpArticles?: any[]; homeChangelogItems?: any[]; changelogItems?: any[]; unreadCount?: number; currentView?: string; availability?: { agentsOnline?: boolean; agents_online?: boolean; onlineCount?: number; online_count?: number; responseTime?: string; response_time?: string; }; }; logoUrl?: string; primaryColor?: string; featuredContent?: { title: string; description: string; imageUrl?: string; action?: { type: 'url' | 'view'; value: string; label: string; }; }; onSendMessage?: (conversationId: string, message: any) => void; onArticleClick?: (article: any) => void; onChangelogClick?: (changelog: any) => void; } export interface LiveChatWidget { id: string; type: 'liveChat'; mount(container?: string | HTMLElement): this; destroy(): void; open(): void; close(): void; toggle(): void; navigateTo(view: 'home' | 'messages' | 'chat' | 'help' | 'changelog'): void; setConversations(conversations: any[]): void; setHelpArticles(articles: any[]): void; setChangelogItems(items: any[]): void; setHomeChangelogItems(items: any[]): void; setUnreadCount(count: number): void; loadInitialData(): Promise; checkAgentAvailability(): Promise; getState(): { isOpen: boolean; currentView: string; unreadCount: number; conversations: any[]; }; } const Product7Default: Product7Export; export default Product7Default; }