@elqnt/agents 3.1.0 → 3.2.1

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.
Files changed (65) hide show
  1. package/README.md +40 -0
  2. package/dist/{agent-models-C36pvpUb.d.mts → agent-models-DLQlC7N6.d.mts} +143 -2
  3. package/dist/{agent-models-C36pvpUb.d.ts → agent-models-DLQlC7N6.d.ts} +143 -2
  4. package/dist/api/index.d.mts +227 -5
  5. package/dist/api/index.d.ts +227 -5
  6. package/dist/api/index.js +54 -2
  7. package/dist/api/index.js.map +1 -1
  8. package/dist/api/index.mjs +53 -1
  9. package/dist/api/server.d.mts +4 -2
  10. package/dist/api/server.d.ts +4 -2
  11. package/dist/api/server.js +9 -1
  12. package/dist/api/server.js.map +1 -1
  13. package/dist/api/server.mjs +8 -0
  14. package/dist/api/server.mjs.map +1 -1
  15. package/dist/chunk-2JDVRL35.js +133 -0
  16. package/dist/chunk-2JDVRL35.js.map +1 -0
  17. package/dist/chunk-2QL3LLC3.mjs +1075 -0
  18. package/dist/chunk-2QL3LLC3.mjs.map +1 -0
  19. package/dist/chunk-3EHE4O57.mjs +133 -0
  20. package/dist/chunk-3EHE4O57.mjs.map +1 -0
  21. package/dist/{chunk-TPQS2XAW.js → chunk-3VM5TCJR.js} +8 -2
  22. package/dist/chunk-3VM5TCJR.js.map +1 -0
  23. package/dist/chunk-AF4QJD73.js +1075 -0
  24. package/dist/chunk-AF4QJD73.js.map +1 -0
  25. package/dist/{chunk-RAA5NKA7.js → chunk-BH2FIDFK.js} +224 -2
  26. package/dist/chunk-BH2FIDFK.js.map +1 -0
  27. package/dist/{chunk-NF6PGOXP.mjs → chunk-GOHHT3ET.mjs} +224 -2
  28. package/dist/chunk-GOHHT3ET.mjs.map +1 -0
  29. package/dist/{chunk-SXYTVNKJ.mjs → chunk-ZK27UGO6.mjs} +7 -1
  30. package/dist/{chunk-SXYTVNKJ.mjs.map → chunk-ZK27UGO6.mjs.map} +1 -1
  31. package/dist/hooks/index.d.mts +224 -67
  32. package/dist/hooks/index.d.ts +224 -67
  33. package/dist/hooks/index.js +8 -3
  34. package/dist/hooks/index.js.map +1 -1
  35. package/dist/hooks/index.mjs +11 -6
  36. package/dist/index.d.mts +7 -5
  37. package/dist/index.d.ts +7 -5
  38. package/dist/index.js +67 -4
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +70 -7
  41. package/dist/models/index.d.mts +3 -131
  42. package/dist/models/index.d.ts +3 -131
  43. package/dist/models/index.js +8 -2
  44. package/dist/models/index.js.map +1 -1
  45. package/dist/models/index.mjs +7 -1
  46. package/dist/{integration-21IuOOeV.d.mts → sandbox-DOxoM2Ge.d.mts} +132 -1
  47. package/dist/{integration-21IuOOeV.d.ts → sandbox-DOxoM2Ge.d.ts} +132 -1
  48. package/dist/transport/index.d.mts +36 -0
  49. package/dist/transport/index.d.ts +36 -0
  50. package/dist/transport/index.js +8 -0
  51. package/dist/transport/index.js.map +1 -0
  52. package/dist/transport/index.mjs +8 -0
  53. package/dist/transport/index.mjs.map +1 -0
  54. package/dist/types-C2qd5f-E.d.mts +51 -0
  55. package/dist/types-k9PszCzt.d.ts +51 -0
  56. package/dist/utils/index.d.mts +1 -1
  57. package/dist/utils/index.d.ts +1 -1
  58. package/package.json +10 -4
  59. package/dist/chunk-NF6PGOXP.mjs.map +0 -1
  60. package/dist/chunk-RAA5NKA7.js.map +0 -1
  61. package/dist/chunk-RWFVHX2J.js +0 -585
  62. package/dist/chunk-RWFVHX2J.js.map +0 -1
  63. package/dist/chunk-TPQS2XAW.js.map +0 -1
  64. package/dist/chunk-X4MSBDTZ.mjs +0 -585
  65. package/dist/chunk-X4MSBDTZ.mjs.map +0 -1
