gleap 15.3.2 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +1 -1
- package/build/esm/index.mjs.map +1 -1
- package/index.d.ts +147 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -57,10 +57,27 @@ export namespace Gleap {
|
|
|
57
57
|
function closeModal(): void;
|
|
58
58
|
function setBannerUrl(bannerUrl: string): void;
|
|
59
59
|
function setModalUrl(modalUrl: string): void;
|
|
60
|
+
function startAgent(
|
|
61
|
+
agentId: string,
|
|
62
|
+
options?: { context?: any; primaryColor?: string; initialMessage?: string }
|
|
63
|
+
): void;
|
|
64
|
+
function setAIAgent(
|
|
65
|
+
agentId: string,
|
|
66
|
+
options?: { context?: any; primaryColor?: string }
|
|
67
|
+
): void;
|
|
60
68
|
function setMaxNetworkRequests(maxRequests: number): void;
|
|
61
69
|
function startNetworkLogger(): void;
|
|
62
70
|
function setNetworkLogsBlacklist(networkLogBlacklist: string[]): void;
|
|
63
71
|
function setNetworkLogPropsToIgnore(filters: string[]): void;
|
|
72
|
+
function registerAgentToolAction(
|
|
73
|
+
callback: (toolAction: {
|
|
74
|
+
name: string;
|
|
75
|
+
params: Record<string, any>;
|
|
76
|
+
result: any;
|
|
77
|
+
message: string;
|
|
78
|
+
toolCallId: string;
|
|
79
|
+
}) => void
|
|
80
|
+
): void;
|
|
64
81
|
function registerCustomAction(
|
|
65
82
|
customAction: (action: { name: string }) => void
|
|
66
83
|
): void;
|
|
@@ -90,14 +107,14 @@ export namespace Gleap {
|
|
|
90
107
|
function setAiTools(tools: {
|
|
91
108
|
name: string;
|
|
92
109
|
description: string;
|
|
93
|
-
executionType?: 'button' | 'auto';
|
|
94
110
|
response?: string;
|
|
95
|
-
|
|
111
|
+
executionType?: 'button' | 'auto';
|
|
112
|
+
parameters?: {
|
|
96
113
|
name: string;
|
|
97
114
|
description: string;
|
|
98
115
|
type: "string" | "number" | "boolean";
|
|
99
116
|
required: boolean;
|
|
100
|
-
|
|
117
|
+
enum?: string[];
|
|
101
118
|
}[];
|
|
102
119
|
}[]): void;
|
|
103
120
|
function showTabNotificationBadge(showNotificationBadge: boolean): void;
|
|
@@ -178,7 +195,99 @@ export namespace Gleap {
|
|
|
178
195
|
showBackButton?: boolean
|
|
179
196
|
): void;
|
|
180
197
|
function showSurvey(surveyId: string, format?: string): void;
|
|
181
|
-
function on(
|
|
198
|
+
function on(
|
|
199
|
+
event:
|
|
200
|
+
| "initialized"
|
|
201
|
+
| "open"
|
|
202
|
+
| "close"
|
|
203
|
+
| "flow-started"
|
|
204
|
+
| "checklist-loaded"
|
|
205
|
+
| "checklist-step-completed"
|
|
206
|
+
| "checklist-completed"
|
|
207
|
+
| "agent-message-sent"
|
|
208
|
+
| "agent-reply-received"
|
|
209
|
+
| "agent-error"
|
|
210
|
+
| "agent-conversation-created"
|
|
211
|
+
| "agent-tool-executed"
|
|
212
|
+
| string,
|
|
213
|
+
callback: (data?: any) => void
|
|
214
|
+
): void;
|
|
215
|
+
function sendAgentMessage(
|
|
216
|
+
agentId: string,
|
|
217
|
+
message: string,
|
|
218
|
+
options?: {
|
|
219
|
+
conversationId?: string;
|
|
220
|
+
additionalContext?: Record<string, any>;
|
|
221
|
+
}
|
|
222
|
+
): Promise<{
|
|
223
|
+
runId: string;
|
|
224
|
+
status: string;
|
|
225
|
+
response: string;
|
|
226
|
+
conversationId?: string;
|
|
227
|
+
outcome?: { type: string };
|
|
228
|
+
}>;
|
|
229
|
+
function clearAgentConversation(): void;
|
|
230
|
+
|
|
231
|
+
interface AgentChatMessage {
|
|
232
|
+
id: string;
|
|
233
|
+
role: 'user' | 'assistant';
|
|
234
|
+
content: string;
|
|
235
|
+
createdAt: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface AgentChatState {
|
|
239
|
+
messages: AgentChatMessage[];
|
|
240
|
+
isExecuting: boolean;
|
|
241
|
+
error: any;
|
|
242
|
+
conversationId: string | null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface AgentChatOptions {
|
|
246
|
+
/** The agent ID to talk to. */
|
|
247
|
+
agentId: string;
|
|
248
|
+
/** Additional context sent with every message to the AI. */
|
|
249
|
+
context?: Record<string, any>;
|
|
250
|
+
/** Resume an existing conversation by ID. */
|
|
251
|
+
conversationId?: string;
|
|
252
|
+
/** Called on every state change (messages, loading, error). */
|
|
253
|
+
onChange?: (state: AgentChatState) => void;
|
|
254
|
+
/** Called when the agent replies. */
|
|
255
|
+
onReplyReceived?: (data: any) => void;
|
|
256
|
+
/** Called on error. */
|
|
257
|
+
onError?: (error: any) => void;
|
|
258
|
+
/** Called when a new conversation is created. */
|
|
259
|
+
onConversationCreated?: (conversationId: string) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface AgentChatInstance {
|
|
263
|
+
/** Send a message to the agent. */
|
|
264
|
+
sendMessage(content: string): Promise<void>;
|
|
265
|
+
/** Clear all messages and start a new conversation. */
|
|
266
|
+
clearMessages(): void;
|
|
267
|
+
/** Update the context sent with future messages. */
|
|
268
|
+
setContext(context: Record<string, any>): void;
|
|
269
|
+
/** Get the current state snapshot. */
|
|
270
|
+
getState(): AgentChatState;
|
|
271
|
+
/** Destroy this instance and stop all callbacks. */
|
|
272
|
+
destroy(): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Create a headless agent chat instance.
|
|
277
|
+
* Framework-agnostic — wire onChange to React setState, Vue ref, Svelte store, etc.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```js
|
|
281
|
+
* const chat = Gleap.createAgentChat({
|
|
282
|
+
* agentId: 'abc123',
|
|
283
|
+
* context: { page: '/billing' },
|
|
284
|
+
* onChange: ({ messages, isExecuting }) => { ... },
|
|
285
|
+
* });
|
|
286
|
+
* chat.sendMessage('Hello!');
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
function createAgentChat(options: AgentChatOptions): AgentChatInstance;
|
|
290
|
+
|
|
182
291
|
function getIdentity(): any;
|
|
183
292
|
function isUserIdentified(): boolean;
|
|
184
293
|
function setReplayOptions(options: {
|
|
@@ -220,3 +329,37 @@ export namespace Gleap {
|
|
|
220
329
|
}): void;
|
|
221
330
|
}
|
|
222
331
|
export default Gleap;
|
|
332
|
+
|
|
333
|
+
// Custom element type declarations — makes <gleap-*> work in JSX without extra setup
|
|
334
|
+
// Covers both React 18 (global JSX) and React 19+ (React.JSX)
|
|
335
|
+
declare global {
|
|
336
|
+
namespace JSX {
|
|
337
|
+
interface IntrinsicElements {
|
|
338
|
+
'gleap-agent-conversation': any;
|
|
339
|
+
'gleap-agent-input': any;
|
|
340
|
+
'gleap-agent-profile-image': any;
|
|
341
|
+
'gleap-agent-reply-bubble': any;
|
|
342
|
+
'gleap-agent-user-bubble': any;
|
|
343
|
+
'gleap-agent-typing-indicator': any;
|
|
344
|
+
'gleap-agent-send-button': any;
|
|
345
|
+
'gleap-agent-message-list': any;
|
|
346
|
+
'gleap-checklist': any;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
declare module 'react' {
|
|
352
|
+
namespace JSX {
|
|
353
|
+
interface IntrinsicElements {
|
|
354
|
+
'gleap-agent-conversation': any;
|
|
355
|
+
'gleap-agent-input': any;
|
|
356
|
+
'gleap-agent-profile-image': any;
|
|
357
|
+
'gleap-agent-reply-bubble': any;
|
|
358
|
+
'gleap-agent-user-bubble': any;
|
|
359
|
+
'gleap-agent-typing-indicator': any;
|
|
360
|
+
'gleap-agent-send-button': any;
|
|
361
|
+
'gleap-agent-message-list': any;
|
|
362
|
+
'gleap-checklist': any;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|