gleap 16.2.6 → 16.2.7

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.
@@ -0,0 +1,381 @@
1
+ export namespace Gleap {
2
+ function initialize(sdkKey: string, disablePing?: boolean): void;
3
+ function sendSilentCrashReport(
4
+ description: string,
5
+ priority?: "LOW" | "MEDIUM" | "HIGH",
6
+ excludeData?: {
7
+ customData?: Boolean;
8
+ metaData?: Boolean;
9
+ attachments?: Boolean;
10
+ consoleLog?: Boolean;
11
+ networkLogs?: Boolean;
12
+ customEventLog?: Boolean;
13
+ screenshot?: Boolean;
14
+ replays?: Boolean;
15
+ }
16
+ ): void;
17
+ function sendSilentCrashReportWithFormData(
18
+ formData: {
19
+ [key: string]: string;
20
+ },
21
+ priority?: "LOW" | "MEDIUM" | "HIGH",
22
+ excludeData?: {
23
+ customData: Boolean;
24
+ metaData: Boolean;
25
+ attachments: Boolean;
26
+ consoleLog: Boolean;
27
+ networkLogs: Boolean;
28
+ customEventLog: Boolean;
29
+ screenshot: Boolean;
30
+ replays: Boolean;
31
+ }
32
+ ): void;
33
+ function startClassicForm(
34
+ formId: string,
35
+ showBackButton?: boolean
36
+ ): void;
37
+ function startBot(botId: string, showBackButton?: boolean): void;
38
+ function startConversation(showBackButton?: boolean): void;
39
+ function attachCustomData(customData: any): void;
40
+ function setTicketAttribute(key: string, value: string): void;
41
+ function unsetTicketAttribute(key: string): void;
42
+ function clearTicketAttributes(): void;
43
+ function setCustomData(key: string, value: string): void;
44
+ function removeCustomData(key: string): void;
45
+ function clearCustomData(): void;
46
+ function playSound(play: boolean): void;
47
+ function destroy(): void;
48
+ function showAiChatbar(): void;
49
+ function hideAiChatbar(): void;
50
+ function askAI(question: string, showBackButton?: boolean): void;
51
+ function setAiChatbarQuickActions(quickActions: string[]): void;
52
+ function startAgent(
53
+ agentId: string,
54
+ options?: { context?: any; initialQuestion?: string; initialMessage?: string }
55
+ ): void;
56
+ function isOpened(): boolean;
57
+ function setApiUrl(apiUrl: string): void;
58
+ function setWSApiUrl(wsApiUrl: string): void;
59
+ function setFrameUrl(frameUrl: string): void;
60
+ function closeBanner(): void;
61
+ function closeModal(): void;
62
+ function setBannerUrl(bannerUrl: string): void;
63
+ function setModalUrl(modalUrl: string): void;
64
+ function setMaxNetworkRequests(maxRequests: number): void;
65
+ function startNetworkLogger(): void;
66
+ function setNetworkLogsBlacklist(networkLogBlacklist: string[]): void;
67
+ function setNetworkLogPropsToIgnore(filters: string[]): void;
68
+ /**
69
+ * @deprecated Use registerAgentTool(name, handler) with a dashboard-defined
70
+ * Frontend tool instead.
71
+ */
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;
81
+ /**
82
+ * Register the handler for a Frontend tool defined on an AI agent in the
83
+ * Gleap dashboard. The agent calls the handler with the configured
84
+ * parameters and waits for its return value (string or JSON — JSON is
85
+ * stringified). Thrown errors are caught and reported back to the AI.
86
+ */
87
+ function registerAgentTool(
88
+ name: string,
89
+ handler: (
90
+ params: Record<string, any>
91
+ ) => string | object | Promise<string | object>
92
+ ): void;
93
+ function registerCustomAction(
94
+ customAction: (action: { name: string }) => void
95
+ ): void;
96
+ function log(message: string, logLevel?: "INFO" | "WARNING" | "ERROR"): void;
97
+ /**
98
+ * @deprecated Please use trackEvent instead.
99
+ */
100
+ function logEvent(name: string, data?: any): void;
101
+ function trackEvent(name: string, data?: any): void;
102
+ function setAppBuildNumber(buildNumber: string): void;
103
+ function setAppVersionCode(versionCode: string): void;
104
+ function setStyles(styles: {
105
+ primaryColor: string;
106
+ headerColor: string;
107
+ buttonColor: string;
108
+ backgroundColor: string;
109
+ borderRadius?: number;
110
+ buttonX?: number;
111
+ buttonY?: number;
112
+ buttonStyle?: string;
113
+ }): void;
114
+ function disableConsoleLogOverwrite(): void;
115
+ function setLiveSite(isLiveSite: boolean): void;
116
+ function enableShortcuts(enabled: boolean): void;
117
+ function setLanguage(language: string): void;
118
+ function preFillForm(data: object): void;
119
+ /**
120
+ * @deprecated Define Frontend tools on your AI agent in the Gleap dashboard
121
+ * and register their handlers via registerAgentTool(name, handler) instead.
122
+ */
123
+ function setAiTools(tools: {
124
+ name: string;
125
+ description: string;
126
+ response?: string;
127
+ executionType?: 'button' | 'auto';
128
+ parameters?: {
129
+ name: string;
130
+ description: string;
131
+ type: "string" | "number" | "boolean";
132
+ required: boolean;
133
+ enum?: string[];
134
+ }[];
135
+ }[]): void;
136
+ function showTabNotificationBadge(showNotificationBadge: boolean): void;
137
+ function attachNetworkLogs(networkLogs: string): void;
138
+ function clearIdentity(): void;
139
+ function setTags(tags: string[]): void;
140
+ function setDisableInAppNotifications(
141
+ disableInAppNotifications: boolean
142
+ ): void;
143
+ function setDisablePageTracking(
144
+ disablePageTracking: boolean
145
+ ): void;
146
+ function identify(
147
+ userId: string,
148
+ customerData: {
149
+ name?: string | null;
150
+ email?: string | null;
151
+ phone?: string | null;
152
+ value?: number | null;
153
+ companyId?: string | null;
154
+ companyName?: string | null;
155
+ sla?: number | null;
156
+ plan?: string | null;
157
+ customData?: object | null;
158
+ avatar?: string | null;
159
+ createdAt?: Date | null;
160
+ },
161
+ userHash?: string
162
+ ): void;
163
+ function updateContact(
164
+ customerData: {
165
+ name?: string | null;
166
+ email?: string | null;
167
+ phone?: string | null;
168
+ value?: number | null;
169
+ companyId?: string | null;
170
+ companyName?: string | null;
171
+ sla?: number | null;
172
+ plan?: string | null;
173
+ avatar?: string | null;
174
+ customData?: object | null;
175
+ }
176
+ ): void;
177
+ function getInstance(): any;
178
+ function open(): void;
179
+ function openChecklists(showBackButton?: boolean): void;
180
+ function openChecklist(checklistId: string, showBackButton?: boolean): void;
181
+ function startChecklist(outboundId: string, showBackButton?: boolean, sharedKey?: string): void;
182
+ function openNews(showBackButton?: boolean): void;
183
+ function openNewsArticle(id: string, showBackButton?: boolean): void;
184
+ function openConversations(showBackButton?: boolean): void;
185
+ function startProductTour(tourId: string): void;
186
+ function openConversation(
187
+ shareToken?: string,
188
+ showBackButton?: boolean
189
+ ): void;
190
+ function setUrlHandler(
191
+ urlHandler: (url: string, newTab?: boolean) => void
192
+ ): void;
193
+ function openHelpCenter(showBackButton?: boolean): void;
194
+ function openHelpCenterCollection(
195
+ collectionId: string,
196
+ showBackButton?: boolean
197
+ ): void;
198
+ function openHelpCenterArticle(
199
+ articleId: string,
200
+ showBackButton?: boolean
201
+ ): void;
202
+ function searchHelpCenter(term: string, showBackButton?: boolean): void;
203
+ function openFeatureRequests(showBackButton?: boolean): void;
204
+ function close(): void;
205
+ function hide(): void;
206
+ function setUseCookies(useCookies: boolean): void;
207
+ function setEnvironment(environment: "dev" | "staging" | "prod"): void;
208
+ function showFeedbackButton(show: boolean): void;
209
+ function startFeedbackFlow(
210
+ feedbackFlow: string,
211
+ showBackButton?: boolean
212
+ ): void;
213
+ function showSurvey(surveyId: string, format?: string): void;
214
+ function on(
215
+ event:
216
+ | "initialized"
217
+ | "open"
218
+ | "close"
219
+ | "flow-started"
220
+ | "checklist-loaded"
221
+ | "checklist-step-completed"
222
+ | "checklist-completed"
223
+ | "agent-message-sent"
224
+ | "agent-reply-received"
225
+ | "agent-error"
226
+ | "agent-conversation-created"
227
+ | "agent-tool-executed"
228
+ | string,
229
+ callback: (data?: any) => void
230
+ ): void;
231
+ function sendAgentMessage(
232
+ agentId: string,
233
+ message: string,
234
+ options?: {
235
+ conversationId?: string;
236
+ additionalContext?: Record<string, any>;
237
+ }
238
+ ): Promise<{
239
+ runId: string;
240
+ status: string;
241
+ response: string;
242
+ conversationId?: string;
243
+ outcome?: { type: string };
244
+ }>;
245
+ function clearAgentConversation(): void;
246
+
247
+ interface AgentChatMessage {
248
+ id: string;
249
+ role: 'user' | 'assistant';
250
+ content: string;
251
+ createdAt: string;
252
+ }
253
+
254
+ interface AgentChatState {
255
+ messages: AgentChatMessage[];
256
+ isExecuting: boolean;
257
+ error: any;
258
+ conversationId: string | null;
259
+ }
260
+
261
+ interface AgentChatOptions {
262
+ /** The agent ID to talk to. */
263
+ agentId: string;
264
+ /** Additional context sent with every message to the AI. */
265
+ context?: Record<string, any>;
266
+ /** Resume an existing conversation by ID. */
267
+ conversationId?: string;
268
+ /** Called on every state change (messages, loading, error). */
269
+ onChange?: (state: AgentChatState) => void;
270
+ /** Called when the agent replies. */
271
+ onReplyReceived?: (data: any) => void;
272
+ /** Called on error. */
273
+ onError?: (error: any) => void;
274
+ /** Called when a new conversation is created. */
275
+ onConversationCreated?: (conversationId: string) => void;
276
+ }
277
+
278
+ interface AgentChatInstance {
279
+ /** Send a message to the agent. */
280
+ sendMessage(content: string): Promise<void>;
281
+ /** Clear all messages and start a new conversation. */
282
+ clearMessages(): void;
283
+ /** Update the context sent with future messages. */
284
+ setContext(context: Record<string, any>): void;
285
+ /** Get the current state snapshot. */
286
+ getState(): AgentChatState;
287
+ /** Destroy this instance and stop all callbacks. */
288
+ destroy(): void;
289
+ }
290
+
291
+ /**
292
+ * Create a headless agent chat instance.
293
+ * Framework-agnostic — wire onChange to React setState, Vue ref, Svelte store, etc.
294
+ *
295
+ * @example
296
+ * ```js
297
+ * const chat = Gleap.createAgentChat({
298
+ * agentId: 'abc123',
299
+ * context: { page: '/billing' },
300
+ * onChange: ({ messages, isExecuting }) => { ... },
301
+ * });
302
+ * chat.sendMessage('Hello!');
303
+ * ```
304
+ */
305
+ function createAgentChat(options: AgentChatOptions): AgentChatInstance;
306
+
307
+ function getIdentity(): any;
308
+ function isUserIdentified(): boolean;
309
+ function setReplayOptions(options: {
310
+ blockClass?: string | RegExp;
311
+ blockSelector?: string;
312
+ ignoreClass?: string | RegExp;
313
+ ignoreSelector?: string;
314
+ ignoreCSSAttributes?: string[];
315
+ maskTextClass?: string | RegExp;
316
+ maskTextSelector?: string;
317
+ maskAllInputs?: boolean;
318
+ maskInputOptions?: {
319
+ password?: boolean;
320
+ [key: string]: any;
321
+ };
322
+ maskInputFn?: (text: string) => string;
323
+ maskTextFn?: (text: string) => string;
324
+ slimDOMOptions?: {
325
+ [key: string]: any;
326
+ };
327
+ dataURLOptions?: {
328
+ [key: string]: any;
329
+ };
330
+ hooks?: {
331
+ [key: string]: any;
332
+ };
333
+ packFn?: (events: any) => any;
334
+ sampling?: any;
335
+ recordCanvas?: boolean;
336
+ recordCrossOriginIframes?: boolean;
337
+ recordAfter?: 'DOMContentLoaded' | 'load';
338
+ inlineImages?: boolean;
339
+ collectFonts?: boolean;
340
+ userTriggeredOnInput?: boolean;
341
+ plugins?: {
342
+ [key: string]: any;
343
+ }[];
344
+ errorHandler?: (error: Error) => void;
345
+ }): void;
346
+ }
347
+ export default Gleap;
348
+
349
+ // Custom element type declarations — makes <gleap-*> work in JSX without extra setup
350
+ // Covers both React 18 (global JSX) and React 19+ (React.JSX)
351
+ declare global {
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
+ }
366
+
367
+ declare module 'react' {
368
+ namespace JSX {
369
+ interface IntrinsicElements {
370
+ 'gleap-agent-conversation': any;
371
+ 'gleap-agent-input': any;
372
+ 'gleap-agent-profile-image': any;
373
+ 'gleap-agent-reply-bubble': any;
374
+ 'gleap-agent-user-bubble': any;
375
+ 'gleap-agent-typing-indicator': any;
376
+ 'gleap-agent-send-button': any;
377
+ 'gleap-agent-message-list': any;
378
+ 'gleap-checklist': any;
379
+ }
380
+ }
381
+ }