@useago/sdk 1.3.2 → 1.4.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.
- package/README.md +41 -0
- package/dist/{AgoClient-Cwx_eYSu.js → AgoClient-BdtuHX7k.js} +150 -85
- package/dist/AgoClient-CRAnT4qE.cjs +8 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +99 -1
- package/dist/angular.d.ts +99 -1
- package/dist/angular.js +16 -7
- package/dist/{createConversationSession-DV0Xp_3O.cjs → createConversationSession-B8zfTL78.cjs} +1 -1
- package/dist/{createConversationSession-B3h567tt.js → createConversationSession-CWpf4u6I.js} +1 -1
- package/dist/{createFormCollector-CyWisAkI.js → createFormCollector-B4n0_diV.js} +1 -1
- package/dist/{createFormCollector-BB3Uscuo.cjs → createFormCollector-BB_l0Sia.cjs} +1 -1
- package/dist/{createMockClient-DwdxNwEn.js → createMockClient-d-arlmCq.js} +19 -17
- package/dist/createMockClient-ucPENDzz.cjs +1 -0
- package/dist/devtools.d.cts +93 -1
- package/dist/devtools.d.ts +93 -1
- package/dist/helpers.d.cts +5 -1
- package/dist/helpers.d.ts +5 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +93 -1
- package/dist/index.d.ts +93 -1
- package/dist/index.js +4 -4
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +158 -2
- package/dist/react.d.ts +158 -2
- package/dist/react.js +469 -391
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +93 -1
- package/dist/testing.d.ts +93 -1
- package/dist/testing.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +125 -1
- package/dist/vue.d.ts +125 -1
- package/dist/vue.js +73 -64
- package/dist/widget.cjs +1 -1
- package/dist/widget.d.cts +93 -1
- package/dist/widget.d.ts +93 -1
- package/dist/widget.js +3 -3
- package/package.json +1 -1
- package/dist/AgoClient-CzSmJQxl.cjs +0 -6
- package/dist/createMockClient-zHQ0cjUH.cjs +0 -1
package/dist/react.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { i as
|
|
3
|
-
import { t as _e } from "./createMockClient-
|
|
4
|
-
import
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
const [t, r] =
|
|
1
|
+
import { a as j, i as G, o as V, s as Y, t as X } from "./AgoClient-BdtuHX7k.js";
|
|
2
|
+
import { i as Q, n as Ne, r as H, t as O } from "./createFormCollector-B4n0_diV.js";
|
|
3
|
+
import { t as _e } from "./createMockClient-d-arlmCq.js";
|
|
4
|
+
import Z, { createContext as ee, useCallback as R, useContext as $, useEffect as C, useId as te, useMemo as N, useRef as A, useState as I, useSyncExternalStore as ne } from "react";
|
|
5
|
+
import { Fragment as B, jsx as s, jsxs as M } from "react/jsx-runtime";
|
|
6
|
+
import re from "react-markdown";
|
|
7
|
+
import oe from "remark-gfm";
|
|
8
|
+
function ae(e) {
|
|
9
|
+
const [t, r] = I(!1), n = A(null), o = N(() => {
|
|
10
10
|
if (n.current && (n.current.destroy(), n.current = null), !e) return null;
|
|
11
|
-
const i = new
|
|
11
|
+
const i = new X(e);
|
|
12
12
|
return n.current = i, i;
|
|
13
13
|
}, [e?.baseUrl, e?.widgetId]);
|
|
14
|
-
return
|
|
14
|
+
return C(() => (r(!0), () => {
|
|
15
15
|
n.current?.destroy(), n.current = null;
|
|
16
|
-
}), [
|
|
16
|
+
}), [o]), C(() => {
|
|
17
17
|
n.current && e && n.current.updateConfig({
|
|
18
18
|
agent: e.agent,
|
|
19
19
|
defaultAgentId: e.defaultAgentId,
|
|
@@ -32,187 +32,187 @@ function oe(e) {
|
|
|
32
32
|
e?.debug,
|
|
33
33
|
e?.warnOnEmptyReply
|
|
34
34
|
]), {
|
|
35
|
-
client:
|
|
35
|
+
client: o,
|
|
36
36
|
isReady: t
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
var
|
|
40
|
-
const { client:
|
|
41
|
-
return
|
|
39
|
+
var z = ee(null), He = ({ children: e, client: t, tools: r, helpers: n, pageContext: o, ...i }) => {
|
|
40
|
+
const { client: c } = ae(t ? null : i), l = t || c;
|
|
41
|
+
return C(() => {
|
|
42
42
|
if (!(!r || r.length === 0)) {
|
|
43
|
-
for (const
|
|
43
|
+
for (const g of r) l.register(g);
|
|
44
44
|
return () => {
|
|
45
|
-
for (const
|
|
45
|
+
for (const g of r) l.unregisterFunction(g.name);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
}, [l, r]),
|
|
48
|
+
}, [l, r]), C(() => {
|
|
49
49
|
if (!n) return;
|
|
50
|
-
const
|
|
51
|
-
return import("./functions-CApuQZ2b.js").then((
|
|
52
|
-
for (const [
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
console.warn(`[AGO] Unknown helper: "${
|
|
50
|
+
const g = [];
|
|
51
|
+
return import("./functions-CApuQZ2b.js").then((d) => d.n).then((d) => {
|
|
52
|
+
for (const [y, p] of Object.entries(n)) {
|
|
53
|
+
const x = d[y];
|
|
54
|
+
if (!x) {
|
|
55
|
+
console.warn(`[AGO] Unknown helper: "${y}"`);
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
...
|
|
60
|
-
handler:
|
|
58
|
+
const h = p === !0 ? x : {
|
|
59
|
+
...x,
|
|
60
|
+
handler: p
|
|
61
61
|
};
|
|
62
|
-
l.register(
|
|
62
|
+
l.register(h), g.push(h.name);
|
|
63
63
|
}
|
|
64
64
|
}), () => {
|
|
65
|
-
for (const
|
|
65
|
+
for (const d of g) l.unregisterFunction(d);
|
|
66
66
|
};
|
|
67
|
-
}, [l, n]),
|
|
68
|
-
|
|
69
|
-
}, [l,
|
|
67
|
+
}, [l, n]), C(() => {
|
|
68
|
+
o === "auto" && l.enableAutoPageContext();
|
|
69
|
+
}, [l, o]), /* @__PURE__ */ s(z.Provider, {
|
|
70
70
|
value: l,
|
|
71
71
|
children: e
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
function T() {
|
|
75
|
-
const e = $(
|
|
75
|
+
const e = $(z);
|
|
76
76
|
if (!e) throw new Error('useAgoClient must be used within an <AgoProvider>. Wrap your component tree with <AgoProvider baseUrl="...">.');
|
|
77
77
|
return e;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return $(
|
|
79
|
+
function D() {
|
|
80
|
+
return $(z);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const r =
|
|
82
|
+
function U({ client: e, conversationId: t } = {}) {
|
|
83
|
+
const r = D(), n = e || r;
|
|
84
84
|
if (!n) throw new Error("useMessages requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
|
|
85
|
-
const [
|
|
86
|
-
|
|
87
|
-
t && t !==
|
|
85
|
+
const [o, i] = I([]), [c, l] = I(t), [g, d] = I(!1), [y, p] = I(null);
|
|
86
|
+
C(() => {
|
|
87
|
+
t && t !== c && (l(t), x(t));
|
|
88
88
|
}, [t]);
|
|
89
|
-
const
|
|
89
|
+
const x = async (h) => {
|
|
90
90
|
try {
|
|
91
|
-
i(await n.getMessages(
|
|
92
|
-
} catch (
|
|
93
|
-
m
|
|
91
|
+
i((await n.getMessages(h)).filter((m) => !m.hidden));
|
|
92
|
+
} catch (m) {
|
|
93
|
+
p(m instanceof Error ? m : /* @__PURE__ */ new Error("Failed to load messages"));
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
return
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
i((
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
...
|
|
104
|
-
content:
|
|
105
|
-
}] :
|
|
96
|
+
return C(() => {
|
|
97
|
+
const h = (f) => {
|
|
98
|
+
c || l(f.conversationId);
|
|
99
|
+
}, m = (f) => {
|
|
100
|
+
i((u) => {
|
|
101
|
+
const w = u[u.length - 1];
|
|
102
|
+
return w && w.id === f.messageId ? [...u.slice(0, -1), {
|
|
103
|
+
...w,
|
|
104
|
+
content: w.content + f.content
|
|
105
|
+
}] : u;
|
|
106
106
|
});
|
|
107
|
-
}, v = (
|
|
108
|
-
i((
|
|
109
|
-
let
|
|
110
|
-
for (let
|
|
111
|
-
|
|
107
|
+
}, v = (f) => {
|
|
108
|
+
i((u) => {
|
|
109
|
+
let w = -1;
|
|
110
|
+
for (let k = u.length - 1; k >= 0; k--) if (u[k].role === "assistant" && u[k].status === "IN_PROGRESS") {
|
|
111
|
+
w = k;
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
-
return
|
|
115
|
-
...
|
|
114
|
+
return w < 0 ? u : [
|
|
115
|
+
...u.slice(0, w),
|
|
116
116
|
{
|
|
117
|
-
...
|
|
118
|
-
...
|
|
117
|
+
...u[w],
|
|
118
|
+
...f
|
|
119
119
|
},
|
|
120
|
-
...
|
|
120
|
+
...u.slice(w + 1)
|
|
121
121
|
];
|
|
122
122
|
});
|
|
123
|
-
},
|
|
124
|
-
i((
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
...
|
|
128
|
-
|
|
129
|
-
...
|
|
130
|
-
] : [...
|
|
131
|
-
}),
|
|
132
|
-
},
|
|
133
|
-
|
|
123
|
+
}, b = (f) => {
|
|
124
|
+
i((u) => {
|
|
125
|
+
const w = u.findIndex((k) => k.id === f.id);
|
|
126
|
+
return w >= 0 ? [
|
|
127
|
+
...u.slice(0, w),
|
|
128
|
+
f,
|
|
129
|
+
...u.slice(w + 1)
|
|
130
|
+
] : [...u, f];
|
|
131
|
+
}), d(!1);
|
|
132
|
+
}, a = (f) => {
|
|
133
|
+
p(new Error(f.error)), d(!1);
|
|
134
134
|
};
|
|
135
|
-
return n.on("message:start",
|
|
136
|
-
n.off("message:start",
|
|
135
|
+
return n.on("message:start", h), n.on("message:chunk", m), n.on("message:answer-complete", v), n.on("message:complete", b), n.on("message:error", a), () => {
|
|
136
|
+
n.off("message:start", h), n.off("message:chunk", m), n.off("message:answer-complete", v), n.off("message:complete", b), n.off("message:error", a);
|
|
137
137
|
};
|
|
138
|
-
}, [n,
|
|
139
|
-
messages:
|
|
140
|
-
isLoading:
|
|
141
|
-
error:
|
|
142
|
-
sendMessage: R(async (
|
|
143
|
-
|
|
138
|
+
}, [n, c]), {
|
|
139
|
+
messages: o,
|
|
140
|
+
isLoading: g,
|
|
141
|
+
error: y,
|
|
142
|
+
sendMessage: R(async (h, m) => {
|
|
143
|
+
d(!0), p(null);
|
|
144
144
|
const v = {
|
|
145
145
|
id: `temp-${Date.now()}`,
|
|
146
|
-
conversationId:
|
|
147
|
-
content:
|
|
146
|
+
conversationId: c || "",
|
|
147
|
+
content: h,
|
|
148
148
|
role: "user",
|
|
149
149
|
status: "DONE",
|
|
150
|
-
attachments:
|
|
150
|
+
attachments: m && m.length > 0 ? G(m) : void 0,
|
|
151
151
|
createdAt: /* @__PURE__ */ new Date()
|
|
152
|
-
},
|
|
152
|
+
}, b = {
|
|
153
153
|
id: `temp-assistant-${Date.now()}`,
|
|
154
|
-
conversationId:
|
|
154
|
+
conversationId: c || "",
|
|
155
155
|
content: "",
|
|
156
156
|
role: "assistant",
|
|
157
157
|
status: "IN_PROGRESS",
|
|
158
158
|
createdAt: /* @__PURE__ */ new Date()
|
|
159
159
|
};
|
|
160
|
-
i((
|
|
161
|
-
...
|
|
160
|
+
i((a) => [
|
|
161
|
+
...a,
|
|
162
162
|
v,
|
|
163
|
-
|
|
163
|
+
b
|
|
164
164
|
]);
|
|
165
165
|
try {
|
|
166
|
-
const
|
|
167
|
-
conversationId:
|
|
168
|
-
files:
|
|
166
|
+
const a = await n.sendMessage(h, {
|
|
167
|
+
conversationId: c,
|
|
168
|
+
files: m
|
|
169
169
|
});
|
|
170
|
-
return
|
|
171
|
-
const
|
|
170
|
+
return a.conversationId && !c && l(a.conversationId), i((f) => {
|
|
171
|
+
const u = f.filter((k) => !k.id.startsWith("temp-")), w = {
|
|
172
172
|
...v,
|
|
173
173
|
id: v.id.replace("temp-", "user-"),
|
|
174
|
-
conversationId:
|
|
174
|
+
conversationId: a.conversationId
|
|
175
175
|
};
|
|
176
|
-
return
|
|
177
|
-
...
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
return u.some((k) => k.id === a.id) ? [...u, w].sort((k, _) => new Date(k.createdAt).getTime() - new Date(_.createdAt).getTime()) : [
|
|
177
|
+
...u,
|
|
178
|
+
w,
|
|
179
|
+
a
|
|
180
180
|
];
|
|
181
|
-
}),
|
|
182
|
-
} catch (
|
|
183
|
-
return
|
|
181
|
+
}), a;
|
|
182
|
+
} catch (a) {
|
|
183
|
+
return p(a instanceof Error ? a : /* @__PURE__ */ new Error("Failed to send message")), d(!1), i((f) => f.filter((u) => !u.id.startsWith("temp-"))), null;
|
|
184
184
|
}
|
|
185
|
-
}, [n,
|
|
185
|
+
}, [n, c]),
|
|
186
186
|
clearMessages: R(() => {
|
|
187
|
-
i([]), l(void 0),
|
|
187
|
+
i([]), l(void 0), p(null);
|
|
188
188
|
}, []),
|
|
189
|
-
conversationId:
|
|
189
|
+
conversationId: c
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
var
|
|
193
|
-
const [i,
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
}, []),
|
|
199
|
-
|
|
192
|
+
var se = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", allowFiles: n = !1, className: o = "" }) => {
|
|
193
|
+
const [i, c] = I(""), [l, g] = I([]), d = A(null), y = A(null), p = R(() => {
|
|
194
|
+
const a = y.current;
|
|
195
|
+
if (!a) return;
|
|
196
|
+
const f = 110;
|
|
197
|
+
a.style.height = "auto", a.style.height = `${Math.min(a.scrollHeight + 2, f)}px`, a.style.overflowY = a.scrollHeight + 2 > f ? "auto" : "hidden";
|
|
198
|
+
}, []), x = R((a) => {
|
|
199
|
+
a.preventDefault(), (i.trim() || l.length > 0) && (e(i.trim(), l.length > 0 ? l : void 0), c(""), g([]), requestAnimationFrame(p));
|
|
200
200
|
}, [
|
|
201
201
|
i,
|
|
202
202
|
l,
|
|
203
203
|
e,
|
|
204
|
-
|
|
205
|
-
]),
|
|
206
|
-
|
|
207
|
-
}, [
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
}, []), v = R((
|
|
211
|
-
|
|
212
|
-
}, []),
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
onSubmit:
|
|
215
|
-
className: `ago-chat-input ${
|
|
204
|
+
p
|
|
205
|
+
]), h = R((a) => {
|
|
206
|
+
a.key === "Enter" && !a.shiftKey && (a.preventDefault(), x(a));
|
|
207
|
+
}, [x]), m = R((a) => {
|
|
208
|
+
const f = Array.from(a.target.files || []);
|
|
209
|
+
g((u) => [...u, ...f]);
|
|
210
|
+
}, []), v = R((a) => {
|
|
211
|
+
g((f) => f.filter((u, w) => w !== a));
|
|
212
|
+
}, []), b = i.trim() || l.length > 0;
|
|
213
|
+
return /* @__PURE__ */ M("form", {
|
|
214
|
+
onSubmit: x,
|
|
215
|
+
className: `ago-chat-input ${o}`,
|
|
216
216
|
style: {
|
|
217
217
|
display: "flex",
|
|
218
218
|
flexDirection: "column",
|
|
@@ -221,14 +221,14 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
221
221
|
borderTop: "1px solid #dee3e8",
|
|
222
222
|
backgroundColor: "#fff"
|
|
223
223
|
},
|
|
224
|
-
children: [l.length > 0 && /* @__PURE__ */
|
|
224
|
+
children: [l.length > 0 && /* @__PURE__ */ s("div", {
|
|
225
225
|
className: "ago-chat-input__files",
|
|
226
226
|
style: {
|
|
227
227
|
display: "flex",
|
|
228
228
|
flexWrap: "wrap",
|
|
229
229
|
gap: "6px"
|
|
230
230
|
},
|
|
231
|
-
children: l.map((
|
|
231
|
+
children: l.map((a, f) => /* @__PURE__ */ M("div", {
|
|
232
232
|
style: {
|
|
233
233
|
display: "flex",
|
|
234
234
|
alignItems: "center",
|
|
@@ -239,18 +239,18 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
239
239
|
fontSize: "12px",
|
|
240
240
|
color: "#30373e"
|
|
241
241
|
},
|
|
242
|
-
children: [/* @__PURE__ */
|
|
242
|
+
children: [/* @__PURE__ */ s("span", {
|
|
243
243
|
style: {
|
|
244
244
|
maxWidth: "120px",
|
|
245
245
|
overflow: "hidden",
|
|
246
246
|
textOverflow: "ellipsis",
|
|
247
247
|
whiteSpace: "nowrap"
|
|
248
248
|
},
|
|
249
|
-
children:
|
|
250
|
-
}), /* @__PURE__ */
|
|
249
|
+
children: a.name
|
|
250
|
+
}), /* @__PURE__ */ s("button", {
|
|
251
251
|
type: "button",
|
|
252
|
-
onClick: () => v(
|
|
253
|
-
"aria-label": `Remove ${
|
|
252
|
+
onClick: () => v(f),
|
|
253
|
+
"aria-label": `Remove ${a.name}`,
|
|
254
254
|
style: {
|
|
255
255
|
border: "none",
|
|
256
256
|
background: "none",
|
|
@@ -262,17 +262,17 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
262
262
|
},
|
|
263
263
|
children: "×"
|
|
264
264
|
})]
|
|
265
|
-
},
|
|
266
|
-
}), /* @__PURE__ */
|
|
265
|
+
}, f))
|
|
266
|
+
}), /* @__PURE__ */ M("div", {
|
|
267
267
|
style: {
|
|
268
268
|
display: "flex",
|
|
269
269
|
gap: "8px",
|
|
270
270
|
alignItems: "flex-end"
|
|
271
271
|
},
|
|
272
272
|
children: [
|
|
273
|
-
n && /* @__PURE__ */
|
|
273
|
+
n && /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ s("button", {
|
|
274
274
|
type: "button",
|
|
275
|
-
onClick: () =>
|
|
275
|
+
onClick: () => d.current?.click(),
|
|
276
276
|
disabled: t,
|
|
277
277
|
"aria-label": "Attach file",
|
|
278
278
|
style: {
|
|
@@ -286,20 +286,20 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
286
286
|
lineHeight: 1
|
|
287
287
|
},
|
|
288
288
|
children: "+"
|
|
289
|
-
}), /* @__PURE__ */
|
|
290
|
-
ref:
|
|
289
|
+
}), /* @__PURE__ */ s("input", {
|
|
290
|
+
ref: d,
|
|
291
291
|
type: "file",
|
|
292
292
|
multiple: !0,
|
|
293
|
-
onChange:
|
|
293
|
+
onChange: m,
|
|
294
294
|
style: { display: "none" }
|
|
295
295
|
})] }),
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
ref:
|
|
296
|
+
/* @__PURE__ */ s("textarea", {
|
|
297
|
+
ref: y,
|
|
298
298
|
value: i,
|
|
299
|
-
onChange: (
|
|
300
|
-
|
|
299
|
+
onChange: (a) => {
|
|
300
|
+
c(a.target.value), p();
|
|
301
301
|
},
|
|
302
|
-
onKeyDown:
|
|
302
|
+
onKeyDown: h,
|
|
303
303
|
placeholder: r,
|
|
304
304
|
"aria-label": r,
|
|
305
305
|
disabled: t,
|
|
@@ -321,23 +321,23 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
321
321
|
backgroundColor: "#f8f8f8",
|
|
322
322
|
transition: "border-color 0.15s"
|
|
323
323
|
},
|
|
324
|
-
onFocus: (
|
|
325
|
-
|
|
324
|
+
onFocus: (a) => {
|
|
325
|
+
a.currentTarget.style.borderColor = "#1b5fc4";
|
|
326
326
|
},
|
|
327
|
-
onBlur: (
|
|
328
|
-
|
|
327
|
+
onBlur: (a) => {
|
|
328
|
+
a.currentTarget.style.borderColor = "#dee3e8";
|
|
329
329
|
}
|
|
330
330
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ s("button", {
|
|
332
332
|
type: "submit",
|
|
333
|
-
disabled: t || !
|
|
333
|
+
disabled: t || !b,
|
|
334
334
|
style: {
|
|
335
335
|
padding: "10px 18px",
|
|
336
336
|
border: "none",
|
|
337
337
|
borderRadius: "20px",
|
|
338
|
-
backgroundColor: t || !
|
|
338
|
+
backgroundColor: t || !b ? "#b5bfc8" : "#03182f",
|
|
339
339
|
color: "#fff",
|
|
340
|
-
cursor: t || !
|
|
340
|
+
cursor: t || !b ? "not-allowed" : "pointer",
|
|
341
341
|
fontWeight: 500,
|
|
342
342
|
fontSize: "16px",
|
|
343
343
|
transition: "background-color 0.15s"
|
|
@@ -347,7 +347,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
347
347
|
]
|
|
348
348
|
})]
|
|
349
349
|
});
|
|
350
|
-
},
|
|
350
|
+
}, ie = ({ href: e, children: t, ...r }) => /* @__PURE__ */ s("a", {
|
|
351
351
|
href: e,
|
|
352
352
|
target: "_blank",
|
|
353
353
|
rel: "noopener noreferrer",
|
|
@@ -357,25 +357,25 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
357
357
|
},
|
|
358
358
|
...r,
|
|
359
359
|
children: t
|
|
360
|
-
}),
|
|
360
|
+
}), le = ({ children: e, ...t }) => /* @__PURE__ */ s("p", {
|
|
361
361
|
style: {
|
|
362
362
|
margin: "0 0 8px 0",
|
|
363
363
|
lineHeight: "1.6"
|
|
364
364
|
},
|
|
365
365
|
...t,
|
|
366
366
|
children: e
|
|
367
|
-
}),
|
|
368
|
-
const r = ({ children: n, ...
|
|
367
|
+
}), P = (e, t) => {
|
|
368
|
+
const r = ({ children: n, ...o }) => Z.createElement(`h${e}`, {
|
|
369
369
|
style: {
|
|
370
370
|
margin: "16px 0 8px 0",
|
|
371
371
|
fontSize: t,
|
|
372
372
|
fontWeight: 600,
|
|
373
373
|
lineHeight: "1.3"
|
|
374
374
|
},
|
|
375
|
-
...
|
|
375
|
+
...o
|
|
376
376
|
}, n);
|
|
377
377
|
return r.displayName = `MarkdownHeading${e}`, r;
|
|
378
|
-
},
|
|
378
|
+
}, ce = ({ children: e, ...t }) => /* @__PURE__ */ s("ul", {
|
|
379
379
|
style: {
|
|
380
380
|
margin: "0 0 8px 0",
|
|
381
381
|
paddingLeft: "20px",
|
|
@@ -384,7 +384,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
384
384
|
},
|
|
385
385
|
...t,
|
|
386
386
|
children: e
|
|
387
|
-
}), de = ({ children: e, ...t }) => /* @__PURE__ */
|
|
387
|
+
}), de = ({ children: e, ...t }) => /* @__PURE__ */ s("ol", {
|
|
388
388
|
style: {
|
|
389
389
|
margin: "0 0 8px 0",
|
|
390
390
|
paddingLeft: "20px",
|
|
@@ -393,7 +393,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
393
393
|
},
|
|
394
394
|
...t,
|
|
395
395
|
children: e
|
|
396
|
-
}),
|
|
396
|
+
}), ue = ({ children: e, ...t }) => /* @__PURE__ */ s("li", {
|
|
397
397
|
style: {
|
|
398
398
|
display: "list-item",
|
|
399
399
|
margin: "2px 0",
|
|
@@ -401,8 +401,8 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
401
401
|
},
|
|
402
402
|
...t,
|
|
403
403
|
children: e
|
|
404
|
-
}),
|
|
405
|
-
`) ? /* @__PURE__ */
|
|
404
|
+
}), fe = ({ className: e, children: t, ...r }) => e !== void 0 || String(t).includes(`
|
|
405
|
+
`) ? /* @__PURE__ */ s("code", {
|
|
406
406
|
style: {
|
|
407
407
|
display: "block",
|
|
408
408
|
background: "#f5f5f5",
|
|
@@ -414,7 +414,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
414
414
|
},
|
|
415
415
|
...r,
|
|
416
416
|
children: t
|
|
417
|
-
}) : /* @__PURE__ */
|
|
417
|
+
}) : /* @__PURE__ */ s("code", {
|
|
418
418
|
style: {
|
|
419
419
|
background: "#f0f2f5",
|
|
420
420
|
padding: "2px 5px",
|
|
@@ -424,11 +424,11 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
424
424
|
},
|
|
425
425
|
...r,
|
|
426
426
|
children: t
|
|
427
|
-
}),
|
|
427
|
+
}), ge = ({ children: e, ...t }) => /* @__PURE__ */ s("pre", {
|
|
428
428
|
style: { margin: "0 0 8px 0" },
|
|
429
429
|
...t,
|
|
430
430
|
children: e
|
|
431
|
-
}),
|
|
431
|
+
}), pe = ({ children: e, ...t }) => /* @__PURE__ */ s("blockquote", {
|
|
432
432
|
style: {
|
|
433
433
|
borderLeft: "4px solid #dee3e8",
|
|
434
434
|
paddingLeft: "12px",
|
|
@@ -438,12 +438,12 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
438
438
|
},
|
|
439
439
|
...t,
|
|
440
440
|
children: e
|
|
441
|
-
}),
|
|
441
|
+
}), me = ({ children: e, ...t }) => /* @__PURE__ */ s("div", {
|
|
442
442
|
style: {
|
|
443
443
|
overflowX: "auto",
|
|
444
444
|
margin: "0 0 8px 0"
|
|
445
445
|
},
|
|
446
|
-
children: /* @__PURE__ */
|
|
446
|
+
children: /* @__PURE__ */ s("table", {
|
|
447
447
|
style: {
|
|
448
448
|
borderCollapse: "collapse",
|
|
449
449
|
width: "100%",
|
|
@@ -452,7 +452,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
452
452
|
...t,
|
|
453
453
|
children: e
|
|
454
454
|
})
|
|
455
|
-
}),
|
|
455
|
+
}), he = ({ children: e, ...t }) => /* @__PURE__ */ s("th", {
|
|
456
456
|
style: {
|
|
457
457
|
border: "1px solid #dee3e8",
|
|
458
458
|
padding: "6px 10px",
|
|
@@ -462,14 +462,14 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
462
462
|
},
|
|
463
463
|
...t,
|
|
464
464
|
children: e
|
|
465
|
-
}), xe = ({ children: e, ...t }) => /* @__PURE__ */
|
|
465
|
+
}), xe = ({ children: e, ...t }) => /* @__PURE__ */ s("td", {
|
|
466
466
|
style: {
|
|
467
467
|
border: "1px solid #dee3e8",
|
|
468
468
|
padding: "6px 10px"
|
|
469
469
|
},
|
|
470
470
|
...t,
|
|
471
471
|
children: e
|
|
472
|
-
}),
|
|
472
|
+
}), ye = ({ alt: e, ...t }) => /* @__PURE__ */ s("img", {
|
|
473
473
|
alt: e ?? "",
|
|
474
474
|
style: {
|
|
475
475
|
maxWidth: "100%",
|
|
@@ -477,40 +477,40 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
477
477
|
margin: "4px 0"
|
|
478
478
|
},
|
|
479
479
|
...t
|
|
480
|
-
}),
|
|
480
|
+
}), be = (e) => /* @__PURE__ */ s("hr", {
|
|
481
481
|
style: {
|
|
482
482
|
border: "none",
|
|
483
483
|
borderTop: "1px solid #dee3e8",
|
|
484
484
|
margin: "12px 0"
|
|
485
485
|
},
|
|
486
486
|
...e
|
|
487
|
-
}),
|
|
488
|
-
a:
|
|
489
|
-
p:
|
|
490
|
-
h1:
|
|
491
|
-
h2:
|
|
492
|
-
h3:
|
|
493
|
-
h4:
|
|
494
|
-
h5:
|
|
495
|
-
h6:
|
|
496
|
-
ul:
|
|
487
|
+
}), ve = {
|
|
488
|
+
a: ie,
|
|
489
|
+
p: le,
|
|
490
|
+
h1: P(1, "20px"),
|
|
491
|
+
h2: P(2, "18px"),
|
|
492
|
+
h3: P(3, "16px"),
|
|
493
|
+
h4: P(4, "15px"),
|
|
494
|
+
h5: P(5, "14px"),
|
|
495
|
+
h6: P(6, "13px"),
|
|
496
|
+
ul: ce,
|
|
497
497
|
ol: de,
|
|
498
|
-
li:
|
|
499
|
-
code:
|
|
500
|
-
pre:
|
|
501
|
-
blockquote:
|
|
502
|
-
table:
|
|
503
|
-
th:
|
|
498
|
+
li: ue,
|
|
499
|
+
code: fe,
|
|
500
|
+
pre: ge,
|
|
501
|
+
blockquote: pe,
|
|
502
|
+
table: me,
|
|
503
|
+
th: he,
|
|
504
504
|
td: xe,
|
|
505
|
-
img:
|
|
506
|
-
hr:
|
|
507
|
-
},
|
|
508
|
-
remarkPlugins:
|
|
509
|
-
components:
|
|
505
|
+
img: ye,
|
|
506
|
+
hr: be
|
|
507
|
+
}, we = [oe], Se = ({ content: e }) => /* @__PURE__ */ s(re, {
|
|
508
|
+
remarkPlugins: we,
|
|
509
|
+
components: ve,
|
|
510
510
|
children: e
|
|
511
511
|
}), Ce = ({ attachment: e, isUser: t }) => {
|
|
512
|
-
const r =
|
|
513
|
-
if (
|
|
512
|
+
const r = Y(e.url);
|
|
513
|
+
if (j(e)) return /* @__PURE__ */ s("a", {
|
|
514
514
|
href: r,
|
|
515
515
|
target: "_blank",
|
|
516
516
|
rel: "noopener noreferrer",
|
|
@@ -518,7 +518,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
518
518
|
display: "inline-block",
|
|
519
519
|
textDecoration: "none"
|
|
520
520
|
},
|
|
521
|
-
children: /* @__PURE__ */
|
|
521
|
+
children: /* @__PURE__ */ s("img", {
|
|
522
522
|
src: r,
|
|
523
523
|
alt: e.name,
|
|
524
524
|
loading: "lazy",
|
|
@@ -532,7 +532,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
532
532
|
}
|
|
533
533
|
})
|
|
534
534
|
});
|
|
535
|
-
const n =
|
|
535
|
+
const n = V(e.fileSize), o = /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ s("span", {
|
|
536
536
|
style: {
|
|
537
537
|
fontSize: "16px",
|
|
538
538
|
lineHeight: 1,
|
|
@@ -540,13 +540,13 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
540
540
|
},
|
|
541
541
|
"aria-hidden": !0,
|
|
542
542
|
children: "📄"
|
|
543
|
-
}), /* @__PURE__ */
|
|
543
|
+
}), /* @__PURE__ */ M("span", {
|
|
544
544
|
style: {
|
|
545
545
|
display: "flex",
|
|
546
546
|
flexDirection: "column",
|
|
547
547
|
minWidth: 0
|
|
548
548
|
},
|
|
549
|
-
children: [/* @__PURE__ */
|
|
549
|
+
children: [/* @__PURE__ */ s("span", {
|
|
550
550
|
style: {
|
|
551
551
|
overflow: "hidden",
|
|
552
552
|
textOverflow: "ellipsis",
|
|
@@ -555,7 +555,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
555
555
|
},
|
|
556
556
|
title: e.name,
|
|
557
557
|
children: e.name
|
|
558
|
-
}), n && /* @__PURE__ */
|
|
558
|
+
}), n && /* @__PURE__ */ s("span", {
|
|
559
559
|
style: {
|
|
560
560
|
fontSize: "11px",
|
|
561
561
|
color: "#6b6d6f"
|
|
@@ -575,18 +575,18 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
575
575
|
textDecoration: "none",
|
|
576
576
|
maxWidth: "220px"
|
|
577
577
|
};
|
|
578
|
-
return r ? /* @__PURE__ */
|
|
578
|
+
return r ? /* @__PURE__ */ s("a", {
|
|
579
579
|
href: r,
|
|
580
580
|
target: "_blank",
|
|
581
581
|
rel: "noopener noreferrer",
|
|
582
582
|
style: i,
|
|
583
|
-
children:
|
|
584
|
-
}) : /* @__PURE__ */
|
|
583
|
+
children: o
|
|
584
|
+
}) : /* @__PURE__ */ s("div", {
|
|
585
585
|
style: i,
|
|
586
|
-
children:
|
|
586
|
+
children: o
|
|
587
587
|
});
|
|
588
|
-
},
|
|
589
|
-
const r = /* @__PURE__ */
|
|
588
|
+
}, ke = ({ source: e, index: t }) => {
|
|
589
|
+
const r = /* @__PURE__ */ M("div", {
|
|
590
590
|
style: {
|
|
591
591
|
display: "flex",
|
|
592
592
|
alignItems: "center",
|
|
@@ -594,7 +594,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
594
594
|
width: "100%",
|
|
595
595
|
minWidth: 0
|
|
596
596
|
},
|
|
597
|
-
children: [/* @__PURE__ */
|
|
597
|
+
children: [/* @__PURE__ */ s("div", {
|
|
598
598
|
style: {
|
|
599
599
|
flexShrink: 0,
|
|
600
600
|
width: "18px",
|
|
@@ -610,7 +610,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
610
610
|
backgroundColor: "#f0f4ff"
|
|
611
611
|
},
|
|
612
612
|
children: t + 1
|
|
613
|
-
}), /* @__PURE__ */
|
|
613
|
+
}), /* @__PURE__ */ s("div", {
|
|
614
614
|
style: {
|
|
615
615
|
fontSize: "12px",
|
|
616
616
|
overflow: "hidden",
|
|
@@ -634,23 +634,23 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
634
634
|
minWidth: 0,
|
|
635
635
|
transition: "border-color 0.15s"
|
|
636
636
|
};
|
|
637
|
-
return e.url ? /* @__PURE__ */
|
|
637
|
+
return e.url ? /* @__PURE__ */ s("a", {
|
|
638
638
|
href: e.url,
|
|
639
639
|
target: "_blank",
|
|
640
640
|
rel: "noopener noreferrer",
|
|
641
641
|
style: n,
|
|
642
|
-
onMouseEnter: (
|
|
643
|
-
|
|
642
|
+
onMouseEnter: (o) => {
|
|
643
|
+
o.currentTarget.style.borderColor = "#1b5fc4";
|
|
644
644
|
},
|
|
645
|
-
onMouseLeave: (
|
|
646
|
-
|
|
645
|
+
onMouseLeave: (o) => {
|
|
646
|
+
o.currentTarget.style.borderColor = "#dee3e8";
|
|
647
647
|
},
|
|
648
648
|
children: r
|
|
649
|
-
}) : /* @__PURE__ */
|
|
649
|
+
}) : /* @__PURE__ */ s("div", {
|
|
650
650
|
style: n,
|
|
651
651
|
children: r
|
|
652
652
|
});
|
|
653
|
-
},
|
|
653
|
+
}, Ie = () => /* @__PURE__ */ M("div", {
|
|
654
654
|
style: {
|
|
655
655
|
display: "flex",
|
|
656
656
|
gap: "4px",
|
|
@@ -660,22 +660,22 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
660
660
|
0,
|
|
661
661
|
1,
|
|
662
662
|
2
|
|
663
|
-
].map((e) => /* @__PURE__ */
|
|
663
|
+
].map((e) => /* @__PURE__ */ s("div", { style: {
|
|
664
664
|
width: "6px",
|
|
665
665
|
height: "6px",
|
|
666
666
|
borderRadius: "50%",
|
|
667
667
|
backgroundColor: "#b5bfc8",
|
|
668
668
|
animation: "ago-pulse 1.2s ease-in-out infinite",
|
|
669
669
|
animationDelay: `${e * 0.2}s`
|
|
670
|
-
} }, e)), /* @__PURE__ */
|
|
670
|
+
} }, e)), /* @__PURE__ */ s("style", { children: `
|
|
671
671
|
@keyframes ago-pulse {
|
|
672
672
|
0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
|
|
673
673
|
40% { opacity: 1; transform: scale(1); }
|
|
674
674
|
}
|
|
675
675
|
` })]
|
|
676
|
-
}), Me = ({ message: e, className: t = "", showAgentName: r = !1, isLast: n = !1, onFollowUpClick:
|
|
677
|
-
const i = e.role === "user",
|
|
678
|
-
return /* @__PURE__ */
|
|
676
|
+
}), Me = ({ message: e, className: t = "", showAgentName: r = !1, isLast: n = !1, onFollowUpClick: o }) => {
|
|
677
|
+
const i = e.role === "user", c = e.status === "IN_PROGRESS";
|
|
678
|
+
return /* @__PURE__ */ M("div", {
|
|
679
679
|
className: `ago-message ago-message--${e.role} ${t}`,
|
|
680
680
|
style: {
|
|
681
681
|
display: "flex",
|
|
@@ -684,7 +684,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
684
684
|
marginBottom: "16px"
|
|
685
685
|
},
|
|
686
686
|
children: [
|
|
687
|
-
!i && r && e.agent && /* @__PURE__ */
|
|
687
|
+
!i && r && e.agent && /* @__PURE__ */ s("div", {
|
|
688
688
|
className: "ago-message__agent",
|
|
689
689
|
style: {
|
|
690
690
|
display: "flex",
|
|
@@ -698,7 +698,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
698
698
|
},
|
|
699
699
|
children: e.agent.displayName || e.agent.name
|
|
700
700
|
}),
|
|
701
|
-
!i && e.sources && e.sources.length > 0 && /* @__PURE__ */
|
|
701
|
+
!i && e.sources && e.sources.length > 0 && /* @__PURE__ */ s("div", {
|
|
702
702
|
className: "ago-message__sources",
|
|
703
703
|
style: {
|
|
704
704
|
display: "grid",
|
|
@@ -708,12 +708,12 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
708
708
|
width: "100%",
|
|
709
709
|
maxWidth: "85%"
|
|
710
710
|
},
|
|
711
|
-
children: e.sources.map((l,
|
|
711
|
+
children: e.sources.map((l, g) => /* @__PURE__ */ s(ke, {
|
|
712
712
|
source: l,
|
|
713
|
-
index:
|
|
713
|
+
index: g
|
|
714
714
|
}, l.id))
|
|
715
715
|
}),
|
|
716
|
-
e.attachments && e.attachments.length > 0 && /* @__PURE__ */
|
|
716
|
+
e.attachments && e.attachments.length > 0 && /* @__PURE__ */ s("div", {
|
|
717
717
|
className: "ago-message__attachments",
|
|
718
718
|
style: {
|
|
719
719
|
display: "flex",
|
|
@@ -723,12 +723,12 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
723
723
|
justifyContent: i ? "flex-end" : "flex-start",
|
|
724
724
|
maxWidth: "75%"
|
|
725
725
|
},
|
|
726
|
-
children: e.attachments.map((l) => /* @__PURE__ */
|
|
726
|
+
children: e.attachments.map((l) => /* @__PURE__ */ s(Ce, {
|
|
727
727
|
attachment: l,
|
|
728
728
|
isUser: i
|
|
729
729
|
}, l.id))
|
|
730
730
|
}),
|
|
731
|
-
(e.content ||
|
|
731
|
+
(e.content || c) && /* @__PURE__ */ s("div", {
|
|
732
732
|
className: "ago-message__content",
|
|
733
733
|
style: {
|
|
734
734
|
maxWidth: i ? "75%" : "100%",
|
|
@@ -740,9 +740,9 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
740
740
|
fontSize: "16px",
|
|
741
741
|
lineHeight: "1.6"
|
|
742
742
|
},
|
|
743
|
-
children: e.content ? /* @__PURE__ */
|
|
743
|
+
children: e.content ? /* @__PURE__ */ s(Se, { content: e.content }) : c && /* @__PURE__ */ s(Ie, {})
|
|
744
744
|
}),
|
|
745
|
-
n && e.followUpReplies && e.followUpReplies.length > 0 && /* @__PURE__ */
|
|
745
|
+
n && e.followUpReplies && e.followUpReplies.length > 0 && /* @__PURE__ */ s("div", {
|
|
746
746
|
className: "ago-message__followups",
|
|
747
747
|
style: {
|
|
748
748
|
display: "flex",
|
|
@@ -750,11 +750,11 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
750
750
|
gap: "8px",
|
|
751
751
|
marginTop: "10px"
|
|
752
752
|
},
|
|
753
|
-
children: e.followUpReplies.map((l,
|
|
753
|
+
children: e.followUpReplies.map((l, g) => /* @__PURE__ */ s("button", {
|
|
754
754
|
type: "button",
|
|
755
755
|
className: "ago-message__followup-btn",
|
|
756
|
-
disabled: !
|
|
757
|
-
onClick:
|
|
756
|
+
disabled: !o,
|
|
757
|
+
onClick: o ? () => o(l) : void 0,
|
|
758
758
|
style: {
|
|
759
759
|
minHeight: "36px",
|
|
760
760
|
padding: "6px 14px",
|
|
@@ -763,59 +763,59 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
763
763
|
border: "1px solid #dee3e8",
|
|
764
764
|
backgroundColor: "#fff",
|
|
765
765
|
color: "#30373e",
|
|
766
|
-
cursor:
|
|
766
|
+
cursor: o ? "pointer" : "default",
|
|
767
767
|
transition: "border-color 0.15s"
|
|
768
768
|
},
|
|
769
|
-
onMouseEnter: (
|
|
770
|
-
|
|
769
|
+
onMouseEnter: (d) => {
|
|
770
|
+
d.currentTarget.style.borderColor = "#1b5fc4";
|
|
771
771
|
},
|
|
772
|
-
onMouseLeave: (
|
|
773
|
-
|
|
772
|
+
onMouseLeave: (d) => {
|
|
773
|
+
d.currentTarget.style.borderColor = "#dee3e8";
|
|
774
774
|
},
|
|
775
775
|
children: l
|
|
776
|
-
},
|
|
776
|
+
}, g))
|
|
777
777
|
})
|
|
778
778
|
]
|
|
779
779
|
});
|
|
780
|
-
},
|
|
781
|
-
const
|
|
780
|
+
}, Oe = ({ client: e, conversationId: t, title: r = "Chat", welcomeMessage: n = "Hello! How can I help you today?", placeholder: o = "Type a message...", allowFiles: i = !1, height: c = 500, logoUrl: l, showAgentName: g = !1, forms: d, onFollowUpClick: y, className: p = "", onMessageSent: x, onMessageReceived: h }) => {
|
|
781
|
+
const m = A(null), v = D(), b = e ?? v, { messages: a, isLoading: f, error: u, sendMessage: w } = U({
|
|
782
782
|
client: e,
|
|
783
783
|
conversationId: t
|
|
784
784
|
});
|
|
785
|
-
|
|
786
|
-
if (!
|
|
787
|
-
let
|
|
785
|
+
C(() => {
|
|
786
|
+
if (!b || !d || d.length === 0) return;
|
|
787
|
+
let S = !1;
|
|
788
788
|
const F = [];
|
|
789
|
-
return Promise.all(
|
|
790
|
-
if (!
|
|
791
|
-
for (const
|
|
789
|
+
return Promise.all(d.map((E) => E.schema != null ? Promise.resolve(O(E)) : H(b, E))).then((E) => {
|
|
790
|
+
if (!S)
|
|
791
|
+
for (const J of E) F.push(J.install(b));
|
|
792
792
|
}).catch(() => {
|
|
793
793
|
}), () => {
|
|
794
|
-
|
|
794
|
+
S = !0, F.forEach((E) => E());
|
|
795
795
|
};
|
|
796
|
-
}, [
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
])) : ""]),
|
|
802
|
-
|
|
803
|
-
}, [
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
id:
|
|
807
|
-
content:
|
|
796
|
+
}, [b, d ? JSON.stringify(d.map((S) => [
|
|
797
|
+
S.name,
|
|
798
|
+
S.schema ?? null,
|
|
799
|
+
S.submit ?? !1,
|
|
800
|
+
S.description ?? null
|
|
801
|
+
])) : ""]), C(() => {
|
|
802
|
+
m.current?.scrollIntoView({ behavior: "smooth" });
|
|
803
|
+
}, [a]), C(() => {
|
|
804
|
+
const S = a[a.length - 1];
|
|
805
|
+
S && S.role === "assistant" && S.status === "DONE" && h && h({
|
|
806
|
+
id: S.id,
|
|
807
|
+
content: S.content
|
|
808
808
|
});
|
|
809
|
-
}, [
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
},
|
|
813
|
-
return /* @__PURE__ */
|
|
814
|
-
className: `ago-chat-widget ${
|
|
809
|
+
}, [a, h]);
|
|
810
|
+
const k = async (S, F) => {
|
|
811
|
+
x?.(S), await w(S, F);
|
|
812
|
+
}, _ = a[a.length - 1], K = f && _?.role === "assistant" && _.status === "IN_PROGRESS", q = y === !1 ? void 0 : y ?? ((S) => k(S));
|
|
813
|
+
return /* @__PURE__ */ M("div", {
|
|
814
|
+
className: `ago-chat-widget ${p}`,
|
|
815
815
|
style: {
|
|
816
816
|
display: "flex",
|
|
817
817
|
flexDirection: "column",
|
|
818
|
-
height: typeof
|
|
818
|
+
height: typeof c == "number" ? `${c}px` : c,
|
|
819
819
|
border: "1px solid #dee3e8",
|
|
820
820
|
borderRadius: "16px",
|
|
821
821
|
overflow: "hidden",
|
|
@@ -825,7 +825,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
825
825
|
boxShadow: "rgba(15, 15, 15, 0.08) 0px 2px 16px 0px"
|
|
826
826
|
},
|
|
827
827
|
children: [
|
|
828
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ M("div", {
|
|
829
829
|
className: "ago-chat-widget__header",
|
|
830
830
|
style: {
|
|
831
831
|
padding: "14px 16px",
|
|
@@ -836,14 +836,14 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
836
836
|
alignItems: "center",
|
|
837
837
|
gap: "10px"
|
|
838
838
|
},
|
|
839
|
-
children: [l && /* @__PURE__ */
|
|
839
|
+
children: [l && /* @__PURE__ */ s("img", {
|
|
840
840
|
src: l,
|
|
841
841
|
alt: "Logo",
|
|
842
842
|
style: {
|
|
843
843
|
height: "24px",
|
|
844
844
|
width: "auto"
|
|
845
845
|
}
|
|
846
|
-
}), /* @__PURE__ */
|
|
846
|
+
}), /* @__PURE__ */ s("h3", {
|
|
847
847
|
style: {
|
|
848
848
|
margin: 0,
|
|
849
849
|
fontSize: "15px",
|
|
@@ -852,7 +852,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
852
852
|
children: r
|
|
853
853
|
})]
|
|
854
854
|
}),
|
|
855
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ M("div", {
|
|
856
856
|
className: "ago-chat-widget__messages",
|
|
857
857
|
role: "log",
|
|
858
858
|
"aria-live": "polite",
|
|
@@ -865,7 +865,7 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
865
865
|
backgroundColor: "#fbfbfb"
|
|
866
866
|
},
|
|
867
867
|
children: [
|
|
868
|
-
|
|
868
|
+
a.length === 0 ? /* @__PURE__ */ s("div", {
|
|
869
869
|
style: {
|
|
870
870
|
textAlign: "center",
|
|
871
871
|
color: "#6b6d6f",
|
|
@@ -874,13 +874,13 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
874
874
|
lineHeight: "1.5"
|
|
875
875
|
},
|
|
876
876
|
children: n
|
|
877
|
-
}) :
|
|
878
|
-
message:
|
|
879
|
-
showAgentName:
|
|
880
|
-
isLast: F ===
|
|
881
|
-
onFollowUpClick:
|
|
882
|
-
},
|
|
883
|
-
|
|
877
|
+
}) : a.map((S, F) => /* @__PURE__ */ s(Me, {
|
|
878
|
+
message: S,
|
|
879
|
+
showAgentName: g,
|
|
880
|
+
isLast: F === a.length - 1,
|
|
881
|
+
onFollowUpClick: q
|
|
882
|
+
}, S.id)),
|
|
883
|
+
u && /* @__PURE__ */ s("div", {
|
|
884
884
|
role: "alert",
|
|
885
885
|
style: {
|
|
886
886
|
padding: "10px 14px",
|
|
@@ -891,90 +891,90 @@ var ae = ({ onSend: e, disabled: t = !1, placeholder: r = "Type a message...", a
|
|
|
891
891
|
fontSize: "13px",
|
|
892
892
|
border: "1px solid #fecaca"
|
|
893
893
|
},
|
|
894
|
-
children:
|
|
894
|
+
children: u.message
|
|
895
895
|
}),
|
|
896
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ s("div", { ref: m })
|
|
897
897
|
]
|
|
898
898
|
}),
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
onSend:
|
|
899
|
+
/* @__PURE__ */ s(se, {
|
|
900
|
+
onSend: k,
|
|
901
901
|
disabled: K,
|
|
902
|
-
placeholder:
|
|
902
|
+
placeholder: o,
|
|
903
903
|
allowFiles: i
|
|
904
904
|
})
|
|
905
905
|
]
|
|
906
906
|
});
|
|
907
907
|
};
|
|
908
|
-
function
|
|
909
|
-
const r =
|
|
908
|
+
function Re({ client: e, autoLoad: t = !0 } = {}) {
|
|
909
|
+
const r = D(), n = e || r;
|
|
910
910
|
if (!n) throw new Error("useConversation requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
|
|
911
|
-
const [
|
|
912
|
-
|
|
911
|
+
const [o, i] = I([]), [c, l] = I(null), [g, d] = I(!1), [y, p] = I(null), x = R(async () => {
|
|
912
|
+
d(!0), p(null);
|
|
913
913
|
try {
|
|
914
914
|
i(await n.getConversations());
|
|
915
915
|
} catch (v) {
|
|
916
|
-
|
|
916
|
+
p(v instanceof Error ? v : /* @__PURE__ */ new Error("Failed to load conversations"));
|
|
917
917
|
} finally {
|
|
918
|
-
|
|
918
|
+
d(!1);
|
|
919
919
|
}
|
|
920
|
-
}, [n]),
|
|
921
|
-
|
|
920
|
+
}, [n]), h = R(async (v) => {
|
|
921
|
+
d(!0), p(null);
|
|
922
922
|
try {
|
|
923
923
|
l(await n.getConversation(v));
|
|
924
|
-
} catch (
|
|
925
|
-
|
|
924
|
+
} catch (b) {
|
|
925
|
+
p(b instanceof Error ? b : /* @__PURE__ */ new Error("Failed to load conversation"));
|
|
926
926
|
} finally {
|
|
927
|
-
|
|
927
|
+
d(!1);
|
|
928
928
|
}
|
|
929
|
-
}, [n]),
|
|
929
|
+
}, [n]), m = R(() => {
|
|
930
930
|
l(null);
|
|
931
931
|
}, []);
|
|
932
|
-
return
|
|
933
|
-
t &&
|
|
934
|
-
}, [t,
|
|
935
|
-
conversations:
|
|
936
|
-
currentConversation:
|
|
937
|
-
isLoading:
|
|
938
|
-
error:
|
|
939
|
-
selectConversation:
|
|
940
|
-
startNewConversation:
|
|
941
|
-
refreshConversations:
|
|
932
|
+
return C(() => {
|
|
933
|
+
t && x();
|
|
934
|
+
}, [t, x]), {
|
|
935
|
+
conversations: o,
|
|
936
|
+
currentConversation: c,
|
|
937
|
+
isLoading: g,
|
|
938
|
+
error: y,
|
|
939
|
+
selectConversation: h,
|
|
940
|
+
startNewConversation: m,
|
|
941
|
+
refreshConversations: x
|
|
942
942
|
};
|
|
943
943
|
}
|
|
944
|
-
function
|
|
945
|
-
const t =
|
|
944
|
+
function $e(e = {}) {
|
|
945
|
+
const t = D(), r = e.client || t;
|
|
946
946
|
if (!r) throw new Error("useChat requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");
|
|
947
|
-
const n =
|
|
947
|
+
const n = U({
|
|
948
948
|
client: r,
|
|
949
949
|
conversationId: e.conversationId
|
|
950
|
-
}),
|
|
950
|
+
}), o = Re({
|
|
951
951
|
client: r,
|
|
952
952
|
autoLoad: e.autoLoad
|
|
953
953
|
});
|
|
954
954
|
return {
|
|
955
955
|
messages: n.messages,
|
|
956
956
|
isLoading: n.isLoading,
|
|
957
|
-
error: n.error ||
|
|
957
|
+
error: n.error || o.error,
|
|
958
958
|
sendMessage: n.sendMessage,
|
|
959
959
|
clearMessages: n.clearMessages,
|
|
960
960
|
conversationId: n.conversationId,
|
|
961
|
-
conversations:
|
|
962
|
-
currentConversation:
|
|
963
|
-
isConversationsLoading:
|
|
964
|
-
selectConversation:
|
|
965
|
-
startNewConversation:
|
|
966
|
-
refreshConversations:
|
|
961
|
+
conversations: o.conversations,
|
|
962
|
+
currentConversation: o.currentConversation,
|
|
963
|
+
isConversationsLoading: o.isLoading,
|
|
964
|
+
selectConversation: o.selectConversation,
|
|
965
|
+
startNewConversation: o.startNewConversation,
|
|
966
|
+
refreshConversations: o.refreshConversations
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
const r = T(), { name: n, description:
|
|
969
|
+
function Be(e, t) {
|
|
970
|
+
const r = T(), { name: n, description: o, parameters: i, handler: c } = typeof e == "string" ? {
|
|
971
971
|
name: e,
|
|
972
972
|
...t
|
|
973
|
-
} : e, l = A(
|
|
974
|
-
l.current =
|
|
975
|
-
const
|
|
976
|
-
return r.registerFunction(n,
|
|
977
|
-
description:
|
|
973
|
+
} : e, l = A(c);
|
|
974
|
+
l.current = c, C(() => {
|
|
975
|
+
const g = (d) => l.current(d);
|
|
976
|
+
return r.registerFunction(n, g, {
|
|
977
|
+
description: o,
|
|
978
978
|
parameters: i
|
|
979
979
|
}), () => {
|
|
980
980
|
r.unregisterFunction(n);
|
|
@@ -982,101 +982,177 @@ function $e(e, t) {
|
|
|
982
982
|
}, [
|
|
983
983
|
r,
|
|
984
984
|
n,
|
|
985
|
-
|
|
985
|
+
o,
|
|
986
986
|
i
|
|
987
987
|
]);
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function Ue(e, t) {
|
|
990
990
|
const r = T(), n = A(e);
|
|
991
|
-
n.current = e,
|
|
992
|
-
r.
|
|
991
|
+
n.current = e, C(() => (r.registerNavigationFunction((o) => n.current(o), t), () => {
|
|
992
|
+
r.unregisterNavigationFunction();
|
|
993
993
|
}), [r, t]);
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
const r = T(), n =
|
|
995
|
+
function Ke(e, t) {
|
|
996
|
+
const r = T(), n = t?.functionName ?? "setPageState", o = A(e);
|
|
997
|
+
o.current = e, C(() => {
|
|
998
|
+
const i = o.current.map((c) => {
|
|
999
|
+
const l = () => o.current.find((g) => g.name === c.name) ?? c;
|
|
1000
|
+
return {
|
|
1001
|
+
name: c.name,
|
|
1002
|
+
description: c.description,
|
|
1003
|
+
schema: c.schema,
|
|
1004
|
+
get: c.get ? () => l().get?.() : void 0,
|
|
1005
|
+
set: (g) => l().set(g)
|
|
1006
|
+
};
|
|
1007
|
+
});
|
|
1008
|
+
return r.registerPageStateFunction(i, { functionName: n }), () => {
|
|
1009
|
+
r.unregisterPageStateFunction(n);
|
|
1010
|
+
};
|
|
1011
|
+
}, [r, n]);
|
|
1012
|
+
}
|
|
1013
|
+
var Ae = "You have navigated the user to a new page. That page now exposes its editable state through the available setPageState function, and its current values in the page context. If the user's latest request also asked to change something on this page, call setPageState now to apply exactly those changes and nothing else. Otherwise, reply with a short confirmation only.";
|
|
1014
|
+
function L(e) {
|
|
1015
|
+
return {
|
|
1016
|
+
navigationFunctions: e?.navigationFunctions ?? ["navigateToPage"],
|
|
1017
|
+
pageStateFunctionName: e?.pageStateFunctionName ?? "setPageState",
|
|
1018
|
+
continuationPrompt: e?.continuationPrompt ?? Ae,
|
|
1019
|
+
maxDepth: e?.maxDepth ?? 1,
|
|
1020
|
+
readinessTimeoutMs: e?.readinessTimeoutMs ?? 4e3,
|
|
1021
|
+
settleMs: e?.settleMs ?? 150,
|
|
1022
|
+
enabled: e?.enabled ?? !0
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
function qe(e) {
|
|
1026
|
+
const t = T(), r = A(L(e));
|
|
1027
|
+
r.current = L(e), C(() => {
|
|
1028
|
+
const n = {
|
|
1029
|
+
navigated: !1,
|
|
1030
|
+
depth: 0,
|
|
1031
|
+
runId: 0,
|
|
1032
|
+
ourSendPending: !1
|
|
1033
|
+
}, o = () => t.getRegisteredFunctions().some((p) => p.name === r.current.pageStateFunctionName), i = (p) => new Promise((x) => {
|
|
1034
|
+
let h = !1;
|
|
1035
|
+
const m = (f) => {
|
|
1036
|
+
h || (h = !0, clearTimeout(a), t.off("context:changed", b), x(f));
|
|
1037
|
+
}, v = () => setTimeout(() => m(p === n.runId && o()), r.current.settleMs), b = () => {
|
|
1038
|
+
if (p !== n.runId) return m(!1);
|
|
1039
|
+
o() && (t.off("context:changed", b), v());
|
|
1040
|
+
}, a = setTimeout(() => m(!1), r.current.readinessTimeoutMs);
|
|
1041
|
+
o() ? v() : t.on("context:changed", b);
|
|
1042
|
+
}), c = async (p) => {
|
|
1043
|
+
const x = ++n.runId;
|
|
1044
|
+
if (!(!await i(x) || x !== n.runId)) {
|
|
1045
|
+
n.depth += 1, n.ourSendPending = !0;
|
|
1046
|
+
try {
|
|
1047
|
+
await t.sendMessage(r.current.continuationPrompt, {
|
|
1048
|
+
conversationId: p,
|
|
1049
|
+
hidden: !0
|
|
1050
|
+
});
|
|
1051
|
+
} catch {
|
|
1052
|
+
n.ourSendPending = !1;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}, l = (p) => {
|
|
1056
|
+
r.current.navigationFunctions.includes(p.functionName) && (n.navigated = !0);
|
|
1057
|
+
}, g = () => {
|
|
1058
|
+
n.ourSendPending || (n.depth = 0, n.runId += 1);
|
|
1059
|
+
}, d = (p) => {
|
|
1060
|
+
n.ourSendPending = !1;
|
|
1061
|
+
const x = n.navigated;
|
|
1062
|
+
n.navigated = !1, r.current.enabled && x && (n.depth >= r.current.maxDepth || c(p.conversationId));
|
|
1063
|
+
}, y = () => {
|
|
1064
|
+
n.ourSendPending = !1;
|
|
1065
|
+
};
|
|
1066
|
+
return t.on("function:invoke", l), t.on("message:start", g), t.on("message:complete", d), t.on("message:error", y), () => {
|
|
1067
|
+
n.runId += 1, t.off("function:invoke", l), t.off("message:start", g), t.off("message:complete", d), t.off("message:error", y);
|
|
1068
|
+
};
|
|
1069
|
+
}, [t]);
|
|
1070
|
+
}
|
|
1071
|
+
function Je(e, t) {
|
|
1072
|
+
const r = T(), n = te(), o = t ?? n, i = A(e);
|
|
997
1073
|
i.current = e;
|
|
998
|
-
const
|
|
999
|
-
|
|
1074
|
+
const c = typeof e == "function";
|
|
1075
|
+
C(() => {
|
|
1000
1076
|
if (typeof i.current == "function") {
|
|
1001
1077
|
const l = () => i.current();
|
|
1002
|
-
return r.addDynamicContext(
|
|
1003
|
-
r.removeDynamicContext(
|
|
1078
|
+
return r.addDynamicContext(o, l), () => {
|
|
1079
|
+
r.removeDynamicContext(o);
|
|
1004
1080
|
};
|
|
1005
1081
|
}
|
|
1006
|
-
return r.setContext(
|
|
1007
|
-
r.removeContext(
|
|
1082
|
+
return r.setContext(o, i.current), () => {
|
|
1083
|
+
r.removeContext(o);
|
|
1008
1084
|
};
|
|
1009
1085
|
}, [
|
|
1010
1086
|
r,
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1087
|
+
o,
|
|
1088
|
+
c,
|
|
1089
|
+
c ? "" : JSON.stringify(e)
|
|
1014
1090
|
]);
|
|
1015
1091
|
}
|
|
1016
|
-
function
|
|
1017
|
-
return
|
|
1092
|
+
function Ee(e) {
|
|
1093
|
+
return ne(e.subscribe, e.get, e.get);
|
|
1018
1094
|
}
|
|
1019
|
-
var
|
|
1095
|
+
var W = {
|
|
1020
1096
|
missing: [],
|
|
1021
1097
|
complete: !1
|
|
1022
1098
|
};
|
|
1023
|
-
function
|
|
1024
|
-
const t = T(), r = e.schema != null, n = JSON.stringify(e.schema ?? null),
|
|
1099
|
+
function je(e) {
|
|
1100
|
+
const t = T(), r = e.schema != null, n = JSON.stringify(e.schema ?? null), o = e.submit, i = o ? typeof o == "string" ? `client:${o}` : o.via === "backend" ? "backend" : "handler" in o ? "client:handler" : `client:${o.url}` : "none", c = JSON.stringify(e.initialValues ?? null), l = N(() => r ? O(e) : null, [
|
|
1025
1101
|
r,
|
|
1026
1102
|
e.name,
|
|
1027
1103
|
n,
|
|
1028
1104
|
i,
|
|
1029
|
-
|
|
1105
|
+
c,
|
|
1030
1106
|
e.autoSubmit
|
|
1031
|
-
]), [
|
|
1107
|
+
]), [g, d] = I({
|
|
1032
1108
|
collector: null,
|
|
1033
1109
|
loading: !r,
|
|
1034
1110
|
error: null
|
|
1035
1111
|
});
|
|
1036
|
-
|
|
1112
|
+
C(() => {
|
|
1037
1113
|
if (r) return;
|
|
1038
|
-
let
|
|
1039
|
-
return
|
|
1114
|
+
let f = !1;
|
|
1115
|
+
return d({
|
|
1040
1116
|
collector: null,
|
|
1041
1117
|
loading: !0,
|
|
1042
1118
|
error: null
|
|
1043
|
-
}), H(t, e).then((
|
|
1044
|
-
|
|
1045
|
-
collector:
|
|
1119
|
+
}), H(t, e).then((u) => {
|
|
1120
|
+
f || d({
|
|
1121
|
+
collector: u,
|
|
1046
1122
|
loading: !1,
|
|
1047
1123
|
error: null
|
|
1048
1124
|
});
|
|
1049
|
-
}).catch((
|
|
1050
|
-
|
|
1125
|
+
}).catch((u) => {
|
|
1126
|
+
f || d({
|
|
1051
1127
|
collector: null,
|
|
1052
1128
|
loading: !1,
|
|
1053
|
-
error:
|
|
1129
|
+
error: u instanceof Error ? u : new Error(String(u))
|
|
1054
1130
|
});
|
|
1055
1131
|
}), () => {
|
|
1056
|
-
|
|
1132
|
+
f = !0;
|
|
1057
1133
|
};
|
|
1058
1134
|
}, [
|
|
1059
1135
|
t,
|
|
1060
1136
|
r,
|
|
1061
1137
|
e.name,
|
|
1062
1138
|
i,
|
|
1063
|
-
|
|
1139
|
+
c,
|
|
1064
1140
|
e.autoSubmit
|
|
1065
1141
|
]);
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
if (
|
|
1069
|
-
return
|
|
1070
|
-
}, [t,
|
|
1071
|
-
const
|
|
1142
|
+
const y = r ? l : g.collector, p = r ? !1 : g.loading, x = r ? null : g.error;
|
|
1143
|
+
C(() => {
|
|
1144
|
+
if (y)
|
|
1145
|
+
return y.install(t);
|
|
1146
|
+
}, [t, y]);
|
|
1147
|
+
const h = N(() => Q({
|
|
1072
1148
|
values: e.initialValues ?? {},
|
|
1073
1149
|
submitted: !1
|
|
1074
|
-
}), [
|
|
1075
|
-
...
|
|
1150
|
+
}), [c]), m = Ee(y?.store ?? h), v = N(() => y?.getStatus() ?? W, [m, y]), b = N(() => ({
|
|
1151
|
+
...m,
|
|
1076
1152
|
...v
|
|
1077
|
-
}), [
|
|
1153
|
+
}), [m, v]), a = N(() => ({
|
|
1078
1154
|
name: e.name,
|
|
1079
|
-
store:
|
|
1155
|
+
store: h,
|
|
1080
1156
|
functions: [],
|
|
1081
1157
|
contextKey: `form:${e.name}`,
|
|
1082
1158
|
contextProvider: () => ({
|
|
@@ -1091,39 +1167,41 @@ function Ke(e) {
|
|
|
1091
1167
|
ok: !1,
|
|
1092
1168
|
error: "Form definition not loaded yet."
|
|
1093
1169
|
}),
|
|
1094
|
-
getValues: () =>
|
|
1170
|
+
getValues: () => h.get().values,
|
|
1095
1171
|
setValues: () => {
|
|
1096
1172
|
},
|
|
1097
1173
|
reset: () => {
|
|
1098
1174
|
},
|
|
1099
|
-
getStatus: () =>
|
|
1100
|
-
}), [e.name,
|
|
1175
|
+
getStatus: () => W
|
|
1176
|
+
}), [e.name, h]);
|
|
1101
1177
|
return {
|
|
1102
|
-
...
|
|
1103
|
-
state:
|
|
1104
|
-
loading:
|
|
1105
|
-
error:
|
|
1178
|
+
...y ?? a,
|
|
1179
|
+
state: b,
|
|
1180
|
+
loading: p,
|
|
1181
|
+
error: x
|
|
1106
1182
|
};
|
|
1107
1183
|
}
|
|
1108
1184
|
export {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1185
|
+
He as AgoProvider,
|
|
1186
|
+
se as ChatInput,
|
|
1187
|
+
Oe as ChatWidget,
|
|
1188
|
+
Se as Markdown,
|
|
1113
1189
|
Me as Message,
|
|
1114
|
-
|
|
1190
|
+
O as createFormCollector,
|
|
1115
1191
|
_e as createMockClient,
|
|
1116
|
-
|
|
1192
|
+
Ne as deriveFormStatus,
|
|
1117
1193
|
H as loadFormCollector,
|
|
1118
|
-
|
|
1194
|
+
ae as useAgo,
|
|
1195
|
+
qe as useAgoAutoContinueAfterNavigation,
|
|
1119
1196
|
T as useAgoClient,
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1197
|
+
Je as useAgoContext,
|
|
1198
|
+
Be as useAgoFunction,
|
|
1199
|
+
Ue as useAgoNavigation,
|
|
1200
|
+
Ke as useAgoPageState,
|
|
1201
|
+
Ee as useAgoStore,
|
|
1202
|
+
$e as useChat,
|
|
1203
|
+
Re as useConversation,
|
|
1204
|
+
je as useFormCollector,
|
|
1205
|
+
U as useMessages,
|
|
1206
|
+
D as useOptionalAgoClient
|
|
1129
1207
|
};
|