Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export namespace Gleap {
function hideAiChatbar(): void;
function askAI(question: string, showBackButton?: boolean): void;
function setAiChatbarQuickActions(quickActions: string[]): void;
function setAiChatbarPlaceholder(placeholder: string): void;
function startAgent(
agentId: string,
options?: { context?: any; initialQuestion?: string; initialMessage?: string }
Expand Down Expand Up @@ -308,6 +309,8 @@ export namespace Gleap {
function openChecklists(showBackButton?: boolean): void;
function openChecklist(checklistId: string, showBackButton?: boolean): void;
function startChecklist(outboundId: string, showBackButton?: boolean, sharedKey?: string): void;
/** The full data of a checklist; listen to the `checklist-*` events with `Gleap.on` for updates. */
function getChecklistData(outboundId: string, sharedKey?: string): Promise<any>;
function openNews(showBackButton?: boolean): void;
function openNewsArticle(id: string, showBackButton?: boolean): void;
function openConversations(showBackButton?: boolean): void;
Expand All @@ -330,13 +333,16 @@ export namespace Gleap {
): void;
function searchHelpCenter(term: string, showBackButton?: boolean): void;
function openFeatureRequests(showBackButton?: boolean): void;
function close(): void;
/** Close the widget. With `resetRoutes`, the messenger also goes back to its start screen. */
function close(resetRoutes?: boolean): void;
function hide(): void;
function setUseCookies(useCookies: boolean): void;
/** Treat the site as not reachable from the internet, like localhost: screenshots embed its CSS and images instead of loading them from the site later. */
function setOfflineMode(offlineMode: boolean): void;
/**
* Sets the widget's color scheme, overriding the dashboard's "Color scheme"
* setting, which applies until this is called. Only takes effect when "Adapt
* to dark / light mode" is enabled in the dashboard; while it is disabled the
* Sets the widget's color scheme, overriding the dashboard's setting, which
* applies until this is called. Only takes effect when "Match light and dark
* mode" is on (Settings → Widget → Look); while it is off the
* widget is never themed. "auto" follows the host app's dark/light mode (theme
* classes/attributes like `class="dark"` or `data-theme="dark"`, the CSS
* color-scheme, the page background, then the OS preference) and switches
Expand Down Expand Up @@ -506,11 +512,15 @@ export namespace Gleap {
onError?: (error: any) => void;
/** Called when a new conversation is created. */
onConversationCreated?: (conversationId: string) => void;
/** Called for every streamed piece of the reply; `content` is the new text. */
onToken?: (data: { content?: string; [key: string]: any }) => void;
}

interface AgentChatInstance {
/** Send a message to the agent. */
sendMessage(content: string): Promise<void>;
/** Stop the reply that is streaming; the text received so far stays. */
cancelStream(): void;
/** Clear all messages and start a new conversation. */
clearMessages(): void;
/** Update the context sent with future messages. */
Expand Down
6 changes: 3 additions & 3 deletions src/Gleap.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,10 +972,10 @@ class Gleap {
}

/**
* Sets the widget's color scheme, overriding the "Color scheme" setting in the dashboard.
* Sets the widget's color scheme, overriding the dashboard's setting.
* Until this is called, the dashboard setting applies.
* Only takes effect when "Adapt to dark / light mode" is enabled in the dashboard;
* while it is disabled the widget is never themed, whatever is set here.
* Only takes effect when "Match light and dark mode" is on (Settings → Widget → Look);
* while it is off the widget is never themed, whatever is set here.
* - 'auto': follows the host app's dark/light mode (theme classes/attributes such as
* `class="dark"` or `data-theme="dark"`, the CSS color-scheme, the page background,
* then the OS preference) and switches live when it changes.
Expand Down
Loading