@@ -1,585 +0,0 @@
1
- "use client";
2
- import {
3
- connectIntegrationApi,
4
- createAgentApi,
5
- createAgentJobApi,
6
- createSkillApi,
7
- createSubAgentApi,
8
- createToolDefinitionApi,
9
- createWidgetApi,
10
- deleteAgentApi,
11
- deleteAgentJobApi,
12
- deleteSkillApi,
13
- deleteSkillUserConfigApi,
14
- deleteSubAgentApi,
15
- deleteToolDefinitionApi,
16
- deleteWidgetApi,
17
- disconnectIntegrationApi,
18
- getAgentApi,
19
- getAgentCSATAnalyticsApi,
20
- getAgentChatsAnalyticsApi,
21
- getAgentJobApi,
22
- getAgentListAnalyticsApi,
23
- getDefaultAgentApi,
24
- getDefaultWidgetApi,
25
- getIntegrationApi,
26
- getSkillApi,
27
- getSkillCategoriesApi,
28
- getSkillUserConfigApi,
29
- getSubAgentApi,
30
- getTaskOutcomesApi,
31
- getToolDefinitionApi,
32
- getToolDefinitionsByIdsApi,
33
- getWidgetApi,
34
- listAgentJobsApi,
35
- listAgentsApi,
36
- listAgentsSummaryApi,
37
- listIntegrationsApi,
38
- listSkillUserConfigsApi,
39
- listSkillsApi,
40
- listSubAgentsApi,
41
- listToolDefinitionsApi,
42
- listWidgetsApi,
43
- pauseAgentJobApi,
44
- refreshIntegrationApi,
45
- resolveSkillConfigApi,
46
- resumeAgentJobApi,
47
- runEmailTriageApi,
48
- setDefaultWidgetApi,
49
- updateAgentApi,
50
- updateAgentJobApi,
51
- updateIntegrationTriageApi,
52
- updateSkillApi,
53
- updateSkillUserConfigApi,
54
- updateSubAgentApi,
55
- updateToolDefinitionApi,
56
- updateWidgetApi
57
- } from "./chunk-NF6PGOXP.mjs";
58
-
59
- // hooks/index.ts
60
- import { useMemo } from "react";
61
-
62
- // hooks/use-async.ts
63
- import { useState, useCallback, useRef } from "react";
64
- function useAsync(asyncFn, options) {
65
- const [error, setError] = useState(null);
66
- const requestCountRef = useRef(0);
67
- const [loading, setLoading] = useState(false);
68
- const execute = useCallback(
69
- async (...args) => {
70
- requestCountRef.current += 1;
71
- setLoading(true);
72
- setError(null);
73
- try {
74
- return await asyncFn(...args);
75
- } catch (err) {
76
- const message = err instanceof Error ? err.message : "An error occurred";
77
- setError(message);
78
- options?.onError?.(message);
79
- throw err;
80
- } finally {
81
- requestCountRef.current -= 1;
82
- if (requestCountRef.current === 0) {
83
- setLoading(false);
84
- }
85
- }
86
- },
87
- [asyncFn, options]
88
- );
89
- const clearError = useCallback(() => setError(null), []);
90
- return { execute, loading, error, clearError };
91
- }
92
- function useApiAsync(asyncFn, extractor, defaultValue, options) {
93
- const [error, setError] = useState(null);
94
- const requestCountRef = useRef(0);
95
- const [loading, setLoading] = useState(false);
96
- const execute = useCallback(
97
- async (...args) => {
98
- requestCountRef.current += 1;
99
- setLoading(true);
100
- setError(null);
101
- try {
102
- const response = await asyncFn(...args);
103
- if (response.error) {
104
- setError(response.error);
105
- options?.onError?.(response.error);
106
- return defaultValue;
107
- }
108
- return response.data ? extractor(response.data) : defaultValue;
109
- } catch (err) {
110
- const message = err instanceof Error ? err.message : "An error occurred";
111
- setError(message);
112
- options?.onError?.(message);
113
- return defaultValue;
114
- } finally {
115
- requestCountRef.current -= 1;
116
- if (requestCountRef.current === 0) {
117
- setLoading(false);
118
- }
119
- }
120
- },
121
- [asyncFn, extractor, defaultValue, options]
122
- );
123
- const clearError = useCallback(() => setError(null), []);
124
- return { execute, loading, error, clearError };
125
- }
126
-
127
- // hooks/use-options-ref.ts
128
- import { useRef as useRef2, useEffect } from "react";
129
- function useOptionsRef(options) {
130
- const optionsRef = useRef2(options);
131
- useEffect(() => {
132
- optionsRef.current = options;
133
- }, [options]);
134
- return optionsRef;
135
- }
136
-
137
- // hooks/index.ts
138
- function useAgents(options) {
139
- const optionsRef = useOptionsRef(options);
140
- const { execute: listAgents, loading: listLoading, error: listError } = useApiAsync(
141
- () => listAgentsApi(optionsRef.current),
142
- (data) => data.agents,
143
- []
144
- );
145
- const { execute: listAgentSummaries, loading: listSummaryLoading, error: listSummaryError } = useApiAsync(
146
- () => listAgentsSummaryApi(optionsRef.current),
147
- (data) => data.agents,
148
- []
149
- );
150
- const { execute: getAgent, loading: getLoading, error: getError } = useApiAsync(
151
- (agentId) => getAgentApi(agentId, optionsRef.current),
152
- (data) => data.agent || null,
153
- null
154
- );
155
- const { execute: createAgent, loading: createLoading, error: createError } = useApiAsync(
156
- (agent) => createAgentApi(agent, optionsRef.current),
157
- (data) => data.agent || null,
158
- null
159
- );
160
- const { execute: updateAgent, loading: updateLoading, error: updateError } = useApiAsync(
161
- (agentId, agent) => updateAgentApi(agentId, agent, optionsRef.current),
162
- (data) => data.agent || null,
163
- null
164
- );
165
- const { execute: deleteAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
166
- (agentId) => deleteAgentApi(agentId, optionsRef.current),
167
- () => true,
168
- false
169
- );
170
- const { execute: getDefaultAgent, loading: defaultLoading, error: defaultError } = useApiAsync(
171
- () => getDefaultAgentApi(optionsRef.current),
172
- (data) => data.agent || null,
173
- null
174
- );
175
- const loading = listLoading || listSummaryLoading || getLoading || createLoading || updateLoading || deleteLoading || defaultLoading;
176
- const error = listError || listSummaryError || getError || createError || updateError || deleteError || defaultError;
177
- return useMemo(
178
- () => ({
179
- loading,
180
- error,
181
- listAgents,
182
- listAgentSummaries,
183
- getAgent,
184
- createAgent,
185
- updateAgent,
186
- deleteAgent,
187
- getDefaultAgent
188
- }),
189
- [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]
190
- );
191
- }
192
- function useSkills(options) {
193
- const optionsRef = useOptionsRef(options);
194
- const { execute: listSkills, loading: listLoading, error: listError } = useApiAsync(
195
- () => listSkillsApi(optionsRef.current),
196
- (data) => data.skills,
197
- []
198
- );
199
- const { execute: getSkill, loading: getLoading, error: getError } = useApiAsync(
200
- (skillId) => getSkillApi(skillId, optionsRef.current),
201
- (data) => data.skill || null,
202
- null
203
- );
204
- const { execute: createSkill, loading: createLoading, error: createError } = useApiAsync(
205
- (skill) => createSkillApi(skill, optionsRef.current),
206
- (data) => data.skill || null,
207
- null
208
- );
209
- const { execute: updateSkill, loading: updateLoading, error: updateError } = useApiAsync(
210
- (skillId, skill) => updateSkillApi(skillId, skill, optionsRef.current),
211
- (data) => data.skill || null,
212
- null
213
- );
214
- const { execute: deleteSkill, loading: deleteLoading, error: deleteError } = useApiAsync(
215
- (skillId) => deleteSkillApi(skillId, optionsRef.current),
216
- () => true,
217
- false
218
- );
219
- const { execute: getCategories, loading: categoriesLoading, error: categoriesError } = useApiAsync(
220
- () => getSkillCategoriesApi(optionsRef.current),
221
- (data) => data.categories,
222
- []
223
- );
224
- const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || categoriesLoading;
225
- const error = listError || getError || createError || updateError || deleteError || categoriesError;
226
- return useMemo(
227
- () => ({
228
- loading,
229
- error,
230
- listSkills,
231
- getSkill,
232
- createSkill,
233
- updateSkill,
234
- deleteSkill,
235
- getCategories
236
- }),
237
- [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill, getCategories]
238
- );
239
- }
240
- function useSubAgents(options) {
241
- const optionsRef = useOptionsRef(options);
242
- const { execute: listSubAgents, loading: listLoading, error: listError } = useApiAsync(
243
- () => listSubAgentsApi(optionsRef.current),
244
- (data) => data.subAgents,
245
- []
246
- );
247
- const { execute: getSubAgent, loading: getLoading, error: getError } = useApiAsync(
248
- (subAgentId) => getSubAgentApi(subAgentId, optionsRef.current),
249
- (data) => data.subAgent || null,
250
- null
251
- );
252
- const { execute: createSubAgent, loading: createLoading, error: createError } = useApiAsync(
253
- (subAgent) => createSubAgentApi(subAgent, optionsRef.current),
254
- (data) => data.subAgent || null,
255
- null
256
- );
257
- const { execute: updateSubAgent, loading: updateLoading, error: updateError } = useApiAsync(
258
- (subAgentId, subAgent) => updateSubAgentApi(subAgentId, subAgent, optionsRef.current),
259
- (data) => data.subAgent || null,
260
- null
261
- );
262
- const { execute: deleteSubAgent, loading: deleteLoading, error: deleteError } = useApiAsync(
263
- (subAgentId) => deleteSubAgentApi(subAgentId, optionsRef.current),
264
- () => true,
265
- false
266
- );
267
- const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;
268
- const error = listError || getError || createError || updateError || deleteError;
269
- return useMemo(
270
- () => ({
271
- loading,
272
- error,
273
- listSubAgents,
274
- getSubAgent,
275
- createSubAgent,
276
- updateSubAgent,
277
- deleteSubAgent
278
- }),
279
- [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]
280
- );
281
- }
282
- function useToolDefinitions(options) {
283
- const optionsRef = useOptionsRef(options);
284
- const { execute: listToolDefinitions, loading: listLoading, error: listError } = useApiAsync(
285
- () => listToolDefinitionsApi(optionsRef.current),
286
- (data) => data.toolDefinitions,
287
- []
288
- );
289
- const { execute: getToolDefinition, loading: getLoading, error: getError } = useApiAsync(
290
- (toolDefId) => getToolDefinitionApi(toolDefId, optionsRef.current),
291
- (data) => data.toolDefinition || null,
292
- null
293
- );
294
- const { execute: getToolDefinitionsByIds, loading: getByIdsLoading, error: getByIdsError } = useApiAsync(
295
- (ids) => getToolDefinitionsByIdsApi(ids, optionsRef.current),
296
- (data) => data.toolDefinitions,
297
- []
298
- );
299
- const { execute: createToolDefinition, loading: createLoading, error: createError } = useApiAsync(
300
- (toolDefinition) => createToolDefinitionApi(toolDefinition, optionsRef.current),
301
- (data) => data.toolDefinition || null,
302
- null
303
- );
304
- const { execute: updateToolDefinition, loading: updateLoading, error: updateError } = useApiAsync(
305
- (toolDefId, toolDefinition) => updateToolDefinitionApi(toolDefId, toolDefinition, optionsRef.current),
306
- (data) => data.toolDefinition || null,
307
- null
308
- );
309
- const { execute: deleteToolDefinition, loading: deleteLoading, error: deleteError } = useApiAsync(
310
- (toolDefId) => deleteToolDefinitionApi(toolDefId, optionsRef.current),
311
- () => true,
312
- false
313
- );
314
- const loading = listLoading || getLoading || getByIdsLoading || createLoading || updateLoading || deleteLoading;
315
- const error = listError || getError || getByIdsError || createError || updateError || deleteError;
316
- return useMemo(
317
- () => ({
318
- loading,
319
- error,
320
- listToolDefinitions,
321
- getToolDefinition,
322
- getToolDefinitionsByIds,
323
- createToolDefinition,
324
- updateToolDefinition,
325
- deleteToolDefinition
326
- }),
327
- [loading, error, listToolDefinitions, getToolDefinition, getToolDefinitionsByIds, createToolDefinition, updateToolDefinition, deleteToolDefinition]
328
- );
329
- }
330
- function useAgentJobs(options) {
331
- const optionsRef = useOptionsRef(options);
332
- const { execute: listAgentJobs, loading: listLoading, error: listError } = useApiAsync(
333
- () => listAgentJobsApi(optionsRef.current),
334
- (data) => data.jobs,
335
- []
336
- );
337
- const { execute: getAgentJob, loading: getLoading, error: getError } = useApiAsync(
338
- (jobId) => getAgentJobApi(jobId, optionsRef.current),
339
- (data) => data.job || null,
340
- null
341
- );
342
- const { execute: createAgentJob, loading: createLoading, error: createError } = useApiAsync(
343
- (job) => createAgentJobApi(job, optionsRef.current),
344
- (data) => data.job || null,
345
- null
346
- );
347
- const { execute: updateAgentJob, loading: updateLoading, error: updateError } = useApiAsync(
348
- (jobId, job) => updateAgentJobApi(jobId, job, optionsRef.current),
349
- (data) => data.job || null,
350
- null
351
- );
352
- const { execute: deleteAgentJob, loading: deleteLoading, error: deleteError } = useApiAsync(
353
- (jobId) => deleteAgentJobApi(jobId, optionsRef.current),
354
- () => true,
355
- false
356
- );
357
- const { execute: pauseAgentJob, loading: pauseLoading, error: pauseError } = useApiAsync(
358
- (jobId) => pauseAgentJobApi(jobId, optionsRef.current),
359
- (data) => data.job || null,
360
- null
361
- );
362
- const { execute: resumeAgentJob, loading: resumeLoading, error: resumeError } = useApiAsync(
363
- (jobId) => resumeAgentJobApi(jobId, optionsRef.current),
364
- (data) => data.job || null,
365
- null
366
- );
367
- const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading;
368
- const error = listError || getError || createError || updateError || deleteError || pauseError || resumeError;
369
- return useMemo(
370
- () => ({
371
- loading,
372
- error,
373
- listAgentJobs,
374
- getAgentJob,
375
- createAgentJob,
376
- updateAgentJob,
377
- deleteAgentJob,
378
- pauseAgentJob,
379
- resumeAgentJob
380
- }),
381
- [loading, error, listAgentJobs, getAgentJob, createAgentJob, updateAgentJob, deleteAgentJob, pauseAgentJob, resumeAgentJob]
382
- );
383
- }
384
- function useWidgets(options) {
385
- const optionsRef = useOptionsRef(options);
386
- const { execute: listWidgets, loading: listLoading, error: listError } = useApiAsync(
387
- () => listWidgetsApi(optionsRef.current.agentId, optionsRef.current),
388
- (data) => data.widgets,
389
- []
390
- );
391
- const { execute: getWidget, loading: getLoading, error: getError } = useApiAsync(
392
- (widgetId) => getWidgetApi(widgetId, optionsRef.current),
393
- (data) => data.widget || null,
394
- null
395
- );
396
- const { execute: getDefaultWidget, loading: defaultLoading, error: defaultError } = useApiAsync(
397
- () => getDefaultWidgetApi(optionsRef.current.agentId, optionsRef.current),
398
- (data) => data.widget || null,
399
- null
400
- );
401
- const { execute: createWidget, loading: createLoading, error: createError } = useApiAsync(
402
- (widget) => createWidgetApi(optionsRef.current.agentId, widget, optionsRef.current),
403
- (data) => data.widget || null,
404
- null
405
- );
406
- const { execute: updateWidget, loading: updateLoading, error: updateError } = useApiAsync(
407
- (widgetId, widget) => updateWidgetApi(widgetId, widget, optionsRef.current),
408
- (data) => data.widget || null,
409
- null
410
- );
411
- const { execute: deleteWidget, loading: deleteLoading, error: deleteError } = useApiAsync(
412
- (widgetId) => deleteWidgetApi(widgetId, optionsRef.current),
413
- () => true,
414
- false
415
- );
416
- const { execute: setDefaultWidget, loading: setDefaultLoading, error: setDefaultError } = useApiAsync(
417
- (widgetId) => setDefaultWidgetApi(widgetId, optionsRef.current.agentId, optionsRef.current),
418
- () => true,
419
- false
420
- );
421
- const loading = listLoading || getLoading || defaultLoading || createLoading || updateLoading || deleteLoading || setDefaultLoading;
422
- const error = listError || getError || defaultError || createError || updateError || deleteError || setDefaultError;
423
- return useMemo(
424
- () => ({
425
- loading,
426
- error,
427
- listWidgets,
428
- getWidget,
429
- getDefaultWidget,
430
- createWidget,
431
- updateWidget,
432
- deleteWidget,
433
- setDefaultWidget
434
- }),
435
- [loading, error, listWidgets, getWidget, getDefaultWidget, createWidget, updateWidget, deleteWidget, setDefaultWidget]
436
- );
437
- }
438
- function useSkillUserConfig(options) {
439
- const optionsRef = useOptionsRef(options);
440
- const { execute: getSkillUserConfig, loading: getLoading, error: getError } = useApiAsync(
441
- (skillId, agentId) => getSkillUserConfigApi(skillId, { ...optionsRef.current, agentId }),
442
- (data) => data.userConfig || null,
443
- null
444
- );
445
- const { execute: updateSkillUserConfig, loading: updateLoading, error: updateError } = useApiAsync(
446
- (skillId, data) => updateSkillUserConfigApi(skillId, data, optionsRef.current),
447
- (data) => data.userConfig || null,
448
- null
449
- );
450
- const { execute: deleteSkillUserConfig, loading: deleteLoading, error: deleteError } = useApiAsync(
451
- (skillId, agentId) => deleteSkillUserConfigApi(skillId, { ...optionsRef.current, agentId }),
452
- () => true,
453
- false
454
- );
455
- const { execute: listSkillUserConfigs, loading: listLoading, error: listError } = useApiAsync(
456
- (params) => listSkillUserConfigsApi({ ...optionsRef.current, ...params }),
457
- (data) => data.userConfigs || [],
458
- []
459
- );
460
- const { execute: resolveSkillConfig, loading: resolveLoading, error: resolveError } = useApiAsync(
461
- (skillId, agentId) => resolveSkillConfigApi(skillId, agentId, optionsRef.current),
462
- (data) => data,
463
- null
464
- );
465
- const loading = getLoading || updateLoading || deleteLoading || listLoading || resolveLoading;
466
- const error = getError || updateError || deleteError || listError || resolveError;
467
- return useMemo(
468
- () => ({
469
- loading,
470
- error,
471
- getSkillUserConfig,
472
- updateSkillUserConfig,
473
- deleteSkillUserConfig,
474
- listSkillUserConfigs,
475
- resolveSkillConfig
476
- }),
477
- [loading, error, getSkillUserConfig, updateSkillUserConfig, deleteSkillUserConfig, listSkillUserConfigs, resolveSkillConfig]
478
- );
479
- }
480
- function useAnalytics(options) {
481
- const optionsRef = useOptionsRef(options);
482
- const { execute: getAgentChatsAnalytics, loading: chatsLoading, error: chatsError } = useApiAsync(
483
- (params) => getAgentChatsAnalyticsApi(params, optionsRef.current),
484
- (data) => data.data,
485
- []
486
- );
487
- const { execute: getAgentCSATAnalytics, loading: csatLoading, error: csatError } = useApiAsync(
488
- (params) => getAgentCSATAnalyticsApi(params, optionsRef.current),
489
- (data) => data.data,
490
- []
491
- );
492
- const { execute: getAgentListAnalytics, loading: listLoading, error: listError } = useApiAsync(
493
- () => getAgentListAnalyticsApi(optionsRef.current),
494
- (data) => data.data,
495
- []
496
- );
497
- const { execute: getTaskOutcomes, loading: taskLoading, error: taskError } = useApiAsync(
498
- (params) => getTaskOutcomesApi(params, optionsRef.current),
499
- (data) => data.data,
500
- []
501
- );
502
- const loading = chatsLoading || csatLoading || listLoading || taskLoading;
503
- const error = chatsError || csatError || listError || taskError;
504
- return useMemo(
505
- () => ({
506
- loading,
507
- error,
508
- getAgentChatsAnalytics,
509
- getAgentCSATAnalytics,
510
- getAgentListAnalytics,
511
- getTaskOutcomes
512
- }),
513
- [loading, error, getAgentChatsAnalytics, getAgentCSATAnalytics, getAgentListAnalytics, getTaskOutcomes]
514
- );
515
- }
516
- function useIntegrations(options) {
517
- const optionsRef = useOptionsRef(options);
518
- const { execute: listIntegrations, loading: listLoading, error: listError } = useApiAsync(
519
- () => listIntegrationsApi(optionsRef.current),
520
- (data) => data.integrations,
521
- []
522
- );
523
- const { execute: getIntegration, loading: getLoading, error: getError } = useApiAsync(
524
- (provider, integrationType) => getIntegrationApi(provider, integrationType, optionsRef.current),
525
- (data) => data.integration || null,
526
- null
527
- );
528
- const { execute: connectIntegration, loading: connectLoading, error: connectError } = useApiAsync(
529
- (params) => connectIntegrationApi(params, optionsRef.current),
530
- (data) => ({ authUrl: data.auth_url, state: data.state }),
531
- null
532
- );
533
- const { execute: disconnectIntegration, loading: disconnectLoading, error: disconnectError } = useApiAsync(
534
- (params) => disconnectIntegrationApi(params, optionsRef.current),
535
- () => true,
536
- false
537
- );
538
- const { execute: refreshIntegration, loading: refreshLoading, error: refreshError } = useApiAsync(
539
- (params) => refreshIntegrationApi(params, optionsRef.current),
540
- (data) => data.integration || null,
541
- null
542
- );
543
- const { execute: updateTriage, loading: updateTriageLoading, error: updateTriageError } = useApiAsync(
544
- (params) => updateIntegrationTriageApi(params, optionsRef.current),
545
- (data) => data.integration || null,
546
- null
547
- );
548
- const { execute: runEmailTriage, loading: runTriageLoading, error: runTriageError } = useApiAsync(
549
- () => runEmailTriageApi(optionsRef.current),
550
- (data) => ({ success: data.success, emailsFound: data.emails_found, instancesCreated: data.instances_created }),
551
- null
552
- );
553
- const loading = listLoading || getLoading || connectLoading || disconnectLoading || refreshLoading || updateTriageLoading || runTriageLoading;
554
- const error = listError || getError || connectError || disconnectError || refreshError || updateTriageError || runTriageError;
555
- return useMemo(
556
- () => ({
557
- loading,
558
- error,
559
- listIntegrations,
560
- getIntegration,
561
- connectIntegration,
562
- disconnectIntegration,
563
- refreshIntegration,
564
- updateTriage,
565
- runEmailTriage
566
- }),
567
- [loading, error, listIntegrations, getIntegration, connectIntegration, disconnectIntegration, refreshIntegration, updateTriage, runEmailTriage]
568
- );
569
- }
570
-
571
- export {
572
- useAsync,
573
- useApiAsync,
574
- useOptionsRef,
575
- useAgents,
576
- useSkills,
577
- useSubAgents,
578
- useToolDefinitions,
579
- useAgentJobs,
580
- useWidgets,
581
- useSkillUserConfig,
582
- useAnalytics,
583
- useIntegrations
584
- };
585
- //# sourceMappingURL=chunk-X4MSBDTZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../hooks/index.ts","../hooks/use-async.ts","../hooks/use-options-ref.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Agent hooks for React applications\n *\n * Provides React hooks for agent CRUD operations with loading/error states.\n *\n * @packageDocumentation\n */\n\nimport { useMemo } from \"react\";\nimport type { ApiClientOptions } from \"@elqnt/api-client\";\nimport type {\n Agent, AgentSummary, Skill, SubAgent, ToolDefinition, AgentJob, AgentWidget, SkillUserConfig, ResolveSkillConfigResponse,\n UserIntegration, IntegrationProviderTS, IntegrationTypeTS,\n} from \"../models\";\nimport {\n // Agents\n listAgentsApi,\n listAgentsSummaryApi,\n getAgentApi,\n createAgentApi,\n updateAgentApi,\n deleteAgentApi,\n getDefaultAgentApi,\n // Skills\n listSkillsApi,\n getSkillApi,\n createSkillApi,\n updateSkillApi,\n deleteSkillApi,\n getSkillCategoriesApi,\n // Skill User Config\n getSkillUserConfigApi,\n updateSkillUserConfigApi,\n deleteSkillUserConfigApi,\n listSkillUserConfigsApi,\n resolveSkillConfigApi,\n // Sub-Agents\n listSubAgentsApi,\n getSubAgentApi,\n createSubAgentApi,\n updateSubAgentApi,\n deleteSubAgentApi,\n // Tool Definitions\n listToolDefinitionsApi,\n getToolDefinitionApi,\n createToolDefinitionApi,\n updateToolDefinitionApi,\n deleteToolDefinitionApi,\n getToolDefinitionsByIdsApi,\n // Agent Jobs\n listAgentJobsApi,\n getAgentJobApi,\n createAgentJobApi,\n updateAgentJobApi,\n deleteAgentJobApi,\n pauseAgentJobApi,\n resumeAgentJobApi,\n // Widgets\n listWidgetsApi,\n getWidgetApi,\n createWidgetApi,\n updateWidgetApi,\n deleteWidgetApi,\n getDefaultWidgetApi,\n setDefaultWidgetApi,\n // Analytics\n getAgentChatsAnalyticsApi,\n getAgentCSATAnalyticsApi,\n getAgentListAnalyticsApi,\n getTaskOutcomesApi,\n type DateFilter,\n // Integrations\n listIntegrationsApi,\n getIntegrationApi,\n connectIntegrationApi,\n disconnectIntegrationApi,\n refreshIntegrationApi,\n updateIntegrationTriageApi,\n runEmailTriageApi,\n} from \"../api\";\nimport { useApiAsync } from \"./use-async\";\nimport { useOptionsRef } from \"./use-options-ref\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport type UseAgentsOptions = ApiClientOptions;\n\n// =============================================================================\n// USE AGENTS HOOK\n// =============================================================================\n\n/**\n * Hook for agent CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listAgents, createAgent } = useAgents({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const agents = await listAgents();\n * ```\n */\nexport function useAgents(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listAgents, loading: listLoading, error: listError } = useApiAsync(\n () => listAgentsApi(optionsRef.current),\n (data) => data.agents,\n [] as Agent[]\n );\n\n const { execute: listAgentSummaries, loading: listSummaryLoading, error: listSummaryError } = useApiAsync(\n () => listAgentsSummaryApi(optionsRef.current),\n (data) => data.agents,\n [] as AgentSummary[]\n );\n\n const { execute: getAgent, loading: getLoading, error: getError } = useApiAsync(\n (agentId: string) => getAgentApi(agentId, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: createAgent, loading: createLoading, error: createError } = useApiAsync(\n (agent: Partial<Agent>) => createAgentApi(agent, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: updateAgent, loading: updateLoading, error: updateError } = useApiAsync(\n (agentId: string, agent: Partial<Agent>) => updateAgentApi(agentId, agent, optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const { execute: deleteAgent, loading: deleteLoading, error: deleteError } = useApiAsync(\n (agentId: string) => deleteAgentApi(agentId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: getDefaultAgent, loading: defaultLoading, error: defaultError } = useApiAsync(\n () => getDefaultAgentApi(optionsRef.current),\n (data) => data.agent || null,\n null as Agent | null\n );\n\n const loading = listLoading || listSummaryLoading || getLoading || createLoading || updateLoading || deleteLoading || defaultLoading;\n const error = listError || listSummaryError || getError || createError || updateError || deleteError || defaultError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listAgents,\n listAgentSummaries,\n getAgent,\n createAgent,\n updateAgent,\n deleteAgent,\n getDefaultAgent,\n }),\n [loading, error, listAgents, listAgentSummaries, getAgent, createAgent, updateAgent, deleteAgent, getDefaultAgent]\n );\n}\n\n// =============================================================================\n// USE SKILLS HOOK\n// =============================================================================\n\n/**\n * Hook for skill CRUD operations\n */\nexport function useSkills(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listSkills, loading: listLoading, error: listError } = useApiAsync(\n () => listSkillsApi(optionsRef.current),\n (data) => data.skills,\n [] as Skill[]\n );\n\n const { execute: getSkill, loading: getLoading, error: getError } = useApiAsync(\n (skillId: string) => getSkillApi(skillId, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: createSkill, loading: createLoading, error: createError } = useApiAsync(\n (skill: Partial<Skill>) => createSkillApi(skill, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: updateSkill, loading: updateLoading, error: updateError } = useApiAsync(\n (skillId: string, skill: Partial<Skill>) => updateSkillApi(skillId, skill, optionsRef.current),\n (data) => data.skill || null,\n null as Skill | null\n );\n\n const { execute: deleteSkill, loading: deleteLoading, error: deleteError } = useApiAsync(\n (skillId: string) => deleteSkillApi(skillId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: getCategories, loading: categoriesLoading, error: categoriesError } = useApiAsync(\n () => getSkillCategoriesApi(optionsRef.current),\n (data) => data.categories,\n [] as string[]\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || categoriesLoading;\n const error = listError || getError || createError || updateError || deleteError || categoriesError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listSkills,\n getSkill,\n createSkill,\n updateSkill,\n deleteSkill,\n getCategories,\n }),\n [loading, error, listSkills, getSkill, createSkill, updateSkill, deleteSkill, getCategories]\n );\n}\n\n// =============================================================================\n// USE SUB-AGENTS HOOK\n// =============================================================================\n\n/**\n * Hook for sub-agent CRUD operations\n */\nexport function useSubAgents(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listSubAgents, loading: listLoading, error: listError } = useApiAsync(\n () => listSubAgentsApi(optionsRef.current),\n (data) => data.subAgents,\n [] as SubAgent[]\n );\n\n const { execute: getSubAgent, loading: getLoading, error: getError } = useApiAsync(\n (subAgentId: string) => getSubAgentApi(subAgentId, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: createSubAgent, loading: createLoading, error: createError } = useApiAsync(\n (subAgent: Partial<SubAgent>) => createSubAgentApi(subAgent, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: updateSubAgent, loading: updateLoading, error: updateError } = useApiAsync(\n (subAgentId: string, subAgent: Partial<SubAgent>) => updateSubAgentApi(subAgentId, subAgent, optionsRef.current),\n (data) => data.subAgent || null,\n null as SubAgent | null\n );\n\n const { execute: deleteSubAgent, loading: deleteLoading, error: deleteError } = useApiAsync(\n (subAgentId: string) => deleteSubAgentApi(subAgentId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;\n const error = listError || getError || createError || updateError || deleteError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listSubAgents,\n getSubAgent,\n createSubAgent,\n updateSubAgent,\n deleteSubAgent,\n }),\n [loading, error, listSubAgents, getSubAgent, createSubAgent, updateSubAgent, deleteSubAgent]\n );\n}\n\n// =============================================================================\n// USE TOOL DEFINITIONS HOOK\n// =============================================================================\n\n/**\n * Hook for tool definition CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listToolDefinitions, createToolDefinition } = useToolDefinitions({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const toolDefs = await listToolDefinitions();\n * ```\n */\nexport function useToolDefinitions(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listToolDefinitions, loading: listLoading, error: listError } = useApiAsync(\n () => listToolDefinitionsApi(optionsRef.current),\n (data) => data.toolDefinitions,\n [] as ToolDefinition[]\n );\n\n const { execute: getToolDefinition, loading: getLoading, error: getError } = useApiAsync(\n (toolDefId: string) => getToolDefinitionApi(toolDefId, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: getToolDefinitionsByIds, loading: getByIdsLoading, error: getByIdsError } = useApiAsync(\n (ids: string[]) => getToolDefinitionsByIdsApi(ids, optionsRef.current),\n (data) => data.toolDefinitions,\n [] as ToolDefinition[]\n );\n\n const { execute: createToolDefinition, loading: createLoading, error: createError } = useApiAsync(\n (toolDefinition: Partial<ToolDefinition>) => createToolDefinitionApi(toolDefinition, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: updateToolDefinition, loading: updateLoading, error: updateError } = useApiAsync(\n (toolDefId: string, toolDefinition: Partial<ToolDefinition>) => updateToolDefinitionApi(toolDefId, toolDefinition, optionsRef.current),\n (data) => data.toolDefinition || null,\n null as ToolDefinition | null\n );\n\n const { execute: deleteToolDefinition, loading: deleteLoading, error: deleteError } = useApiAsync(\n (toolDefId: string) => deleteToolDefinitionApi(toolDefId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || getByIdsLoading || createLoading || updateLoading || deleteLoading;\n const error = listError || getError || getByIdsError || createError || updateError || deleteError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listToolDefinitions,\n getToolDefinition,\n getToolDefinitionsByIds,\n createToolDefinition,\n updateToolDefinition,\n deleteToolDefinition,\n }),\n [loading, error, listToolDefinitions, getToolDefinition, getToolDefinitionsByIds, createToolDefinition, updateToolDefinition, deleteToolDefinition]\n );\n}\n\n// =============================================================================\n// USE AGENT JOBS HOOK\n// =============================================================================\n\n/**\n * Hook for agent job CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listAgentJobs, createAgentJob, pauseAgentJob } = useAgentJobs({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const jobs = await listAgentJobs();\n * await pauseAgentJob(jobId);\n * ```\n */\nexport function useAgentJobs(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listAgentJobs, loading: listLoading, error: listError } = useApiAsync(\n () => listAgentJobsApi(optionsRef.current),\n (data) => data.jobs,\n [] as AgentJob[]\n );\n\n const { execute: getAgentJob, loading: getLoading, error: getError } = useApiAsync(\n (jobId: string) => getAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: createAgentJob, loading: createLoading, error: createError } = useApiAsync(\n (job: Partial<AgentJob>) => createAgentJobApi(job, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: updateAgentJob, loading: updateLoading, error: updateError } = useApiAsync(\n (jobId: string, job: Partial<AgentJob>) => updateAgentJobApi(jobId, job, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: deleteAgentJob, loading: deleteLoading, error: deleteError } = useApiAsync(\n (jobId: string) => deleteAgentJobApi(jobId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: pauseAgentJob, loading: pauseLoading, error: pauseError } = useApiAsync(\n (jobId: string) => pauseAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const { execute: resumeAgentJob, loading: resumeLoading, error: resumeError } = useApiAsync(\n (jobId: string) => resumeAgentJobApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null as AgentJob | null\n );\n\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading || pauseLoading || resumeLoading;\n const error = listError || getError || createError || updateError || deleteError || pauseError || resumeError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listAgentJobs,\n getAgentJob,\n createAgentJob,\n updateAgentJob,\n deleteAgentJob,\n pauseAgentJob,\n resumeAgentJob,\n }),\n [loading, error, listAgentJobs, getAgentJob, createAgentJob, updateAgentJob, deleteAgentJob, pauseAgentJob, resumeAgentJob]\n );\n}\n\n// =============================================================================\n// USE WIDGETS HOOK\n// =============================================================================\n\nexport interface UseWidgetsOptions extends UseAgentsOptions {\n agentId: string;\n}\n\n/**\n * Hook for widget CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listWidgets, createWidget } = useWidgets({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * agentId: selectedAgentId,\n * });\n *\n * const widgets = await listWidgets();\n * ```\n */\nexport function useWidgets(options: UseWidgetsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listWidgets, loading: listLoading, error: listError } = useApiAsync(\n () => listWidgetsApi(optionsRef.current.agentId, optionsRef.current),\n (data) => data.widgets,\n [] as AgentWidget[]\n );\n\n const { execute: getWidget, loading: getLoading, error: getError } = useApiAsync(\n (widgetId: string) => getWidgetApi(widgetId, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: getDefaultWidget, loading: defaultLoading, error: defaultError } = useApiAsync(\n () => getDefaultWidgetApi(optionsRef.current.agentId, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: createWidget, loading: createLoading, error: createError } = useApiAsync(\n (widget: Partial<AgentWidget>) => createWidgetApi(optionsRef.current.agentId, widget, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: updateWidget, loading: updateLoading, error: updateError } = useApiAsync(\n (widgetId: string, widget: Partial<AgentWidget>) => updateWidgetApi(widgetId, widget, optionsRef.current),\n (data) => data.widget || null,\n null as AgentWidget | null\n );\n\n const { execute: deleteWidget, loading: deleteLoading, error: deleteError } = useApiAsync(\n (widgetId: string) => deleteWidgetApi(widgetId, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: setDefaultWidget, loading: setDefaultLoading, error: setDefaultError } = useApiAsync(\n (widgetId: string) => setDefaultWidgetApi(widgetId, optionsRef.current.agentId, optionsRef.current),\n () => true,\n false\n );\n\n const loading = listLoading || getLoading || defaultLoading || createLoading || updateLoading || deleteLoading || setDefaultLoading;\n const error = listError || getError || defaultError || createError || updateError || deleteError || setDefaultError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listWidgets,\n getWidget,\n getDefaultWidget,\n createWidget,\n updateWidget,\n deleteWidget,\n setDefaultWidget,\n }),\n [loading, error, listWidgets, getWidget, getDefaultWidget, createWidget, updateWidget, deleteWidget, setDefaultWidget]\n );\n}\n\n// =============================================================================\n// USE SKILL USER CONFIG HOOK\n// =============================================================================\n\n/**\n * Hook for skill user configuration operations\n *\n * @example\n * ```tsx\n * const { loading, error, getSkillUserConfig, updateSkillUserConfig } = useSkillUserConfig({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const config = await getSkillUserConfig(skillId);\n * await updateSkillUserConfig(skillId, { enabled: true });\n * ```\n */\nexport function useSkillUserConfig(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: getSkillUserConfig, loading: getLoading, error: getError } = useApiAsync(\n (skillId: string, agentId?: string) =>\n getSkillUserConfigApi(skillId, { ...optionsRef.current, agentId }),\n (data) => data.userConfig || null,\n null as SkillUserConfig | null\n );\n\n const { execute: updateSkillUserConfig, loading: updateLoading, error: updateError } = useApiAsync(\n (\n skillId: string,\n data: { enabled?: boolean; displayOrder?: number; config?: Record<string, unknown>; agentId?: string }\n ) => updateSkillUserConfigApi(skillId, data, optionsRef.current),\n (data) => data.userConfig || null,\n null as SkillUserConfig | null\n );\n\n const { execute: deleteSkillUserConfig, loading: deleteLoading, error: deleteError } = useApiAsync(\n (skillId: string, agentId?: string) =>\n deleteSkillUserConfigApi(skillId, { ...optionsRef.current, agentId }),\n () => true,\n false\n );\n\n const { execute: listSkillUserConfigs, loading: listLoading, error: listError } = useApiAsync(\n (params?: { agentId?: string; limit?: number; offset?: number }) =>\n listSkillUserConfigsApi({ ...optionsRef.current, ...params }),\n (data) => data.userConfigs || [],\n [] as SkillUserConfig[]\n );\n\n const { execute: resolveSkillConfig, loading: resolveLoading, error: resolveError } = useApiAsync(\n (skillId: string, agentId: string) => resolveSkillConfigApi(skillId, agentId, optionsRef.current),\n (data) => data,\n null as ResolveSkillConfigResponse | null\n );\n\n const loading = getLoading || updateLoading || deleteLoading || listLoading || resolveLoading;\n const error = getError || updateError || deleteError || listError || resolveError;\n\n return useMemo(\n () => ({\n loading,\n error,\n getSkillUserConfig,\n updateSkillUserConfig,\n deleteSkillUserConfig,\n listSkillUserConfigs,\n resolveSkillConfig,\n }),\n [loading, error, getSkillUserConfig, updateSkillUserConfig, deleteSkillUserConfig, listSkillUserConfigs, resolveSkillConfig]\n );\n}\n\n// =============================================================================\n// USE ANALYTICS HOOK\n// =============================================================================\n\n/**\n * Hook for agent analytics operations\n *\n * @example\n * ```tsx\n * const { loading, error, getAgentChatsAnalytics, getAgentCSATAnalytics } = useAnalytics({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const chatsData = await getAgentChatsAnalytics({ from: '2024-01-01', to: '2024-12-31' });\n * ```\n */\nexport function useAnalytics(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: getAgentChatsAnalytics, loading: chatsLoading, error: chatsError } = useApiAsync(\n (params: { date_filter: DateFilter; agent_id?: string }) =>\n getAgentChatsAnalyticsApi(params, optionsRef.current),\n (data) => data.data,\n [] as unknown[]\n );\n\n const { execute: getAgentCSATAnalytics, loading: csatLoading, error: csatError } = useApiAsync(\n (params: { date_filter: DateFilter; agent_id?: string }) =>\n getAgentCSATAnalyticsApi(params, optionsRef.current),\n (data) => data.data,\n [] as unknown[]\n );\n\n const { execute: getAgentListAnalytics, loading: listLoading, error: listError } = useApiAsync(\n () => getAgentListAnalyticsApi(optionsRef.current),\n (data) => data.data,\n [] as unknown[]\n );\n\n const { execute: getTaskOutcomes, loading: taskLoading, error: taskError } = useApiAsync(\n (params: { date_filter: DateFilter }) => getTaskOutcomesApi(params, optionsRef.current),\n (data) => data.data,\n [] as unknown[]\n );\n\n const loading = chatsLoading || csatLoading || listLoading || taskLoading;\n const error = chatsError || csatError || listError || taskError;\n\n return useMemo(\n () => ({\n loading,\n error,\n getAgentChatsAnalytics,\n getAgentCSATAnalytics,\n getAgentListAnalytics,\n getTaskOutcomes,\n }),\n [loading, error, getAgentChatsAnalytics, getAgentCSATAnalytics, getAgentListAnalytics, getTaskOutcomes]\n );\n}\n\n// =============================================================================\n// USE INTEGRATIONS HOOK\n// =============================================================================\n\n/**\n * Hook for user integration operations (OAuth connections)\n *\n * @example\n * ```tsx\n * const { loading, error, listIntegrations, connectIntegration, disconnectIntegration } = useIntegrations({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const integrations = await listIntegrations();\n * const { auth_url } = await connectIntegration({ provider: 'google', integrationType: 'email', redirectUri: '/callback' });\n * ```\n */\nexport function useIntegrations(options: UseAgentsOptions) {\n const optionsRef = useOptionsRef(options);\n\n const { execute: listIntegrations, loading: listLoading, error: listError } = useApiAsync(\n () => listIntegrationsApi(optionsRef.current),\n (data) => data.integrations,\n [] as UserIntegration[]\n );\n\n const { execute: getIntegration, loading: getLoading, error: getError } = useApiAsync(\n (provider: IntegrationProviderTS, integrationType: IntegrationTypeTS) =>\n getIntegrationApi(provider, integrationType, optionsRef.current),\n (data) => data.integration || null,\n null as UserIntegration | null\n );\n\n const { execute: connectIntegration, loading: connectLoading, error: connectError } = useApiAsync(\n (params: { provider: IntegrationProviderTS; integrationType: IntegrationTypeTS; redirectUri: string }) =>\n connectIntegrationApi(params, optionsRef.current),\n (data) => ({ authUrl: data.auth_url, state: data.state }),\n null as { authUrl: string; state: string } | null\n );\n\n const { execute: disconnectIntegration, loading: disconnectLoading, error: disconnectError } = useApiAsync(\n (params: { provider: IntegrationProviderTS; integrationType: IntegrationTypeTS }) =>\n disconnectIntegrationApi(params, optionsRef.current),\n () => true,\n false\n );\n\n const { execute: refreshIntegration, loading: refreshLoading, error: refreshError } = useApiAsync(\n (params: { provider: IntegrationProviderTS; integrationType: IntegrationTypeTS }) =>\n refreshIntegrationApi(params, optionsRef.current),\n (data) => data.integration || null,\n null as UserIntegration | null\n );\n\n const { execute: updateTriage, loading: updateTriageLoading, error: updateTriageError } = useApiAsync(\n (params: { provider: IntegrationProviderTS; integrationType: IntegrationTypeTS; triageEnabled: boolean }) =>\n updateIntegrationTriageApi(params, optionsRef.current),\n (data) => data.integration || null,\n null as UserIntegration | null\n );\n\n const { execute: runEmailTriage, loading: runTriageLoading, error: runTriageError } = useApiAsync(\n () => runEmailTriageApi(optionsRef.current),\n (data) => ({ success: data.success, emailsFound: data.emails_found, instancesCreated: data.instances_created }),\n null as { success: boolean; emailsFound: number; instancesCreated: number } | null\n );\n\n const loading = listLoading || getLoading || connectLoading || disconnectLoading || refreshLoading || updateTriageLoading || runTriageLoading;\n const error = listError || getError || connectError || disconnectError || refreshError || updateTriageError || runTriageError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listIntegrations,\n getIntegration,\n connectIntegration,\n disconnectIntegration,\n refreshIntegration,\n updateTriage,\n runEmailTriage,\n }),\n [loading, error, listIntegrations, getIntegration, connectIntegration, disconnectIntegration, refreshIntegration, updateTriage, runEmailTriage]\n );\n}\n\n// =============================================================================\n// EXPORTS\n// =============================================================================\n\n// Re-export hook utilities for advanced usage\nexport { useApiAsync, useAsync } from \"./use-async\";\nexport { useOptionsRef } from \"./use-options-ref\";\nexport type { UseAsyncOptions, UseAsyncReturn } from \"./use-async\";\n","\"use client\";\n\n/**\n * Async operation utilities for React hooks\n *\n * Provides a generic pattern for handling async operations with loading/error states.\n * Uses a request counter for accurate concurrent loading state.\n */\n\nimport { useState, useCallback, useRef } from \"react\";\nimport type { ApiResponse } from \"@elqnt/api-client\";\n\nexport interface UseAsyncOptions {\n onError?: (error: string) => void;\n}\n\nexport interface UseAsyncReturn<TResult, TArgs extends unknown[] = []> {\n execute: (...args: TArgs) => Promise<TResult>;\n loading: boolean;\n error: string | null;\n clearError: () => void;\n}\n\n/**\n * Generic async hook for any promise-returning function.\n * Uses a request counter to properly track concurrent requests.\n */\nexport function useAsync<TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<TResult>,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [error, setError] = useState<string | null>(null);\n const requestCountRef = useRef(0);\n const [loading, setLoading] = useState(false);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCountRef.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n return await asyncFn(...args);\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n throw err;\n } finally {\n requestCountRef.current -= 1;\n if (requestCountRef.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, options]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { execute, loading, error, clearError };\n}\n\n/**\n * Specialized async hook for API operations that return ApiResponse.\n * Automatically extracts data and handles API errors.\n *\n * @param asyncFn - Function that returns ApiResponse<TResponse>\n * @param extractor - Function to extract the desired result from response data\n * @param defaultValue - Default value to return on error\n * @param options - Optional configuration\n *\n * @example\n * ```tsx\n * const { execute: listAgents, loading, error } = useApiAsync(\n * () => listAgentsApi(optionsRef.current),\n * (data) => data.agents,\n * []\n * );\n * ```\n */\nexport function useApiAsync<TResponse, TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<ApiResponse<TResponse>>,\n extractor: (data: TResponse) => TResult,\n defaultValue: TResult,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [error, setError] = useState<string | null>(null);\n const requestCountRef = useRef(0);\n const [loading, setLoading] = useState(false);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCountRef.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n const response = await asyncFn(...args);\n if (response.error) {\n setError(response.error);\n options?.onError?.(response.error);\n return defaultValue;\n }\n return response.data ? extractor(response.data) : defaultValue;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n return defaultValue;\n } finally {\n requestCountRef.current -= 1;\n if (requestCountRef.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, extractor, defaultValue, options]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { execute, loading, error, clearError };\n}\n","\"use client\";\n\n/**\n * Options reference utility for React hooks\n *\n * Keeps a mutable ref synchronized with options to avoid\n * stale closures in callbacks while preventing unnecessary re-renders.\n */\n\nimport { useRef, useEffect } from \"react\";\n\n/**\n * Creates a ref that stays synchronized with the provided options.\n * Useful for accessing current options values in callbacks without\n * causing re-renders or stale closure issues.\n *\n * @param options - The options object to track\n * @returns A ref that always contains the latest options\n *\n * @example\n * ```tsx\n * const optionsRef = useOptionsRef(options);\n *\n * const fetchData = useCallback(async () => {\n * // Always has the latest options, no stale closure\n * const result = await api.fetch(optionsRef.current);\n * }, []); // No need to include options in deps\n * ```\n */\nexport function useOptionsRef<T>(options: T): React.MutableRefObject<T> {\n const optionsRef = useRef(options);\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n return optionsRef;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,eAAe;;;ACDxB,SAAS,UAAU,aAAa,cAAc;AAkBvC,SAAS,SACd,SACA,SACgC;AAChC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,kBAAkB,OAAO,CAAC;AAChC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,QAAM,UAAU;AAAA,IACd,UAAU,SAAkC;AAC1C,sBAAgB,WAAW;AAC3B,iBAAW,IAAI;AACf,eAAS,IAAI;AAEb,UAAI;AACF,eAAO,MAAM,QAAQ,GAAG,IAAI;AAAA,MAC9B,SAAS,KAAK;AACZ,cAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,iBAAS,OAAO;AAChB,iBAAS,UAAU,OAAO;AAC1B,cAAM;AAAA,MACR,UAAE;AACA,wBAAgB,WAAW;AAC3B,YAAI,gBAAgB,YAAY,GAAG;AACjC,qBAAW,KAAK;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,QAAM,aAAa,YAAY,MAAM,SAAS,IAAI,GAAG,CAAC,CAAC;AAEvD,SAAO,EAAE,SAAS,SAAS,OAAO,WAAW;AAC/C;AAoBO,SAAS,YACd,SACA,WACA,cACA,SACgC;AAChC,QAAM,CAAC,O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