@pagelines/sdk 1.0.871 → 1.0.873
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/dist/AgentProvider.js +235 -235
- package/dist/AgentProvider.js.map +1 -1
- package/dist/AgentWrap.js +505 -516
- package/dist/AgentWrap.js.map +1 -1
- package/dist/agent.js +6 -6
- package/dist/sdk.css +1 -1
- package/dist/ui/FSpinner.vue.d.ts +1 -22
- package/dist/widget.js +45 -45
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime.js";
|
|
2
2
|
import { c as e, s as t } from "./sdkClient.js";
|
|
3
|
-
import {
|
|
3
|
+
import { f as n, i as r, m as i, n as a, p as o, r as s, t as c } from "./AgentWrap.js";
|
|
4
4
|
import { n as l, t as u } from "./AgentProvider.js";
|
|
5
5
|
import { n as d, t as f } from "./provider.js";
|
|
6
6
|
import { SettingsObject as p, readChatEventStream as m, zVoiceSessionMint as h } from "@pagelines/core";
|
|
@@ -98,15 +98,15 @@ var j = {
|
|
|
98
98
|
variant: {}
|
|
99
99
|
},
|
|
100
100
|
setup(e) {
|
|
101
|
-
return (t,
|
|
101
|
+
return (t, n) => (E(), y("div", {
|
|
102
102
|
class: w(["@container/chat-preview flex flex-col gap-3", e.variant === "dark" ? "text-white" : "text-slate-950"]),
|
|
103
103
|
"data-test": "agent-chat-preview"
|
|
104
|
-
}, [(E(!0), y(g, null, O(e.messages, (t,
|
|
105
|
-
key: `${t.sender}-${
|
|
104
|
+
}, [(E(!0), y(g, null, O(e.messages, (t, n) => (E(), y("div", {
|
|
105
|
+
key: `${t.sender}-${n}`,
|
|
106
106
|
class: w(["flex", t.sender === "user" ? "justify-end" : "justify-start"]),
|
|
107
107
|
"data-test": "agent-chat-preview-message",
|
|
108
108
|
"data-sender": t.sender
|
|
109
|
-
}, [b("div", { class: w(["max-w-[88%] rounded-2xl px-4 py-3 text-sm shadow-sm @sm/chat-preview:max-w-[78%]", t.sender === "user" ? "bg-slate-950 text-white" : e.variant === "dark" ? "border border-white/10 bg-white/10 text-white" : "border border-slate-200 bg-white text-slate-950"]) }, [x(
|
|
109
|
+
}, [b("div", { class: w(["max-w-[88%] rounded-2xl px-4 py-3 text-sm shadow-sm @sm/chat-preview:max-w-[78%]", t.sender === "user" ? "bg-slate-950 text-white" : e.variant === "dark" ? "border border-white/10 bg-white/10 text-white" : "border border-slate-200 bg-white text-slate-950"]) }, [x(r, {
|
|
110
110
|
text: t.text,
|
|
111
111
|
inverted: t.sender === "user" || e.variant === "dark"
|
|
112
112
|
}, null, 8, ["text", "inverted"])], 2)], 10, I))), 128))], 2));
|
|
@@ -446,6 +446,6 @@ var VoiceSessionClient = class extends p {
|
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
448
|
//#endregion
|
|
449
|
-
export {
|
|
449
|
+
export { o as AGENT_MODES, i as Agent, l as AgentChat, n as AgentChatController, n as AgentController, u as AgentProvider, F as AgentWidget, c as AgentWrap, a as ElAgentChat, L as ElAgentChatPreview, s as VoiceMode, VoiceSessionClient };
|
|
450
450
|
|
|
451
451
|
//# sourceMappingURL=agent.js.map
|
package/dist/sdk.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.ring-circular{animation:1s linear infinite rotate}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;animation:2s ease-in-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}.voice-call-enter-active[data-v-0122d7a1]{transition:opacity .3s cubic-bezier(.25,1,.33,1)}.voice-call-leave-active[data-v-0122d7a1]{transition:opacity .2s cubic-bezier(.5,0,.75,0)}.voice-call-enter-active .voice-call-card[data-v-0122d7a1]{transition:transform .42s cubic-bezier(.25,1,.33,1)}.voice-call-leave-active .voice-call-card[data-v-0122d7a1]{transition:transform .2s cubic-bezier(.5,0,.75,0)}.voice-call-enter-from[data-v-0122d7a1],.voice-call-leave-to[data-v-0122d7a1]{opacity:0}.voice-call-enter-from .voice-call-card[data-v-0122d7a1]{transform:translateY(32px)}.voice-call-leave-to .voice-call-card[data-v-0122d7a1]{transform:translateY(12px)}@media (prefers-reduced-motion:reduce){.voice-call-enter-active[data-v-0122d7a1],.voice-call-leave-active[data-v-0122d7a1],.voice-call-enter-active .voice-call-card[data-v-0122d7a1],.voice-call-leave-active .voice-call-card[data-v-0122d7a1]{transition-duration:1ms}.voice-call-enter-from .voice-call-card[data-v-0122d7a1],.voice-call-leave-to .voice-call-card[data-v-0122d7a1]{transform:none}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px)scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0)scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}.widget-container[data-v-96deba7b]{transition:width .4s cubic-bezier(.32,.72,0,1),height .4s cubic-bezier(.32,.72,0,1),border-radius .4s cubic-bezier(.32,.72,0,1),box-shadow .4s cubic-bezier(.32,.72,0,1)}
|
|
1
|
+
:where(.spinner){color:var(--color-theme-300)}.ring-circular{animation:1s linear infinite rotate}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;animation:2s ease-in-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}.voice-call-enter-active[data-v-0122d7a1]{transition:opacity .3s cubic-bezier(.25,1,.33,1)}.voice-call-leave-active[data-v-0122d7a1]{transition:opacity .2s cubic-bezier(.5,0,.75,0)}.voice-call-enter-active .voice-call-card[data-v-0122d7a1]{transition:transform .42s cubic-bezier(.25,1,.33,1)}.voice-call-leave-active .voice-call-card[data-v-0122d7a1]{transition:transform .2s cubic-bezier(.5,0,.75,0)}.voice-call-enter-from[data-v-0122d7a1],.voice-call-leave-to[data-v-0122d7a1]{opacity:0}.voice-call-enter-from .voice-call-card[data-v-0122d7a1]{transform:translateY(32px)}.voice-call-leave-to .voice-call-card[data-v-0122d7a1]{transform:translateY(12px)}@media (prefers-reduced-motion:reduce){.voice-call-enter-active[data-v-0122d7a1],.voice-call-leave-active[data-v-0122d7a1],.voice-call-enter-active .voice-call-card[data-v-0122d7a1],.voice-call-leave-active .voice-call-card[data-v-0122d7a1]{transition-duration:1ms}.voice-call-enter-from .voice-call-card[data-v-0122d7a1],.voice-call-leave-to .voice-call-card[data-v-0122d7a1]{transform:none}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px)scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0)scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}.widget-container[data-v-96deba7b]{transition:width .4s cubic-bezier(.32,.72,0,1),height .4s cubic-bezier(.32,.72,0,1),border-radius .4s cubic-bezier(.32,.72,0,1),box-shadow .4s cubic-bezier(.32,.72,0,1)}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
declare const __VLS_export: import('vue').DefineComponent<import('vue').
|
|
2
|
-
width: {
|
|
3
|
-
type: StringConstructor;
|
|
4
|
-
default: string;
|
|
5
|
-
};
|
|
6
|
-
colorMode: {
|
|
7
|
-
type: StringConstructor;
|
|
8
|
-
default: string;
|
|
9
|
-
};
|
|
10
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
11
|
-
width: {
|
|
12
|
-
type: StringConstructor;
|
|
13
|
-
default: string;
|
|
14
|
-
};
|
|
15
|
-
colorMode: {
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
default: string;
|
|
18
|
-
};
|
|
19
|
-
}>> & Readonly<{}>, {
|
|
20
|
-
width: string;
|
|
21
|
-
colorMode: string;
|
|
22
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
23
2
|
declare const _default: typeof __VLS_export;
|
|
24
3
|
export default _default;
|
package/dist/widget.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime.js";
|
|
2
2
|
import { c as e, s as t, t as n } from "./sdkClient.js";
|
|
3
|
-
import { c as r,
|
|
3
|
+
import { c as r, f as i, g as a, l as o, m as s, n as c, o as l, s as u, t as d } from "./AgentWrap.js";
|
|
4
4
|
import { t as f } from "./useWidgetState.js";
|
|
5
5
|
import { PAGELINES_APP_CONFIG as p, createLogger as m } from "@pagelines/core";
|
|
6
6
|
import { Fragment as h, computed as g, createApp as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createStaticVNode as S, createTextVNode as C, createVNode as w, defineComponent as T, normalizeClass as E, normalizeStyle as ee, onMounted as te, openBlock as D, ref as O, shallowRef as k, toDisplayString as A, unref as j, vModelText as ne, watch as M, withCtx as N, withDirectives as re, withKeys as P, withModifiers as ie } from "vue";
|
|
@@ -24,36 +24,36 @@ var ae = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@la
|
|
|
24
24
|
let t = O(!1), n = O("email"), i = O({
|
|
25
25
|
email: "",
|
|
26
26
|
code: ""
|
|
27
|
-
}),
|
|
27
|
+
}), a = O(!1);
|
|
28
28
|
function signInWithGoogle() {
|
|
29
29
|
e.sdk.error.value = null, e.sdk.auth.loginWithGoogle({ onError: (t) => {
|
|
30
30
|
e.sdk.error.value = t;
|
|
31
31
|
} });
|
|
32
32
|
}
|
|
33
33
|
async function sendCode() {
|
|
34
|
-
if (!
|
|
35
|
-
|
|
34
|
+
if (!a.value) {
|
|
35
|
+
a.value = !0, e.sdk.error.value = null;
|
|
36
36
|
try {
|
|
37
37
|
await e.sdk.auth.requestAuthCode({ email: i.value.email }) && (n.value = "code");
|
|
38
38
|
} finally {
|
|
39
|
-
|
|
39
|
+
a.value = !1;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
async function verifyCode() {
|
|
44
|
-
if (!
|
|
45
|
-
|
|
44
|
+
if (!a.value) {
|
|
45
|
+
a.value = !0, e.sdk.error.value = null;
|
|
46
46
|
try {
|
|
47
47
|
await e.sdk.auth.loginWithCode({
|
|
48
48
|
email: i.value.email,
|
|
49
49
|
code: i.value.code
|
|
50
50
|
});
|
|
51
51
|
} finally {
|
|
52
|
-
|
|
52
|
+
a.value = !1;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
return (
|
|
56
|
+
return (o, s) => (D(), b("div", F, [x("div", I, [s[4] || (s[4] = x("div", { class: "space-y-3 mb-10" }, [x("h3", { class: "text-2xl font-light text-theme-900 leading-snug" }, [
|
|
57
57
|
C(" Your AI assistant,"),
|
|
58
58
|
x("br"),
|
|
59
59
|
C("ready in two minutes. ")
|
|
@@ -62,8 +62,8 @@ var ae = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@la
|
|
|
62
62
|
"data-test": "google-auth-btn",
|
|
63
63
|
class: "w-full flex items-center justify-center gap-3 px-5 py-3.5 rounded-xl border border-theme-200 bg-theme-0 text-theme-800 font-medium text-sm transition-all duration-150 hover:border-theme-300 hover:bg-theme-25 active:scale-[0.98] cursor-pointer",
|
|
64
64
|
onClick: signInWithGoogle
|
|
65
|
-
}, [...
|
|
66
|
-
|
|
65
|
+
}, [...s[5] || (s[5] = [S("<svg class=\"size-[18px]\" viewBox=\"0 0 24 24\"><path d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z\" fill=\"#4285F4\"></path><path d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\" fill=\"#34A853\"></path><path d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" fill=\"#FBBC05\"></path><path d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" fill=\"#EA4335\"></path></svg> Continue with Google ", 2)])]),
|
|
66
|
+
s[8] || (s[8] = x("div", { class: "flex items-center gap-3 py-1" }, [
|
|
67
67
|
x("div", { class: "flex-1 h-px bg-theme-100" }),
|
|
68
68
|
x("span", { class: "text-[11px] text-theme-300 uppercase tracking-widest" }, "or"),
|
|
69
69
|
x("div", { class: "flex-1 h-px bg-theme-100" })
|
|
@@ -71,50 +71,50 @@ var ae = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@la
|
|
|
71
71
|
t.value ? y("", !0) : (D(), b("div", z, [x("button", {
|
|
72
72
|
"data-test": "email-auth-link",
|
|
73
73
|
class: "w-full px-5 py-3 rounded-xl border border-theme-100 text-sm text-theme-500 transition-all duration-150 hover:border-theme-200 hover:text-theme-700 cursor-pointer",
|
|
74
|
-
onClick:
|
|
74
|
+
onClick: s[0] || (s[0] = (e) => t.value = !0)
|
|
75
75
|
}, " Use email instead ")])),
|
|
76
|
-
t.value && n.value === "email" ? (D(), b("div", B, [w(
|
|
76
|
+
t.value && n.value === "email" ? (D(), b("div", B, [w(u, {
|
|
77
77
|
modelValue: i.value.email,
|
|
78
|
-
"onUpdate:modelValue":
|
|
78
|
+
"onUpdate:modelValue": s[1] || (s[1] = (e) => i.value.email = e),
|
|
79
79
|
"data-test": "auth-email-input",
|
|
80
80
|
onKeyup: P(sendCode, ["enter"])
|
|
81
|
-
}, null, 8, ["modelValue"]), w(
|
|
81
|
+
}, null, 8, ["modelValue"]), w(r, {
|
|
82
82
|
"data-test": "auth-send-code",
|
|
83
83
|
theme: "dark",
|
|
84
84
|
size: "md",
|
|
85
85
|
class: "w-full",
|
|
86
|
-
loading:
|
|
87
|
-
disabled: !i.value.email ||
|
|
86
|
+
loading: a.value,
|
|
87
|
+
disabled: !i.value.email || a.value,
|
|
88
88
|
onClick: sendCode
|
|
89
89
|
}, {
|
|
90
|
-
default: N(() => [...
|
|
90
|
+
default: N(() => [...s[6] || (s[6] = [C(" Send verification code ", -1)])]),
|
|
91
91
|
_: 1
|
|
92
92
|
}, 8, ["loading", "disabled"])])) : y("", !0),
|
|
93
93
|
t.value && n.value === "code" ? (D(), b("div", V, [
|
|
94
94
|
x("p", H, " Code sent to " + A(i.value.email), 1),
|
|
95
95
|
w(l, {
|
|
96
96
|
modelValue: i.value.code,
|
|
97
|
-
"onUpdate:modelValue":
|
|
97
|
+
"onUpdate:modelValue": s[2] || (s[2] = (e) => i.value.code = e),
|
|
98
98
|
length: 6,
|
|
99
99
|
"focus-first": !0,
|
|
100
100
|
"data-test": "auth-code-input",
|
|
101
101
|
onAutoSubmit: verifyCode
|
|
102
102
|
}, null, 8, ["modelValue"]),
|
|
103
|
-
w(
|
|
103
|
+
w(r, {
|
|
104
104
|
"data-test": "auth-verify-code",
|
|
105
105
|
theme: "dark",
|
|
106
106
|
size: "md",
|
|
107
107
|
class: "w-full",
|
|
108
|
-
loading:
|
|
109
|
-
disabled: i.value.code.length !== 6 ||
|
|
108
|
+
loading: a.value,
|
|
109
|
+
disabled: i.value.code.length !== 6 || a.value,
|
|
110
110
|
onClick: verifyCode
|
|
111
111
|
}, {
|
|
112
|
-
default: N(() => [...
|
|
112
|
+
default: N(() => [...s[7] || (s[7] = [C(" Verify ", -1)])]),
|
|
113
113
|
_: 1
|
|
114
114
|
}, 8, ["loading", "disabled"]),
|
|
115
115
|
x("button", {
|
|
116
116
|
class: "w-full text-xs text-theme-300 hover:text-theme-500 transition-colors py-1 cursor-pointer",
|
|
117
|
-
onClick:
|
|
117
|
+
onClick: s[3] || (s[3] = (e) => n.value = "email")
|
|
118
118
|
}, " Use a different email ")
|
|
119
119
|
])) : y("", !0)
|
|
120
120
|
])]));
|
|
@@ -221,8 +221,8 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
221
221
|
onClose: { type: Function }
|
|
222
222
|
},
|
|
223
223
|
setup(t) {
|
|
224
|
-
let r = t, a = r.sdk || n.getInstance({ isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1 }),
|
|
225
|
-
if (
|
|
224
|
+
let r = t, a = r.sdk || n.getInstance({ isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1 }), o = k(), l = O(!1), u = O(), d = O(!1), f = g(() => {
|
|
225
|
+
if (o.value) return o.value;
|
|
226
226
|
let e = a.activeUser.value;
|
|
227
227
|
if (!e?.agents?.length) return;
|
|
228
228
|
let t = e.primaryAgentId;
|
|
@@ -233,8 +233,8 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
233
233
|
p.value = void 0, m.value = void 0;
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
let t = new
|
|
237
|
-
p.value = t, m.value = new
|
|
236
|
+
let t = new s({ config: f.value });
|
|
237
|
+
p.value = t, m.value = new i({
|
|
238
238
|
sdk: a,
|
|
239
239
|
agent: t,
|
|
240
240
|
chatStreamFn: async (t) => {
|
|
@@ -262,7 +262,7 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
262
262
|
provisionError: u.value
|
|
263
263
|
})), _ = g(() => `${e(a.apiBase, a.isDev)}/`);
|
|
264
264
|
function onAgentCreated(e) {
|
|
265
|
-
|
|
265
|
+
o.value = e, u.value = void 0, l.value = !1, d.value = !0;
|
|
266
266
|
}
|
|
267
267
|
function onProvisionReady() {
|
|
268
268
|
l.value = !0;
|
|
@@ -309,7 +309,7 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
309
309
|
onReady: onProvisionReady,
|
|
310
310
|
onError: onProvisionError
|
|
311
311
|
}, null, 8, ["sdk", "agent-id"])) : y("", !0),
|
|
312
|
-
h.value === "chat" && p.value && m.value ? (D(), v(
|
|
312
|
+
h.value === "chat" && p.value && m.value ? (D(), v(c, {
|
|
313
313
|
key: 3,
|
|
314
314
|
"chat-controller": m.value,
|
|
315
315
|
agent: p.value,
|
|
@@ -328,7 +328,7 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
328
328
|
}, " Go to Dashboard → ", 8, be)])) : y("", !0)
|
|
329
329
|
], 8, fe));
|
|
330
330
|
}
|
|
331
|
-
}), xe = { class: "relative size-16 rounded-full overflow-hidden" }, Se = ["src", "alt"], Ce = { class: "flex items-center shrink-0 border-b border-theme-100 px-4 py-3" }, we = { class: "flex items-center gap-3 flex-1 min-w-0" }, Te = ["src", "alt"], Ee = { class: "min-w-0" }, X = { class: "text-sm font-medium text-theme-900 truncate" }, De = { class: "flex-1 overflow-hidden" }, Oe = { class: "shrink-0 flex items-center justify-center border-t border-theme-100 py-1.5" }, ke = ["href"], Z = /*#__PURE__*/
|
|
331
|
+
}), xe = { class: "relative size-16 rounded-full overflow-hidden" }, Se = ["src", "alt"], Ce = { class: "flex items-center shrink-0 border-b border-theme-100 px-4 py-3" }, we = { class: "flex items-center gap-3 flex-1 min-w-0" }, Te = ["src", "alt"], Ee = { class: "min-w-0" }, X = { class: "text-sm font-medium text-theme-900 truncate" }, De = { class: "flex-1 overflow-hidden" }, Oe = { class: "shrink-0 flex items-center justify-center border-t border-theme-100 py-1.5" }, ke = ["href"], Z = /*#__PURE__*/ a(/* @__PURE__ */ T({
|
|
332
332
|
__name: "AgentWidgetPopup",
|
|
333
333
|
props: {
|
|
334
334
|
sdk: {},
|
|
@@ -340,7 +340,7 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
340
340
|
chatController: {}
|
|
341
341
|
},
|
|
342
342
|
setup(e, { expose: t }) {
|
|
343
|
-
let n = e, r = O(!1),
|
|
343
|
+
let n = e, r = O(!1), a = O(!1), s = k(), { currentAgent: l, currentContext: u, currentFirstMessage: m, update: h } = f(n), _ = g(() => ({
|
|
344
344
|
"bottom-left": "bottom-4 left-4 sm:bottom-6 sm:left-6",
|
|
345
345
|
"top-right": "top-4 right-4 sm:top-6 sm:right-6",
|
|
346
346
|
"top-left": "top-4 left-4 sm:top-6 sm:left-6",
|
|
@@ -357,17 +357,17 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
357
357
|
"bottom-right": "bottom-0 right-0"
|
|
358
358
|
})[n.position || "bottom-right"]);
|
|
359
359
|
function initController(e, t) {
|
|
360
|
-
n.chatController ||
|
|
360
|
+
n.chatController || s.value || (s.value = new i({
|
|
361
361
|
sdk: t,
|
|
362
362
|
agent: e.toConfig(),
|
|
363
|
-
context:
|
|
363
|
+
context: u.value,
|
|
364
364
|
firstMessage: m.value
|
|
365
365
|
}));
|
|
366
366
|
}
|
|
367
367
|
M(r, async (e) => {
|
|
368
|
-
if (!e ||
|
|
369
|
-
|
|
370
|
-
let t = n.chatController ||
|
|
368
|
+
if (!e || a.value) return;
|
|
369
|
+
a.value = !0;
|
|
370
|
+
let t = n.chatController || s.value;
|
|
371
371
|
if (t) try {
|
|
372
372
|
await t.startTextConversation();
|
|
373
373
|
} catch (e) {
|
|
@@ -388,16 +388,16 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
388
388
|
open,
|
|
389
389
|
close,
|
|
390
390
|
update: h
|
|
391
|
-
}), (t, n) => (D(), v(
|
|
391
|
+
}), (t, n) => (D(), v(d, {
|
|
392
392
|
sdk: e.sdk,
|
|
393
393
|
handle: e.handle,
|
|
394
|
-
agent: j(
|
|
395
|
-
context: j(
|
|
394
|
+
agent: j(l),
|
|
395
|
+
context: j(u),
|
|
396
396
|
"first-message": j(m)
|
|
397
397
|
}, {
|
|
398
|
-
default: N(({ agent: t, sdk:
|
|
398
|
+
default: N(({ agent: t, sdk: i }) => [t ? (D(), b("div", {
|
|
399
399
|
key: 0,
|
|
400
|
-
ref: () => initController(t,
|
|
400
|
+
ref: () => initController(t, i),
|
|
401
401
|
class: E(["fixed z-[999999] pointer-events-auto", _.value])
|
|
402
402
|
}, [x("div", {
|
|
403
403
|
class: E(["widget-container transform-gpu overflow-hidden", r.value ? "w-[min(400px,calc(100vw-2rem))] h-[min(600px,calc(100vh-4rem))] shadow-[0_24px_80px_-12px_rgba(0,0,0,0.2),0_8px_24px_-8px_rgba(0,0,0,0.08)]" : "w-16 h-16 shadow-[0_8px_32px_-4px_rgba(0,0,0,0.15)] cursor-pointer"]),
|
|
@@ -407,7 +407,7 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
407
407
|
}),
|
|
408
408
|
onClick: n[0] || (n[0] = (e) => r.value ? void 0 : toggle())
|
|
409
409
|
}, [x("div", { class: E(["absolute size-16 transition-opacity duration-200", [C.value, r.value ? "opacity-0 pointer-events-none" : "opacity-100"]]) }, [x("div", xe, [x("img", {
|
|
410
|
-
src: j(
|
|
410
|
+
src: j(o)(t.toConfig()),
|
|
411
411
|
alt: `${t.name.value} agent`,
|
|
412
412
|
class: "h-full w-full object-cover pointer-events-none",
|
|
413
413
|
width: "64",
|
|
@@ -421,9 +421,9 @@ var fe = ["data-test-state"], pe = { class: "flex items-center justify-between p
|
|
|
421
421
|
class: "cursor-pointer flex items-center justify-center p-2 -mr-1 rounded-xl text-theme-400 hover:text-theme-600 hover:bg-theme-50 transition-colors",
|
|
422
422
|
onClick: ie(close, ["stop"])
|
|
423
423
|
}, [...n[2] || (n[2] = [x("i", { class: "size-5 i-tabler-x" }, null, -1)])])]),
|
|
424
|
-
x("div", De, [
|
|
424
|
+
x("div", De, [a.value ? (D(), v(c, {
|
|
425
425
|
key: 0,
|
|
426
|
-
"chat-controller": e.chatController ||
|
|
426
|
+
"chat-controller": e.chatController || s.value,
|
|
427
427
|
agent: t,
|
|
428
428
|
variant: "light",
|
|
429
429
|
"setup-hint": "",
|