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