@aigentyc/chat-sdk 0.3.1 → 0.5.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/AGENTS.md +24 -1
- package/claude-skill/aigentyc-chat-sdk/SKILL.md +1 -1
- package/context7.json +1 -1
- package/dist/{ChatInterface-f8ftS56n.d.ts → ChatInterface-2MN5cpYB.d.ts} +1 -1
- package/dist/{ChatInterface-B0zbA3Lm.d.cts → ChatInterface-BnVyOUG5.d.cts} +1 -1
- package/dist/{SlotsContext-BjiX1mRx.d.ts → SlotsContext-BZBi51ZT.d.ts} +89 -4
- package/dist/{SlotsContext-CEOBjzfh.d.cts → SlotsContext-D_C7zlUA.d.cts} +89 -4
- package/dist/ai-elements.cjs +163 -566
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.d.cts +10 -2
- package/dist/ai-elements.d.ts +10 -2
- package/dist/ai-elements.js +16 -461
- package/dist/ai-elements.js.map +1 -1
- package/dist/{chunk-M4YRNNGB.js → chunk-3H4CX3MS.js} +29 -6
- package/dist/chunk-3H4CX3MS.js.map +1 -0
- package/dist/{chunk-BPV66QNM.cjs → chunk-52ZHMTAA.cjs} +30 -8
- package/dist/chunk-52ZHMTAA.cjs.map +1 -0
- package/dist/{chunk-B27JIQ4Z.js → chunk-5XF3NEFB.js} +576 -6
- package/dist/chunk-5XF3NEFB.js.map +1 -0
- package/dist/{chunk-5XF7KH6B.cjs → chunk-7ESWDFF5.cjs} +94 -60
- package/dist/chunk-7ESWDFF5.cjs.map +1 -0
- package/dist/{chunk-YG2COKFR.js → chunk-BWWN5LSE.js} +65 -31
- package/dist/chunk-BWWN5LSE.js.map +1 -0
- package/dist/chunk-BYTPAQ7F.js +70 -0
- package/dist/chunk-BYTPAQ7F.js.map +1 -0
- package/dist/{chunk-FPQ3UCCJ.js → chunk-D75TDRBH.js} +30 -8
- package/dist/chunk-D75TDRBH.js.map +1 -0
- package/dist/chunk-DDATCJ3O.cjs +75 -0
- package/dist/chunk-DDATCJ3O.cjs.map +1 -0
- package/dist/{chunk-NYQSM3EB.cjs → chunk-DVWX2UGY.cjs} +16 -2
- package/dist/chunk-DVWX2UGY.cjs.map +1 -0
- package/dist/{chunk-TZ7EM3EG.cjs → chunk-EMVZ7HWM.cjs} +44 -2
- package/dist/chunk-EMVZ7HWM.cjs.map +1 -0
- package/dist/{chunk-AD6XWKWB.js → chunk-FJZL33KP.js} +3 -3
- package/dist/{chunk-AD6XWKWB.js.map → chunk-FJZL33KP.js.map} +1 -1
- package/dist/{chunk-JHWSG5IB.js → chunk-JAOD6CNW.js} +38 -3
- package/dist/chunk-JAOD6CNW.js.map +1 -0
- package/dist/{chunk-4WOBNRRB.cjs → chunk-KTYYLZN7.cjs} +592 -8
- package/dist/chunk-KTYYLZN7.cjs.map +1 -0
- package/dist/{chunk-3HGOLNGG.cjs → chunk-NBZDBH4M.cjs} +29 -6
- package/dist/chunk-NBZDBH4M.cjs.map +1 -0
- package/dist/{chunk-5F3O3ZJH.js → chunk-P7UR37HP.js} +17 -4
- package/dist/chunk-P7UR37HP.js.map +1 -0
- package/dist/{chunk-7IFBPXT3.cjs → chunk-Q3UJEIBN.cjs} +6 -6
- package/dist/{chunk-7IFBPXT3.cjs.map → chunk-Q3UJEIBN.cjs.map} +1 -1
- package/dist/{chunk-3KSMOHNY.js → chunk-R3TYC66R.js} +46 -81
- package/dist/chunk-R3TYC66R.js.map +1 -0
- package/dist/{chunk-OU5OZKYH.cjs → chunk-Y4B45DW4.cjs} +48 -90
- package/dist/chunk-Y4B45DW4.cjs.map +1 -0
- package/dist/components.cjs +18 -18
- package/dist/components.d.cts +3 -3
- package/dist/components.d.ts +3 -3
- package/dist/components.js +7 -7
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/hooks.cjs +31 -10
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +4 -3
- package/dist/hooks.js.map +1 -1
- package/dist/i18n.d.cts +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/index.cjs +64 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +34 -11
- package/dist/styles.css +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/tools.cjs +5 -5
- package/dist/tools.d.cts +2 -2
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +2 -2
- package/dist/{types-DlNwk-bG.d.ts → types-bsR_-fq8.d.cts} +43 -2
- package/dist/{types-DlNwk-bG.d.cts → types-bsR_-fq8.d.ts} +43 -2
- package/dist/ui.cjs +52 -52
- package/dist/ui.js +2 -2
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HGOLNGG.cjs.map +0 -1
- package/dist/chunk-3KSMOHNY.js.map +0 -1
- package/dist/chunk-4WOBNRRB.cjs.map +0 -1
- package/dist/chunk-5F3O3ZJH.js.map +0 -1
- package/dist/chunk-5XF7KH6B.cjs.map +0 -1
- package/dist/chunk-B27JIQ4Z.js.map +0 -1
- package/dist/chunk-BPV66QNM.cjs.map +0 -1
- package/dist/chunk-FPQ3UCCJ.js.map +0 -1
- package/dist/chunk-JHWSG5IB.js.map +0 -1
- package/dist/chunk-M4YRNNGB.js.map +0 -1
- package/dist/chunk-NYQSM3EB.cjs.map +0 -1
- package/dist/chunk-OU5OZKYH.cjs.map +0 -1
- package/dist/chunk-TZ7EM3EG.cjs.map +0 -1
- package/dist/chunk-YG2COKFR.js.map +0 -1
package/dist/theme.d.cts
CHANGED
package/dist/theme.d.ts
CHANGED
package/dist/tools.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunk7AZMWPKX_cjs = require('./chunk-7AZMWPKX.cjs');
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var chunkQ3UJEIBN_cjs = require('./chunk-Q3UJEIBN.cjs');
|
|
6
|
+
require('./chunk-52ZHMTAA.cjs');
|
|
7
7
|
require('./chunk-JOO6C3XT.cjs');
|
|
8
8
|
var chunkH7C3AGA2_cjs = require('./chunk-H7C3AGA2.cjs');
|
|
9
9
|
var chunkQ7T3VAJV_cjs = require('./chunk-Q7T3VAJV.cjs');
|
|
@@ -23,15 +23,15 @@ Object.defineProperty(exports, "normalizeToolRows", {
|
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "ComponentRenderer", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkQ3UJEIBN_cjs.ComponentRenderer; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "SearchKnowledgeBaseRenderer", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkQ3UJEIBN_cjs.SearchKnowledgeBaseRenderer; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "ToolRenderer", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkQ3UJEIBN_cjs.ToolRenderer; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "JsonRenderResult", {
|
|
37
37
|
enumerable: true,
|
package/dist/tools.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { h as ToolRendererProps } from './types-bsR_-fq8.cjs';
|
|
3
|
+
export { e as ComponentAction, i as ToolResult } from './types-bsR_-fq8.cjs';
|
|
4
4
|
export { J as JsonRenderResult } from './JsonRenderResult-D6ogds0_.cjs';
|
|
5
5
|
export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.cjs';
|
|
6
6
|
import 'react';
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { h as ToolRendererProps } from './types-bsR_-fq8.js';
|
|
3
|
+
export { e as ComponentAction, i as ToolResult } from './types-bsR_-fq8.js';
|
|
4
4
|
export { J as JsonRenderResult } from './JsonRenderResult-D6ogds0_.js';
|
|
5
5
|
export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.js';
|
|
6
6
|
import 'react';
|
package/dist/tools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { getToolDisplayData, normalizeToolRows } from './chunk-XEAAB5ZM.js';
|
|
3
|
-
export { ComponentRenderer, SearchKnowledgeBaseRenderer, ToolRenderer } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
export { ComponentRenderer, SearchKnowledgeBaseRenderer, ToolRenderer } from './chunk-FJZL33KP.js';
|
|
4
|
+
import './chunk-D75TDRBH.js';
|
|
5
5
|
import './chunk-PS3U7T37.js';
|
|
6
6
|
export { JsonRenderResult } from './chunk-ZXP7IYRC.js';
|
|
7
7
|
export { VisualizationRenderer } from './chunk-5T4FJ2SR.js';
|
|
@@ -80,12 +80,30 @@ interface QuestionConfig {
|
|
|
80
80
|
interface ChatConfig {
|
|
81
81
|
/** Project identifier on the Aigentyc platform */
|
|
82
82
|
projectId: string;
|
|
83
|
-
/** Base URL of the API (e.g. `"https://api.aigentyc.
|
|
83
|
+
/** Base URL of the API (e.g. `"https://api.aigentyc.ai"`) */
|
|
84
84
|
apiEndpoint: string;
|
|
85
85
|
/** Bearer API key for authentication (alternative to session cookies) */
|
|
86
86
|
apiKey?: string;
|
|
87
87
|
/** Human-readable client / brand name shown in the header */
|
|
88
88
|
clientName?: string;
|
|
89
|
+
/**
|
|
90
|
+
* URL of the page the widget is embedded in. Sent with every message so the
|
|
91
|
+
* assistant can answer in the context of what the visitor is looking at.
|
|
92
|
+
*
|
|
93
|
+
* Read fresh on each send, so a single-page app may update it on navigation
|
|
94
|
+
* without remounting the widget.
|
|
95
|
+
*/
|
|
96
|
+
pageUrl?: string;
|
|
97
|
+
/** Title of the page the widget is embedded in. Sent with every message. */
|
|
98
|
+
pageTitle?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Free-form structured context about the host page — the active category, the
|
|
101
|
+
* filters the visitor has applied, the product they are viewing. Sent verbatim
|
|
102
|
+
* with every message; the backend renders it into the system prompt as data.
|
|
103
|
+
*
|
|
104
|
+
* Shape is up to the host app. Keep it small: it is re-sent on every turn.
|
|
105
|
+
*/
|
|
106
|
+
pageContext?: unknown;
|
|
89
107
|
}
|
|
90
108
|
/**
|
|
91
109
|
* Props passed to every slot component so it can delegate to the default.
|
|
@@ -340,6 +358,12 @@ interface ChatMessage {
|
|
|
340
358
|
input?: Record<string, unknown>;
|
|
341
359
|
/** Tool output */
|
|
342
360
|
output?: unknown;
|
|
361
|
+
/** File source (when `type === "file"`) — a `data:` URI or an https URL */
|
|
362
|
+
url?: string;
|
|
363
|
+
/** File MIME type (when `type === "file"`) */
|
|
364
|
+
mediaType?: string;
|
|
365
|
+
/** Original file name (when `type === "file"`) */
|
|
366
|
+
filename?: string;
|
|
343
367
|
}>;
|
|
344
368
|
}
|
|
345
369
|
/**
|
|
@@ -375,5 +399,22 @@ interface ChatProviderProps extends ChatConfig, ChatEventCallbacks {
|
|
|
375
399
|
/** React children to render inside the provider */
|
|
376
400
|
children?: React.ReactNode;
|
|
377
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* One file travelling out with a user message.
|
|
404
|
+
*
|
|
405
|
+
* Structurally the AI SDK's `FileUIPart`, restated here so consumers do not have
|
|
406
|
+
* to depend on `ai` directly just to type a composer. `url` is what the model is
|
|
407
|
+
* eventually shown: either a `data:` URI or an https URL the backend can read.
|
|
408
|
+
*/
|
|
409
|
+
interface ChatAttachmentInput {
|
|
410
|
+
/** Always `"file"` — present so the value is already a valid message part. */
|
|
411
|
+
type?: "file";
|
|
412
|
+
/** MIME type, e.g. `"image/jpeg"`. */
|
|
413
|
+
mediaType: string;
|
|
414
|
+
/** `data:` URI or an https URL the backend can fetch. */
|
|
415
|
+
url: string;
|
|
416
|
+
/** Original file name, shown in the transcript. */
|
|
417
|
+
filename?: string;
|
|
418
|
+
}
|
|
378
419
|
|
|
379
|
-
export type { ChatProviderProps as C, Language as L, QuestionConfig as Q, SlotMap as S, ThemeConfig as T,
|
|
420
|
+
export type { ChatProviderProps as C, Language as L, QuestionConfig as Q, SlotMap as S, ThemeConfig as T, ChatAttachmentInput as a, ChatConfig as b, ChatEventCallbacks as c, ChatMessage as d, ComponentAction as e, LiveChatMessage as f, LiveChatState as g, ToolRendererProps as h, ToolResult as i, SlotProps as j };
|
|
@@ -80,12 +80,30 @@ interface QuestionConfig {
|
|
|
80
80
|
interface ChatConfig {
|
|
81
81
|
/** Project identifier on the Aigentyc platform */
|
|
82
82
|
projectId: string;
|
|
83
|
-
/** Base URL of the API (e.g. `"https://api.aigentyc.
|
|
83
|
+
/** Base URL of the API (e.g. `"https://api.aigentyc.ai"`) */
|
|
84
84
|
apiEndpoint: string;
|
|
85
85
|
/** Bearer API key for authentication (alternative to session cookies) */
|
|
86
86
|
apiKey?: string;
|
|
87
87
|
/** Human-readable client / brand name shown in the header */
|
|
88
88
|
clientName?: string;
|
|
89
|
+
/**
|
|
90
|
+
* URL of the page the widget is embedded in. Sent with every message so the
|
|
91
|
+
* assistant can answer in the context of what the visitor is looking at.
|
|
92
|
+
*
|
|
93
|
+
* Read fresh on each send, so a single-page app may update it on navigation
|
|
94
|
+
* without remounting the widget.
|
|
95
|
+
*/
|
|
96
|
+
pageUrl?: string;
|
|
97
|
+
/** Title of the page the widget is embedded in. Sent with every message. */
|
|
98
|
+
pageTitle?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Free-form structured context about the host page — the active category, the
|
|
101
|
+
* filters the visitor has applied, the product they are viewing. Sent verbatim
|
|
102
|
+
* with every message; the backend renders it into the system prompt as data.
|
|
103
|
+
*
|
|
104
|
+
* Shape is up to the host app. Keep it small: it is re-sent on every turn.
|
|
105
|
+
*/
|
|
106
|
+
pageContext?: unknown;
|
|
89
107
|
}
|
|
90
108
|
/**
|
|
91
109
|
* Props passed to every slot component so it can delegate to the default.
|
|
@@ -340,6 +358,12 @@ interface ChatMessage {
|
|
|
340
358
|
input?: Record<string, unknown>;
|
|
341
359
|
/** Tool output */
|
|
342
360
|
output?: unknown;
|
|
361
|
+
/** File source (when `type === "file"`) — a `data:` URI or an https URL */
|
|
362
|
+
url?: string;
|
|
363
|
+
/** File MIME type (when `type === "file"`) */
|
|
364
|
+
mediaType?: string;
|
|
365
|
+
/** Original file name (when `type === "file"`) */
|
|
366
|
+
filename?: string;
|
|
343
367
|
}>;
|
|
344
368
|
}
|
|
345
369
|
/**
|
|
@@ -375,5 +399,22 @@ interface ChatProviderProps extends ChatConfig, ChatEventCallbacks {
|
|
|
375
399
|
/** React children to render inside the provider */
|
|
376
400
|
children?: React.ReactNode;
|
|
377
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* One file travelling out with a user message.
|
|
404
|
+
*
|
|
405
|
+
* Structurally the AI SDK's `FileUIPart`, restated here so consumers do not have
|
|
406
|
+
* to depend on `ai` directly just to type a composer. `url` is what the model is
|
|
407
|
+
* eventually shown: either a `data:` URI or an https URL the backend can read.
|
|
408
|
+
*/
|
|
409
|
+
interface ChatAttachmentInput {
|
|
410
|
+
/** Always `"file"` — present so the value is already a valid message part. */
|
|
411
|
+
type?: "file";
|
|
412
|
+
/** MIME type, e.g. `"image/jpeg"`. */
|
|
413
|
+
mediaType: string;
|
|
414
|
+
/** `data:` URI or an https URL the backend can fetch. */
|
|
415
|
+
url: string;
|
|
416
|
+
/** Original file name, shown in the transcript. */
|
|
417
|
+
filename?: string;
|
|
418
|
+
}
|
|
378
419
|
|
|
379
|
-
export type { ChatProviderProps as C, Language as L, QuestionConfig as Q, SlotMap as S, ThemeConfig as T,
|
|
420
|
+
export type { ChatProviderProps as C, Language as L, QuestionConfig as Q, SlotMap as S, ThemeConfig as T, ChatAttachmentInput as a, ChatConfig as b, ChatEventCallbacks as c, ChatMessage as d, ComponentAction as e, LiveChatMessage as f, LiveChatState as g, ToolRendererProps as h, ToolResult as i, SlotProps as j };
|
package/dist/ui.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkY4B45DW4_cjs = require('./chunk-Y4B45DW4.cjs');
|
|
5
|
+
var chunkEMVZ7HWM_cjs = require('./chunk-EMVZ7HWM.cjs');
|
|
6
6
|
var chunkJI5KCSOI_cjs = require('./chunk-JI5KCSOI.cjs');
|
|
7
7
|
var chunkAWAJOSFP_cjs = require('./chunk-AWAJOSFP.cjs');
|
|
8
8
|
var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
|
|
@@ -442,163 +442,163 @@ TableCaption.displayName = "TableCaption";
|
|
|
442
442
|
|
|
443
443
|
Object.defineProperty(exports, "Alert", {
|
|
444
444
|
enumerable: true,
|
|
445
|
-
get: function () { return
|
|
445
|
+
get: function () { return chunkY4B45DW4_cjs.Alert; }
|
|
446
446
|
});
|
|
447
447
|
Object.defineProperty(exports, "AlertDescription", {
|
|
448
448
|
enumerable: true,
|
|
449
|
-
get: function () { return
|
|
449
|
+
get: function () { return chunkY4B45DW4_cjs.AlertDescription; }
|
|
450
450
|
});
|
|
451
451
|
Object.defineProperty(exports, "AlertTitle", {
|
|
452
452
|
enumerable: true,
|
|
453
|
-
get: function () { return
|
|
453
|
+
get: function () { return chunkY4B45DW4_cjs.AlertTitle; }
|
|
454
454
|
});
|
|
455
455
|
Object.defineProperty(exports, "Badge", {
|
|
456
456
|
enumerable: true,
|
|
457
|
-
get: function () { return
|
|
457
|
+
get: function () { return chunkY4B45DW4_cjs.Badge; }
|
|
458
458
|
});
|
|
459
459
|
Object.defineProperty(exports, "Carousel", {
|
|
460
460
|
enumerable: true,
|
|
461
|
-
get: function () { return
|
|
461
|
+
get: function () { return chunkY4B45DW4_cjs.Carousel; }
|
|
462
462
|
});
|
|
463
463
|
Object.defineProperty(exports, "CarouselContent", {
|
|
464
464
|
enumerable: true,
|
|
465
|
-
get: function () { return
|
|
465
|
+
get: function () { return chunkY4B45DW4_cjs.CarouselContent; }
|
|
466
466
|
});
|
|
467
467
|
Object.defineProperty(exports, "CarouselItem", {
|
|
468
468
|
enumerable: true,
|
|
469
|
-
get: function () { return
|
|
469
|
+
get: function () { return chunkY4B45DW4_cjs.CarouselItem; }
|
|
470
470
|
});
|
|
471
471
|
Object.defineProperty(exports, "CarouselNext", {
|
|
472
472
|
enumerable: true,
|
|
473
|
-
get: function () { return
|
|
473
|
+
get: function () { return chunkY4B45DW4_cjs.CarouselNext; }
|
|
474
474
|
});
|
|
475
475
|
Object.defineProperty(exports, "CarouselPrevious", {
|
|
476
476
|
enumerable: true,
|
|
477
|
-
get: function () { return
|
|
477
|
+
get: function () { return chunkY4B45DW4_cjs.CarouselPrevious; }
|
|
478
478
|
});
|
|
479
479
|
Object.defineProperty(exports, "Dialog", {
|
|
480
480
|
enumerable: true,
|
|
481
|
-
get: function () { return
|
|
481
|
+
get: function () { return chunkY4B45DW4_cjs.Dialog; }
|
|
482
482
|
});
|
|
483
483
|
Object.defineProperty(exports, "DialogClose", {
|
|
484
484
|
enumerable: true,
|
|
485
|
-
get: function () { return
|
|
485
|
+
get: function () { return chunkY4B45DW4_cjs.DialogClose; }
|
|
486
486
|
});
|
|
487
487
|
Object.defineProperty(exports, "DialogContent", {
|
|
488
488
|
enumerable: true,
|
|
489
|
-
get: function () { return
|
|
489
|
+
get: function () { return chunkY4B45DW4_cjs.DialogContent; }
|
|
490
490
|
});
|
|
491
491
|
Object.defineProperty(exports, "DialogDescription", {
|
|
492
492
|
enumerable: true,
|
|
493
|
-
get: function () { return
|
|
493
|
+
get: function () { return chunkY4B45DW4_cjs.DialogDescription; }
|
|
494
494
|
});
|
|
495
495
|
Object.defineProperty(exports, "DialogFooter", {
|
|
496
496
|
enumerable: true,
|
|
497
|
-
get: function () { return
|
|
497
|
+
get: function () { return chunkY4B45DW4_cjs.DialogFooter; }
|
|
498
498
|
});
|
|
499
499
|
Object.defineProperty(exports, "DialogHeader", {
|
|
500
500
|
enumerable: true,
|
|
501
|
-
get: function () { return
|
|
501
|
+
get: function () { return chunkY4B45DW4_cjs.DialogHeader; }
|
|
502
502
|
});
|
|
503
503
|
Object.defineProperty(exports, "DialogTitle", {
|
|
504
504
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
505
|
+
get: function () { return chunkY4B45DW4_cjs.DialogTitle; }
|
|
506
506
|
});
|
|
507
507
|
Object.defineProperty(exports, "DialogTrigger", {
|
|
508
508
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
509
|
+
get: function () { return chunkY4B45DW4_cjs.DialogTrigger; }
|
|
510
510
|
});
|
|
511
511
|
Object.defineProperty(exports, "DropdownMenu", {
|
|
512
512
|
enumerable: true,
|
|
513
|
-
get: function () { return
|
|
513
|
+
get: function () { return chunkY4B45DW4_cjs.DropdownMenu; }
|
|
514
514
|
});
|
|
515
515
|
Object.defineProperty(exports, "DropdownMenuContent", {
|
|
516
516
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
517
|
+
get: function () { return chunkY4B45DW4_cjs.DropdownMenuContent; }
|
|
518
518
|
});
|
|
519
519
|
Object.defineProperty(exports, "DropdownMenuItem", {
|
|
520
520
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
521
|
+
get: function () { return chunkY4B45DW4_cjs.DropdownMenuItem; }
|
|
522
522
|
});
|
|
523
523
|
Object.defineProperty(exports, "DropdownMenuTrigger", {
|
|
524
524
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
525
|
+
get: function () { return chunkY4B45DW4_cjs.DropdownMenuTrigger; }
|
|
526
526
|
});
|
|
527
527
|
Object.defineProperty(exports, "Input", {
|
|
528
528
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
529
|
+
get: function () { return chunkY4B45DW4_cjs.Input; }
|
|
530
530
|
});
|
|
531
531
|
Object.defineProperty(exports, "Progress", {
|
|
532
532
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
533
|
+
get: function () { return chunkY4B45DW4_cjs.Progress; }
|
|
534
534
|
});
|
|
535
535
|
Object.defineProperty(exports, "ScrollArea", {
|
|
536
536
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
537
|
+
get: function () { return chunkY4B45DW4_cjs.ScrollArea; }
|
|
538
538
|
});
|
|
539
539
|
Object.defineProperty(exports, "ScrollBar", {
|
|
540
540
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
541
|
+
get: function () { return chunkY4B45DW4_cjs.ScrollBar; }
|
|
542
542
|
});
|
|
543
543
|
Object.defineProperty(exports, "Select", {
|
|
544
544
|
enumerable: true,
|
|
545
|
-
get: function () { return
|
|
545
|
+
get: function () { return chunkY4B45DW4_cjs.Select; }
|
|
546
546
|
});
|
|
547
547
|
Object.defineProperty(exports, "SelectContent", {
|
|
548
548
|
enumerable: true,
|
|
549
|
-
get: function () { return
|
|
549
|
+
get: function () { return chunkY4B45DW4_cjs.SelectContent; }
|
|
550
550
|
});
|
|
551
551
|
Object.defineProperty(exports, "SelectItem", {
|
|
552
552
|
enumerable: true,
|
|
553
|
-
get: function () { return
|
|
553
|
+
get: function () { return chunkY4B45DW4_cjs.SelectItem; }
|
|
554
554
|
});
|
|
555
555
|
Object.defineProperty(exports, "SelectTrigger", {
|
|
556
556
|
enumerable: true,
|
|
557
|
-
get: function () { return
|
|
557
|
+
get: function () { return chunkY4B45DW4_cjs.SelectTrigger; }
|
|
558
558
|
});
|
|
559
559
|
Object.defineProperty(exports, "SelectValue", {
|
|
560
560
|
enumerable: true,
|
|
561
|
-
get: function () { return
|
|
561
|
+
get: function () { return chunkY4B45DW4_cjs.SelectValue; }
|
|
562
562
|
});
|
|
563
|
-
Object.defineProperty(exports, "
|
|
563
|
+
Object.defineProperty(exports, "Button", {
|
|
564
564
|
enumerable: true,
|
|
565
|
-
get: function () { return
|
|
565
|
+
get: function () { return chunkEMVZ7HWM_cjs.Button; }
|
|
566
566
|
});
|
|
567
|
-
Object.defineProperty(exports, "
|
|
567
|
+
Object.defineProperty(exports, "Collapsible", {
|
|
568
568
|
enumerable: true,
|
|
569
|
-
get: function () { return
|
|
569
|
+
get: function () { return chunkEMVZ7HWM_cjs.Collapsible; }
|
|
570
570
|
});
|
|
571
|
-
Object.defineProperty(exports, "
|
|
571
|
+
Object.defineProperty(exports, "CollapsibleContent", {
|
|
572
572
|
enumerable: true,
|
|
573
|
-
get: function () { return
|
|
573
|
+
get: function () { return chunkEMVZ7HWM_cjs.CollapsibleContent; }
|
|
574
574
|
});
|
|
575
|
-
Object.defineProperty(exports, "
|
|
575
|
+
Object.defineProperty(exports, "CollapsibleTrigger", {
|
|
576
576
|
enumerable: true,
|
|
577
|
-
get: function () { return
|
|
577
|
+
get: function () { return chunkEMVZ7HWM_cjs.CollapsibleTrigger; }
|
|
578
578
|
});
|
|
579
|
-
Object.defineProperty(exports, "
|
|
579
|
+
Object.defineProperty(exports, "Separator", {
|
|
580
580
|
enumerable: true,
|
|
581
|
-
get: function () { return
|
|
581
|
+
get: function () { return chunkEMVZ7HWM_cjs.Separator; }
|
|
582
582
|
});
|
|
583
|
-
Object.defineProperty(exports, "
|
|
583
|
+
Object.defineProperty(exports, "Textarea", {
|
|
584
584
|
enumerable: true,
|
|
585
|
-
get: function () { return
|
|
585
|
+
get: function () { return chunkEMVZ7HWM_cjs.Textarea; }
|
|
586
586
|
});
|
|
587
|
-
Object.defineProperty(exports, "
|
|
587
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
588
588
|
enumerable: true,
|
|
589
|
-
get: function () { return
|
|
589
|
+
get: function () { return chunkEMVZ7HWM_cjs.Tooltip; }
|
|
590
590
|
});
|
|
591
|
-
Object.defineProperty(exports, "
|
|
591
|
+
Object.defineProperty(exports, "TooltipContent", {
|
|
592
592
|
enumerable: true,
|
|
593
|
-
get: function () { return
|
|
593
|
+
get: function () { return chunkEMVZ7HWM_cjs.TooltipContent; }
|
|
594
594
|
});
|
|
595
|
-
Object.defineProperty(exports, "
|
|
595
|
+
Object.defineProperty(exports, "TooltipProvider", {
|
|
596
596
|
enumerable: true,
|
|
597
|
-
get: function () { return
|
|
597
|
+
get: function () { return chunkEMVZ7HWM_cjs.TooltipProvider; }
|
|
598
598
|
});
|
|
599
|
-
Object.defineProperty(exports, "
|
|
599
|
+
Object.defineProperty(exports, "TooltipTrigger", {
|
|
600
600
|
enumerable: true,
|
|
601
|
-
get: function () { return
|
|
601
|
+
get: function () { return chunkEMVZ7HWM_cjs.TooltipTrigger; }
|
|
602
602
|
});
|
|
603
603
|
Object.defineProperty(exports, "Spinner", {
|
|
604
604
|
enumerable: true,
|
package/dist/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Alert, AlertDescription, AlertTitle, Badge, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Progress, ScrollArea, ScrollBar, Select, SelectContent, SelectItem, SelectTrigger, SelectValue
|
|
3
|
-
export { Button, Collapsible, CollapsibleContent, CollapsibleTrigger, Textarea } from './chunk-
|
|
2
|
+
export { Alert, AlertDescription, AlertTitle, Badge, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Progress, ScrollArea, ScrollBar, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './chunk-R3TYC66R.js';
|
|
3
|
+
export { Button, Collapsible, CollapsibleContent, CollapsibleTrigger, Separator, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './chunk-JAOD6CNW.js';
|
|
4
4
|
export { Spinner } from './chunk-4QT25AXI.js';
|
|
5
5
|
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './chunk-NPJKLYLV.js';
|
|
6
6
|
import { cn } from './chunk-3RW7O444.js';
|
package/llms.txt
CHANGED
|
@@ -460,7 +460,7 @@ The built-in tool dispatcher already wraps each tool in a boundary, so a single
|
|
|
460
460
|
| Symptom | Likely cause | Fix |
|
|
461
461
|
| --- | --- | --- |
|
|
462
462
|
| Unstyled / broken layout | Missing CSS import | `import "@aigentyc/chat-sdk/theme/styles.css"` |
|
|
463
|
-
| 401 / "Missing Authorization" on embed | No `apiKey` passed — required for all third-party domain embeds | Pass `apiKey` prop (or `NEXT_PUBLIC_AIGENTYC_API_KEY` / `VITE_AIGENTYC_API_KEY` env var). The "no apiKey needed" path only works inside `app.aigentyc.
|
|
463
|
+
| 401 / "Missing Authorization" on embed | No `apiKey` passed — required for all third-party domain embeds | Pass `apiKey` prop (or `NEXT_PUBLIC_AIGENTYC_API_KEY` / `VITE_AIGENTYC_API_KEY` env var). The "no apiKey needed" path only works inside `app.aigentyc.ai` itself (session cookie). |
|
|
464
464
|
| 403 / invalid origin | API key's Allowed Origins list doesn't include your embed domain | Dashboard → Settings → API Keys → edit → add domain |
|
|
465
465
|
| CORS error in browser | Allowed Origins on API key doesn't include current URL | Add `http://localhost:5173` (Vite) or `http://localhost:3000` (Next) to the key's Allowed Origins |
|
|
466
466
|
| Slot override doesn't render | Using `toolRenderers` keyed by tool name | Use `tools` for per-tool overrides; `toolRenderers` is per render mode. Dev console warns automatically. |
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-aigentyc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Ae,OAAA,EAAS,cAAc,OAAO,CAAA;AAC7C,QAAA,aAAA,CAAc,CAAC,IAAA,KAAS;AAAA,UACtB,GAAG,IAAA;AAAA,UACH;AAAA,YACE,EAAA,EAAI,KAAK,GAAA,EAAI;AAAA,YACb,OAAA;AAAA,YACA,UAAA,EAAY,SAAA;AAAA,YACZ,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY;AACpC,SACD,CAAA;AAAA,MACH,CAAA;AAAA,MACA,GAAA,EAAK,MAAM,cAAA,CAAe,OAAA,EAAS,OAAA,IAAU;AAAA,MAC7C,MAAA,EAAQ,MAAM,YAAA,EAAa;AAAA,MAC3B,YAAA,EAAc,CAAC,MAAA,EAAQ,OAAA,KACrB,eAAe,OAAA,EAAS,YAAA,GAAe,QAAQ,OAAO,CAAA;AAAA,MACxD,UAAA,EAAY,MAAM,YAAA,EAAa;AAAA,MAC/B,oBAAA,EAAsB,MAAM,iBAAA,CAAkB,IAAI,CAAA;AAAA,MAClD,mBAAA,EAAqB;AAAA,KACvB,CAAA;AAAA,IACA,CAAC,OAAA,EAAS,UAAA,EAAY,YAAY,OAAA,EAAS,cAAA,EAAgB,YAAY,YAAY;AAAA,GACrF;AAEA,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-3HGOLNGG.cjs","sourcesContent":["\"use client\";\n\nimport {\n useState,\n useCallback,\n useRef,\n useMemo,\n useEffect,\n type RefObject,\n} from \"react\";\nimport type {\n ChatProviderProps,\n ChatMessage,\n ChatEventCallbacks,\n LiveChatState,\n LiveChatMessage,\n} from \"../core/types\";\n\ntype ChatStatus = \"idle\" | \"streaming\" | \"error\";\n\ninterface ActiveTool {\n toolName: string;\n state: \"partial-call\" | \"call\" | \"output-available\";\n args: Record<string, unknown>;\n result?: unknown;\n renderMode: string;\n}\n// NOTE: @ai-sdk/react and ai are optional peer dependencies.\nimport { useChat } from \"@ai-sdk/react\";\nimport { DefaultChatTransport } from \"ai\";\nimport { LiveChatTransport } from \"../core/live-chat-transport\";\n\nconst SESSION_KEY_PREFIX = \"aigentyc-session-\";\nconst MESSAGE_KEY_PREFIX = \"aigentyc-messages-\";\n\nfunction getOrCreateSessionId(projectId: string): string {\n if (typeof window === \"undefined\") return crypto.randomUUID();\n const key = SESSION_KEY_PREFIX + projectId;\n try {\n const stored = sessionStorage.getItem(key);\n if (stored) return stored;\n const id = crypto.randomUUID();\n sessionStorage.setItem(key, id);\n return id;\n } catch {\n return crypto.randomUUID();\n }\n}\n\nfunction loadPersistedMessages(projectId: string): ChatMessage[] {\n if (typeof window === \"undefined\") return [];\n try {\n const raw = localStorage.getItem(MESSAGE_KEY_PREFIX + projectId);\n return raw ? JSON.parse(raw) : [];\n } catch {\n return [];\n }\n}\n\nfunction persistMessages(projectId: string, messages: unknown[]): void {\n if (typeof window === \"undefined\") return;\n try {\n localStorage.setItem(MESSAGE_KEY_PREFIX + projectId, JSON.stringify(messages));\n } catch {\n // Ignore.\n }\n}\n\nfunction clearPersistedMessages(projectId: string): void {\n if (typeof window === \"undefined\") return;\n try {\n localStorage.removeItem(MESSAGE_KEY_PREFIX + projectId);\n } catch {\n // Ignore.\n }\n}\n\n/** Options for the headless `useAigentycChat` hook (same shape as ChatProviderProps). */\nexport type UseAigentycChatOptions = Omit<ChatProviderProps, \"children\" | \"slots\" | \"theme\">;\n\n/** Live chat sub-object returned by the hook. */\nexport interface LiveChatReturn {\n state: LiveChatState;\n messages: LiveChatMessage[];\n operatorName: string;\n queuePosition: number;\n showIdentityForm: boolean;\n initiate: (visitorName?: string, visitorEmail?: string) => Promise<void>;\n send: (content: string) => void;\n end: () => void;\n cancel: () => void;\n submitRating: (rating: \"positive\" | \"negative\", comment?: string) => void;\n returnToAI: () => void;\n requestManualHandoff: () => void;\n setShowIdentityForm: (show: boolean) => void;\n}\n\n/** Return value of `useAigentycChat`. */\nexport interface UseAigentycChatReturn {\n messages: ChatMessage[];\n status: ChatStatus;\n error: Error | undefined;\n sessionId: string;\n sendMessage: (content: string) => void;\n stopGeneration: () => void;\n newConversation: () => void;\n clearMessages: () => void;\n activeTools: ActiveTool[];\n liveChat: LiveChatReturn;\n chatRef: RefObject<HTMLDivElement | null>;\n}\n\nconst CALLBACK_KEYS: (keyof ChatEventCallbacks)[] = [\n \"onReady\",\n \"onSessionStart\",\n \"onSessionRestore\",\n \"onMessageSent\",\n \"onMessageReceived\",\n \"onStreamStart\",\n \"onStreamEnd\",\n \"onToolCall\",\n \"onToolResult\",\n \"onToolAction\",\n \"onLiveChatRequested\",\n \"onLiveChatConnected\",\n \"onLiveChatEnded\",\n \"onError\",\n \"onNewConversation\",\n \"onStopGeneration\",\n \"onClearMessages\",\n \"onInteraction\",\n];\n\nfunction pickCallbacks(opts: Record<string, unknown>): ChatEventCallbacks {\n const out: Record<string, unknown> = {};\n for (const key of CALLBACK_KEYS) {\n if (opts[key] !== undefined) out[key] = opts[key];\n }\n return out as ChatEventCallbacks;\n}\n\n/**\n * Standalone headless hook for Aigentyc Chat. No provider needed.\n *\n * Creates its own transport, session, and persistence internally. Use this\n * when you want full control over the UI but still want all SDK features\n * (chat, tools, live chat, persistence).\n */\nexport function useAigentycChat(options: UseAigentycChatOptions): UseAigentycChatReturn {\n const {\n projectId,\n apiEndpoint,\n apiKey,\n enableLiveChat = false,\n chatServiceUrl,\n persistMessages: shouldPersist = true,\n } = options;\n\n const callbacks = pickCallbacks(options as unknown as Record<string, unknown>);\n const callbacksRef = useRef(callbacks);\n callbacksRef.current = callbacks;\n\n const safeProjectId = projectId || \"default\";\n const [sessionId, setSessionId] = useState(() => getOrCreateSessionId(safeProjectId));\n const chatRef = useRef<HTMLDivElement | null>(null);\n\n const initialMessages = useMemo(\n () => (shouldPersist ? loadPersistedMessages(safeProjectId) : []),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const transport = useMemo(\n () =>\n new DefaultChatTransport({\n api: `${apiEndpoint || \"\"}/api/kb/chat`,\n headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined,\n body: { projectId: safeProjectId, sessionId },\n }),\n [apiEndpoint, apiKey, safeProjectId, sessionId]\n );\n\n const {\n messages,\n sendMessage: sdkSendMessage,\n status: sdkStatus,\n error,\n stop,\n setMessages,\n } = useChat({\n id: sessionId,\n messages: initialMessages as never,\n transport,\n onFinish: (message) => {\n callbacksRef.current?.onMessageReceived?.(message as unknown as ChatMessage);\n },\n onError: (err) => {\n callbacksRef.current?.onError?.(err);\n },\n });\n\n const status: ChatStatus = error\n ? \"error\"\n : sdkStatus === \"streaming\" || sdkStatus === \"submitted\"\n ? \"streaming\"\n : \"idle\";\n\n // Persist messages\n useEffect(() => {\n if (shouldPersist) persistMessages(safeProjectId, messages);\n }, [messages, safeProjectId, shouldPersist]);\n\n // Derive active tools from the latest assistant message\n const activeTools = useMemo<ActiveTool[]>(() => {\n if (messages.length === 0) return [];\n const last = messages[messages.length - 1] as { role: string; parts?: unknown[] };\n if (last.role !== \"assistant\" || !Array.isArray(last.parts)) return [];\n return (last.parts as Array<Record<string, unknown>>)\n .filter((p) => typeof p.type === \"string\" && (p.type as string).startsWith(\"tool-\"))\n .map((p) => ({\n toolName: (p.toolName as string) || (p.type as string).replace(\"tool-\", \"\"),\n state: (p.state as ActiveTool[\"state\"]) || \"output-available\",\n args: (p.args as Record<string, unknown>) || {},\n result: p.result,\n renderMode: (p.renderMode as string) || \"inline\",\n }));\n }, [messages]);\n\n const sendMessage = useCallback(\n (content: string) => {\n if (!content.trim()) return;\n callbacksRef.current?.onMessageSent?.({\n id: crypto.randomUUID(),\n role: \"user\",\n content,\n } as ChatMessage);\n sdkSendMessage({ text: content });\n },\n [sdkSendMessage]\n );\n\n const stopGeneration = useCallback(() => {\n stop();\n callbacksRef.current?.onStopGeneration?.();\n }, [stop]);\n\n const newConversation = useCallback(() => {\n setMessages([]);\n clearPersistedMessages(safeProjectId);\n if (typeof window !== \"undefined\") {\n try {\n sessionStorage.removeItem(SESSION_KEY_PREFIX + safeProjectId);\n } catch {\n // Ignore.\n }\n }\n const nextSessionId = getOrCreateSessionId(safeProjectId);\n setSessionId(nextSessionId);\n callbacksRef.current?.onNewConversation?.(nextSessionId);\n }, [safeProjectId, setMessages]);\n\n const clearMessages = useCallback(() => {\n setMessages([]);\n clearPersistedMessages(safeProjectId);\n callbacksRef.current?.onClearMessages?.();\n }, [safeProjectId, setMessages]);\n\n // --- Live Chat (self-contained) ---\n const [lcState, setLcState] = useState<LiveChatState>(\"ai\");\n const [lcMessages, setLcMessages] = useState<LiveChatMessage[]>([]);\n const [lcOperator, setLcOperator] = useState(\"\");\n const [lcQueue, setLcQueue] = useState(0);\n const [lcShowIdentity, setLcShowIdentity] = useState(false);\n const lcTransportRef = useRef<LiveChatTransport | null>(null);\n\n const lcResetState = useCallback(() => {\n lcTransportRef.current?.disconnect?.();\n lcTransportRef.current = null;\n setLcState(\"ai\");\n setLcMessages([]);\n setLcOperator(\"\");\n setLcQueue(0);\n setLcShowIdentity(false);\n }, []);\n\n const lcInitiate = useCallback(\n async (visitorName?: string, visitorEmail?: string) => {\n if (!enableLiveChat || lcTransportRef.current) return;\n const url = chatServiceUrl ?? apiEndpoint;\n if (!url || !apiKey) return;\n try {\n const transport = new LiveChatTransport({\n chatServiceUrl: url,\n apiKey,\n projectId: safeProjectId,\n visitorSessionId: sessionId,\n });\n transport.on(\"state-change\", (s: LiveChatState) => setLcState(s));\n transport.on(\"queued\", (data: { position: number }) => setLcQueue(data.position));\n transport.on(\"queue-update\", (data: { position: number }) => setLcQueue(data.position));\n transport.on(\"accepted\", (data: { operatorName: string }) => setLcOperator(data.operatorName));\n transport.on(\"message\", (data: LiveChatMessage) =>\n setLcMessages((prev) => [...prev, data])\n );\n transport.on(\"ended\", () => setLcState(\"ended\"));\n lcTransportRef.current = transport;\n await transport.connect();\n await transport.requestHandoff({\n visitorName,\n visitorEmail,\n aiChatHistory: [],\n });\n callbacksRef.current?.onLiveChatRequested?.();\n } catch (err) {\n callbacksRef.current?.onError?.(err as Error);\n setLcState(\"ai\");\n }\n },\n [enableLiveChat, chatServiceUrl, apiEndpoint, apiKey, safeProjectId, sessionId]\n );\n\n const liveChat = useMemo<LiveChatReturn>(\n () => ({\n state: lcState,\n messages: lcMessages,\n operatorName: lcOperator,\n queuePosition: lcQueue,\n showIdentityForm: lcShowIdentity,\n initiate: lcInitiate,\n send: (content: string) => {\n if (!content.trim()) return;\n lcTransportRef.current?.sendMessage?.(content);\n setLcMessages((prev) => [\n ...prev,\n {\n id: Date.now(),\n content,\n senderType: \"visitor\",\n timestamp: new Date().toISOString(),\n },\n ]);\n },\n end: () => lcTransportRef.current?.endChat?.(),\n cancel: () => lcResetState(),\n submitRating: (rating, comment) =>\n lcTransportRef.current?.submitRating?.(rating, comment),\n returnToAI: () => lcResetState(),\n requestManualHandoff: () => setLcShowIdentity(true),\n setShowIdentityForm: setLcShowIdentity,\n }),\n [lcState, lcMessages, lcOperator, lcQueue, lcShowIdentity, lcInitiate, lcResetState]\n );\n\n return {\n messages: messages as unknown as ChatMessage[],\n status,\n error: error as Error | undefined,\n sessionId,\n sendMessage,\n stopGeneration,\n newConversation,\n clearMessages,\n activeTools,\n liveChat,\n chatRef,\n };\n}\n"]}
|