@pagelines/sdk 1.0.878 → 1.0.880
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 +68 -68
- package/dist/BotProvider.js +777 -0
- package/dist/BotProvider.js.map +1 -0
- package/dist/{AgentWidgetInline.js → BotWidgetInline.js} +8 -8
- package/dist/BotWidgetInline.js.map +1 -0
- package/dist/{AgentWidgetModal.js → BotWidgetModal.js} +7 -7
- package/dist/BotWidgetModal.js.map +1 -0
- package/dist/{AgentWrap.js → BotWrap.js} +1174 -1145
- package/dist/BotWrap.js.map +1 -0
- package/dist/{agent/AgentController.d.ts → bot/BotController.d.ts} +35 -18
- package/dist/bot/index.d.ts +14 -0
- package/dist/{agent → bot}/schema.d.ts +6 -6
- package/dist/{agent/ui/AgentAvatar.vue.d.ts → bot/ui/BotAvatar.vue.d.ts} +6 -6
- package/dist/{agent/ui/AgentChat.vue.d.ts → bot/ui/BotChat.vue.d.ts} +5 -5
- package/dist/{agent/ui/AgentProvider.vue.d.ts → bot/ui/BotProvider.vue.d.ts} +3 -3
- package/dist/{agent/ui/AgentWrap.vue.d.ts → bot/ui/BotWrap.vue.d.ts} +3 -4
- package/dist/{agent/ui/ElAgentAbout.vue.d.ts → bot/ui/ElBotAbout.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentChat.vue.d.ts → bot/ui/ElBotChat.vue.d.ts} +5 -5
- package/dist/{agent/ui/ElAgentChatPreview.vue.d.ts → bot/ui/ElBotChatPreview.vue.d.ts} +1 -1
- package/dist/{agent/ui/ElAgentHeader.vue.d.ts → bot/ui/ElBotHeader.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentModeSidebar.vue.d.ts → bot/ui/ElBotModeSidebar.vue.d.ts} +2 -2
- package/dist/{agent/ui/ElAgentSidebar.vue.d.ts → bot/ui/ElBotSidebar.vue.d.ts} +2 -2
- package/dist/bot/ui/ElCreateBot.vue.d.ts +12 -0
- package/dist/{agent → bot}/ui/ElModeHeader.vue.d.ts +2 -2
- package/dist/{agent → bot}/ui/ElProvisioningStatus.vue.d.ts +1 -1
- package/dist/{agent → bot}/ui/VoiceMode.vue.d.ts +4 -4
- package/dist/{agent → bot}/utils.d.ts +5 -5
- package/dist/{agent → bot}/voice/provider.d.ts +2 -2
- package/dist/{agent → bot}/voice/providers/livekit/provider.d.ts +4 -4
- package/dist/{agent → bot}/voice/voice-session-client.d.ts +1 -1
- package/dist/{agent → bot}/work-journal.d.ts +1 -1
- package/dist/{agent.js → bot.js} +83 -80
- package/dist/bot.js.map +1 -0
- package/dist/clients/BillingClient.d.ts +1 -1
- package/dist/clients/BotClient.d.ts +26 -0
- package/dist/clients/ChatClient.d.ts +6 -5
- package/dist/clients/ComputerClient.d.ts +16 -0
- package/dist/clients/UserClient.d.ts +4 -7
- package/dist/clients/types.d.ts +7 -2
- package/dist/contract/build.d.ts +1 -2
- package/dist/index.d.ts +3 -2
- package/dist/provider.js +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/provider2.js +14 -14
- package/dist/provider2.js.map +1 -1
- package/dist/sdk.css +1 -1
- package/dist/sdk.js +4 -4
- package/dist/sdkClient.d.ts +33 -376
- package/dist/sdkClient.js +168 -170
- package/dist/sdkClient.js.map +1 -1
- package/dist/useWidgetState.js +9 -9
- package/dist/useWidgetState.js.map +1 -1
- package/dist/widget/PLWidget.d.ts +6 -6
- package/dist/widget/composables/useWidgetState.d.ts +3 -402
- package/dist/widget/index.d.ts +2 -2
- package/dist/widget/mode.d.ts +2 -2
- package/dist/widget/ui/{AgentWidgetInline.vue.d.ts → BotWidgetInline.vue.d.ts} +2 -2
- package/dist/widget/ui/{AgentWidgetModal.vue.d.ts → BotWidgetModal.vue.d.ts} +2 -2
- package/dist/widget/ui/{AgentWidgetPopup.vue.d.ts → BotWidgetPopup.vue.d.ts} +4 -4
- package/dist/widget.js +206 -206
- package/dist/widget.js.map +1 -1
- package/package.json +5 -5
- package/dist/AgentProvider.js +0 -764
- package/dist/AgentProvider.js.map +0 -1
- package/dist/AgentWidgetInline.js.map +0 -1
- package/dist/AgentWidgetModal.js.map +0 -1
- package/dist/AgentWrap.js.map +0 -1
- package/dist/agent/index.d.ts +0 -14
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +0 -277
- package/dist/agent.js.map +0 -1
- package/dist/clients/AgentClient.d.ts +0 -48
- /package/dist/{agent → bot}/VoiceRecorderController.d.ts +0 -0
- /package/dist/{agent/ui/AgentInputEmail.vue.d.ts → bot/ui/BotInputEmail.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentInputOneTimeCode.vue.d.ts → bot/ui/BotInputOneTimeCode.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentSidebarClose.vue.d.ts → bot/ui/BotSidebarClose.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentToolActivityGroup.vue.d.ts → bot/ui/BotToolActivityGroup.vue.d.ts} +0 -0
- /package/dist/{agent/ui/AgentWidget.vue.d.ts → bot/ui/BotWidget.vue.d.ts} +0 -0
- /package/dist/{agent → bot}/ui/ChatCardBlock.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatRichText.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatScroller.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ChatVisualBlock.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ElAuthGate.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/ElAuthPanel.vue.d.ts +0 -0
- /package/dist/{agent/ui/ElAgentButton.vue.d.ts → bot/ui/ElBotButton.vue.d.ts} +0 -0
- /package/dist/{agent → bot}/ui/ElSidebar.vue.d.ts +0 -0
- /package/dist/{agent → bot}/ui/VoiceHistogramController.d.ts +0 -0
- /package/dist/{agent → bot}/ui/chat-diagram-layout.d.ts +0 -0
- /package/dist/{agent → bot}/ui/chat-visual-format.d.ts +0 -0
- /package/dist/{agent → bot}/ui/voice-mode-presentation.d.ts +0 -0
- /package/dist/{agent → bot}/voice/voice-error-copy.d.ts +0 -0
- /package/dist/{agent → bot}/voice/voice-work-state.d.ts +0 -0
- /package/dist/widget/ui/{AgentWidgetOnboard.vue.d.ts → BotWidgetOnboard.vue.d.ts} +0 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
import "./rolldown-runtime.js";
|
|
2
|
+
import { SOCIAL_PLATFORMS as e } from "./constants.js";
|
|
3
|
+
import { a as t, c as n, d as r, f as i, n as a, o, p as s, s as c, t as l, u } from "./BotWrap.js";
|
|
4
|
+
import { Bot as d, getColorSchemeOklch as ee } from "@pagelines/core";
|
|
5
|
+
import { Fragment as f, Transition as p, TransitionGroup as m, computed as h, createBlock as g, createCommentVNode as _, createElementBlock as v, createElementVNode as y, createSlots as b, createTextVNode as x, createVNode as S, defineComponent as C, guardReactiveProps as w, mergeProps as T, normalizeClass as E, normalizeProps as D, normalizeStyle as O, onMounted as k, onUnmounted as te, openBlock as A, ref as j, renderList as M, renderSlot as N, shallowRef as ne, toDisplayString as P, unref as F, watch as I, withCtx as L, withKeys as R, withModifiers as z } from "vue";
|
|
6
|
+
//#region bot/schema.ts
|
|
7
|
+
var B = [
|
|
8
|
+
{
|
|
9
|
+
mode: "self",
|
|
10
|
+
label: "Overview",
|
|
11
|
+
icon: "i-tabler-user-square-rounded"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
mode: "talk",
|
|
15
|
+
label: "Talk",
|
|
16
|
+
icon: "i-tabler-phone"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
mode: "chat",
|
|
20
|
+
label: "Chat",
|
|
21
|
+
icon: "i-tabler-message-circle"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
mode: "info",
|
|
25
|
+
label: "About",
|
|
26
|
+
icon: "i-tabler-user-circle"
|
|
27
|
+
}
|
|
28
|
+
], V = /* @__PURE__ */ C({
|
|
29
|
+
__name: "EffectTransitionList",
|
|
30
|
+
props: {
|
|
31
|
+
disabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
mode: { default: "block" }
|
|
36
|
+
},
|
|
37
|
+
setup(e) {
|
|
38
|
+
return (t, n) => (A(), g(m, { name: e.disabled ? "" : "nlist" }, {
|
|
39
|
+
default: L(() => [N(t.$slots, "default")]),
|
|
40
|
+
_: 3
|
|
41
|
+
}, 8, ["name"]));
|
|
42
|
+
}
|
|
43
|
+
}), H = ["data-test-mode"], U = { class: "w-full max-w-xs space-y-12" }, W = {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: "text-xs text-theme-400 text-center"
|
|
46
|
+
}, G = { class: "text-base font-light text-white text-center" }, K = { class: "space-y-6 relative" }, q = {
|
|
47
|
+
key: "email-field",
|
|
48
|
+
class: "w-full"
|
|
49
|
+
}, re = {
|
|
50
|
+
key: "code-field",
|
|
51
|
+
class: "w-full"
|
|
52
|
+
}, J = /* @__PURE__ */ C({
|
|
53
|
+
__name: "ElAuthGate",
|
|
54
|
+
props: { sdk: {} },
|
|
55
|
+
setup(e) {
|
|
56
|
+
let t = j({
|
|
57
|
+
email: "",
|
|
58
|
+
code: ""
|
|
59
|
+
}), r = j("email"), i = j(!1), a = {
|
|
60
|
+
email: {
|
|
61
|
+
title: "Enter Your Email",
|
|
62
|
+
button: {
|
|
63
|
+
label: "Continue",
|
|
64
|
+
disabled: () => !t.value.email || i.value
|
|
65
|
+
},
|
|
66
|
+
action: async () => {
|
|
67
|
+
if (!i.value) {
|
|
68
|
+
i.value = !0;
|
|
69
|
+
try {
|
|
70
|
+
await e.sdk.auth.requestAuthCode({ email: t.value.email }) && (r.value = "code");
|
|
71
|
+
} finally {
|
|
72
|
+
i.value = !1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
code: {
|
|
78
|
+
title: "Enter Verification Code",
|
|
79
|
+
button: {
|
|
80
|
+
label: "Verify",
|
|
81
|
+
disabled: () => t.value.code.length !== 6 || i.value
|
|
82
|
+
},
|
|
83
|
+
action: async () => {
|
|
84
|
+
if (!i.value) {
|
|
85
|
+
i.value = !0;
|
|
86
|
+
try {
|
|
87
|
+
await e.sdk.auth.loginWithCode({
|
|
88
|
+
email: t.value.email,
|
|
89
|
+
code: t.value.code
|
|
90
|
+
});
|
|
91
|
+
} finally {
|
|
92
|
+
i.value = !1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, s = h(() => a[r.value]);
|
|
98
|
+
return I(() => e.sdk.activeUser.value, (e) => {
|
|
99
|
+
e && r.value === "code" && console.log("[ElAuthGate] Authentication successful", { email: e.email });
|
|
100
|
+
}), (i, a) => (A(), v("div", {
|
|
101
|
+
"data-test": "auth-form",
|
|
102
|
+
"data-test-mode": r.value,
|
|
103
|
+
class: "flex flex-col items-center justify-center h-full p-6"
|
|
104
|
+
}, [y("div", U, [
|
|
105
|
+
e.sdk.error.value ? (A(), v("p", W, P(e.sdk.error.value), 1)) : _("", !0),
|
|
106
|
+
y("h3", G, P(s.value.title), 1),
|
|
107
|
+
y("div", K, [S(V, null, {
|
|
108
|
+
default: L(() => [r.value === "email" ? (A(), v("div", q, [S(c, {
|
|
109
|
+
modelValue: t.value.email,
|
|
110
|
+
"onUpdate:modelValue": a[0] || (a[0] = (e) => t.value.email = e),
|
|
111
|
+
"data-test": "auth-email-input",
|
|
112
|
+
onKeyup: R(s.value.action, ["enter"])
|
|
113
|
+
}, null, 8, ["modelValue", "onKeyup"])])) : (A(), v("div", re, [S(o, {
|
|
114
|
+
modelValue: t.value.code,
|
|
115
|
+
"onUpdate:modelValue": a[1] || (a[1] = (e) => t.value.code = e),
|
|
116
|
+
length: 6,
|
|
117
|
+
"focus-first": !0,
|
|
118
|
+
"data-test": "auth-code-input",
|
|
119
|
+
onAutoSubmit: s.value.action
|
|
120
|
+
}, null, 8, ["modelValue", "onAutoSubmit"])])), (A(), v("div", {
|
|
121
|
+
key: s.value.button.label,
|
|
122
|
+
class: "space-y-4 w-full"
|
|
123
|
+
}, [S(n, {
|
|
124
|
+
theme: "primary",
|
|
125
|
+
size: "md",
|
|
126
|
+
class: "w-full",
|
|
127
|
+
"data-test": "auth-submit",
|
|
128
|
+
loading: e.sdk.loading.value,
|
|
129
|
+
disabled: s.value.button.disabled() || e.sdk.loading.value,
|
|
130
|
+
onClick: s.value.action
|
|
131
|
+
}, {
|
|
132
|
+
default: L(() => [x(P(s.value.button.label), 1)]),
|
|
133
|
+
_: 1
|
|
134
|
+
}, 8, [
|
|
135
|
+
"loading",
|
|
136
|
+
"disabled",
|
|
137
|
+
"onClick"
|
|
138
|
+
]), r.value === "code" ? (A(), v("button", {
|
|
139
|
+
key: 0,
|
|
140
|
+
class: "w-full text-xs text-white/50 hover:text-white/70 transition-colors py-2",
|
|
141
|
+
onClick: a[2] || (a[2] = (e) => r.value = "email")
|
|
142
|
+
}, " Change Email ")) : _("", !0)]))]),
|
|
143
|
+
_: 1
|
|
144
|
+
})])
|
|
145
|
+
])], 8, H));
|
|
146
|
+
}
|
|
147
|
+
}), Y = { class: "flex-1 flex flex-col min-h-0 py-6 space-y-6 h-full overflow-scroll [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden relative" }, X = { class: "flex-1 space-y-6 pb-12" }, ie = {
|
|
148
|
+
key: 0,
|
|
149
|
+
class: "text-sm bg-white/10 backdrop-blur-sm rounded-2xl p-4 border border-white/20 space-y-3"
|
|
150
|
+
}, ae = { class: "text-white/70 leading-relaxed whitespace-pre-wrap" }, oe = {
|
|
151
|
+
key: 1,
|
|
152
|
+
class: "space-y-3"
|
|
153
|
+
}, se = ["href"], ce = {
|
|
154
|
+
key: 2,
|
|
155
|
+
class: "space-y-3"
|
|
156
|
+
}, le = { class: "grid grid-cols-2 gap-3" }, ue = ["href"], de = /* @__PURE__ */ C({
|
|
157
|
+
__name: "ElBotAbout",
|
|
158
|
+
props: {
|
|
159
|
+
bot: {},
|
|
160
|
+
isOnline: {
|
|
161
|
+
type: Boolean,
|
|
162
|
+
default: !1
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
setup(n) {
|
|
166
|
+
return (r, i) => (A(), v("div", Y, [S(t, {
|
|
167
|
+
bot: n.bot,
|
|
168
|
+
"is-online": n.isOnline
|
|
169
|
+
}, null, 8, ["bot", "is-online"]), y("div", X, [
|
|
170
|
+
n.bot.summary.value ? (A(), v("div", ie, [i[0] || (i[0] = y("h3", { class: "font-medium text-white/50" }, " About ", -1)), y("p", ae, P(n.bot.summary.value), 1)])) : _("", !0),
|
|
171
|
+
n.bot.email.value ? (A(), v("div", oe, [i[2] || (i[2] = y("h3", { class: "text-sm font-medium text-white/90" }, " Contact ", -1)), y("a", {
|
|
172
|
+
href: `mailto:${n.bot.email.value}`,
|
|
173
|
+
target: "_blank",
|
|
174
|
+
rel: "noopener noreferrer",
|
|
175
|
+
class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/5 hover:bg-white/10 border border-white/10 text-white/80 text-sm justify-start h-10 w-full"
|
|
176
|
+
}, [...i[1] || (i[1] = [y("span", { class: "i-heroicons-envelope flex items-center size-[1.1em] mt-[-.07em]" }, null, -1), x(" Email ", -1)])], 8, se)])) : _("", !0),
|
|
177
|
+
n.bot.accounts.value && n.bot.accounts.value.length > 0 ? (A(), v("div", ce, [i[3] || (i[3] = y("h3", { class: "text-sm font-medium text-white/90" }, " Links ", -1)), y("div", le, [(A(!0), v(f, null, M(n.bot.accounts.value, (t) => (A(), v("a", {
|
|
178
|
+
key: `${t.platform}-${t.handle}`,
|
|
179
|
+
href: F(e)[t.platform].getUrl(t.handle),
|
|
180
|
+
target: "_blank",
|
|
181
|
+
rel: "noopener noreferrer",
|
|
182
|
+
class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/10 hover:bg-white/20 border border-white/20 text-white/80 text-sm"
|
|
183
|
+
}, [y("span", { class: E(["flex items-center size-[1.1em] mt-[-.07em]", F(e)[t.platform].icon]) }, null, 2), x(" " + P(F(e)[t.platform].label), 1)], 8, ue))), 128))])])) : _("", !0)
|
|
184
|
+
])]));
|
|
185
|
+
}
|
|
186
|
+
}), fe = { class: "flex flex-col items-center text-center gap-4" }, pe = { class: "relative flex-shrink-0" }, me = { class: "w-20 h-20 sm:w-24 sm:h-24 rounded-full overflow-hidden border-4 border-white" }, he = ["src", "alt"], ge = { class: "absolute top-1.5 right-1.5" }, _e = {
|
|
187
|
+
key: 1,
|
|
188
|
+
class: "size-4 bg-theme-400 rounded-full ring-2 ring-white"
|
|
189
|
+
}, ve = { class: "min-w-0" }, ye = { class: "text-3xl font-light text-white mb-2 truncate" }, be = { class: "text-base font-light text-white/60 line-clamp-1" }, xe = /* @__PURE__ */ C({
|
|
190
|
+
__name: "ElBotHeader",
|
|
191
|
+
props: {
|
|
192
|
+
bot: {},
|
|
193
|
+
isOnline: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: !1
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
setup(e) {
|
|
199
|
+
return (t, n) => (A(), v("div", fe, [y("div", pe, [y("div", me, [y("img", {
|
|
200
|
+
src: e.bot.avatarUrl.value,
|
|
201
|
+
alt: e.bot.displayName.value,
|
|
202
|
+
class: "w-full h-full object-cover",
|
|
203
|
+
onError: n[0] || (n[0] = (...e) => F(u) && F(u)(...e))
|
|
204
|
+
}, null, 40, he)]), y("div", ge, [e.isOnline ? (A(), v(f, { key: 0 }, [n[1] || (n[1] = y("div", {
|
|
205
|
+
class: "size-4 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
206
|
+
style: { "animation-duration": "3s" }
|
|
207
|
+
}, null, -1)), n[2] || (n[2] = y("div", { class: "size-4 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))], 64)) : (A(), v("div", _e))])]), y("div", ve, [y("h1", ye, P(e.bot.displayName.value), 1), y("p", be, P(e.bot.title.value), 1)])]));
|
|
208
|
+
}
|
|
209
|
+
}), Se = { class: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] overflow-hidden" }, Ce = /* @__PURE__ */ C({
|
|
210
|
+
name: "SelfSidebarClose",
|
|
211
|
+
__name: "BotSidebarClose",
|
|
212
|
+
emits: ["click"],
|
|
213
|
+
setup(e) {
|
|
214
|
+
let t = j(!1);
|
|
215
|
+
return k(() => {
|
|
216
|
+
setTimeout(() => {
|
|
217
|
+
t.value = !0;
|
|
218
|
+
}, 100);
|
|
219
|
+
}), (e, n) => (A(), v("a", {
|
|
220
|
+
class: "close block cursor-pointer w-[60px] h-[60px] rounded-full transition-all duration-1000 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-110 active:scale-90 hover:rotate-90",
|
|
221
|
+
onClick: n[0] || (n[0] = (t) => e.$emit("click", t))
|
|
222
|
+
}, [n[1] || (n[1] = y("span", { class: "absolute inset-0 rounded-full transition-all" }, null, -1)), y("span", Se, [y("span", {
|
|
223
|
+
class: E(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 rotate-45" : "translate-y-[30px] -translate-x-[30px] rotate-0"]),
|
|
224
|
+
style: {
|
|
225
|
+
"background-color": "currentColor",
|
|
226
|
+
"transition-delay": "0.15s"
|
|
227
|
+
}
|
|
228
|
+
}, null, 2), y("span", {
|
|
229
|
+
class: E(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 -rotate-45" : "-translate-y-[30px] -translate-x-[30px] rotate-0"]),
|
|
230
|
+
style: {
|
|
231
|
+
"background-color": "currentColor",
|
|
232
|
+
"transition-delay": "0.45s"
|
|
233
|
+
}
|
|
234
|
+
}, null, 2)])]));
|
|
235
|
+
}
|
|
236
|
+
}), we = {
|
|
237
|
+
key: 0,
|
|
238
|
+
class: "px-9 pt-12 pb-4"
|
|
239
|
+
}, Te = { class: "text-base font-medium text-theme-400" }, Ee = {
|
|
240
|
+
key: 1,
|
|
241
|
+
class: "px-4 pb-8 border-b border-white/10"
|
|
242
|
+
}, De = ["disabled", "onClick"], Oe = { class: "flex items-center gap-3" }, ke = { class: "flex-1" }, Ae = {
|
|
243
|
+
key: 0,
|
|
244
|
+
class: "text-xs text-white/50 mt-0.5"
|
|
245
|
+
}, je = { class: "p-6" }, Z = /* @__PURE__ */ C({
|
|
246
|
+
name: "ElSidebar",
|
|
247
|
+
inheritAttrs: !1,
|
|
248
|
+
__name: "ElSidebar",
|
|
249
|
+
props: {
|
|
250
|
+
modelValue: { type: Boolean },
|
|
251
|
+
items: {},
|
|
252
|
+
position: {},
|
|
253
|
+
title: {},
|
|
254
|
+
widthClasses: {}
|
|
255
|
+
},
|
|
256
|
+
emits: ["update:modelValue"],
|
|
257
|
+
setup(e, { emit: t }) {
|
|
258
|
+
let n = e, r = t, i = n.position || "left", a = n.widthClasses || "w-[80%] max-w-[300px]", o = h({
|
|
259
|
+
get: () => n.modelValue,
|
|
260
|
+
set: (e) => r("update:modelValue", e)
|
|
261
|
+
}), s = h(() => n.items.filter((e) => !e.isHidden));
|
|
262
|
+
function handleItemClick(e) {
|
|
263
|
+
e.isDisabled || (e.onClick ? e.onClick({
|
|
264
|
+
item: e,
|
|
265
|
+
event: new MouseEvent("click")
|
|
266
|
+
}) : e.href && (e.href.includes("http") ? window.open(e.href, e.target || "_self")?.focus() : window.location.href = e.href), o.value = !1);
|
|
267
|
+
}
|
|
268
|
+
let c = h(() => i === "left" ? {
|
|
269
|
+
enter: "-translate-x-full",
|
|
270
|
+
leave: "-translate-x-full",
|
|
271
|
+
position: "justify-start",
|
|
272
|
+
closeButton: "-right-16"
|
|
273
|
+
} : {
|
|
274
|
+
enter: "translate-x-full",
|
|
275
|
+
leave: "translate-x-full",
|
|
276
|
+
position: "justify-end",
|
|
277
|
+
closeButton: "-left-16"
|
|
278
|
+
});
|
|
279
|
+
return (t, n) => (A(), v(f, null, [S(p, {
|
|
280
|
+
"enter-active-class": "transition-opacity duration-300 ease-out",
|
|
281
|
+
"leave-active-class": "transition-opacity duration-200 ease-in",
|
|
282
|
+
"enter-from-class": "opacity-0",
|
|
283
|
+
"enter-to-class": "opacity-100",
|
|
284
|
+
"leave-from-class": "opacity-100",
|
|
285
|
+
"leave-to-class": "opacity-0"
|
|
286
|
+
}, {
|
|
287
|
+
default: L(() => [o.value ? (A(), v("div", {
|
|
288
|
+
key: 0,
|
|
289
|
+
class: "absolute inset-0 z-40 bg-black/50 backdrop-blur-sm",
|
|
290
|
+
onClick: n[0] || (n[0] = (e) => o.value = !1)
|
|
291
|
+
})) : _("", !0)]),
|
|
292
|
+
_: 1
|
|
293
|
+
}), S(p, {
|
|
294
|
+
"enter-active-class": "transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)]",
|
|
295
|
+
"leave-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
|
|
296
|
+
"enter-from-class": c.value.enter,
|
|
297
|
+
"enter-to-class": "translate-x-0",
|
|
298
|
+
"leave-from-class": "translate-x-0",
|
|
299
|
+
"leave-to-class": c.value.leave
|
|
300
|
+
}, {
|
|
301
|
+
default: L(() => [o.value ? (A(), v("div", {
|
|
302
|
+
key: 0,
|
|
303
|
+
class: E(["absolute inset-0 z-50 flex", c.value.position]),
|
|
304
|
+
onClick: n[3] || (n[3] = (e) => o.value = !1)
|
|
305
|
+
}, [y("div", {
|
|
306
|
+
class: E(["relative h-full shadow-2xl bg-black/30 backdrop-blur-xl flex flex-col justify-center", F(a)]),
|
|
307
|
+
onClick: n[2] || (n[2] = z(() => {}, ["stop"]))
|
|
308
|
+
}, [
|
|
309
|
+
S(Ce, {
|
|
310
|
+
class: E(["absolute top-4 z-10 text-white", c.value.closeButton]),
|
|
311
|
+
onClick: n[1] || (n[1] = (e) => o.value = !1)
|
|
312
|
+
}, null, 8, ["class"]),
|
|
313
|
+
e.title ? (A(), v("div", we, [y("h3", Te, P(e.title), 1)])) : _("", !0),
|
|
314
|
+
t.$slots.header ? (A(), v("div", Ee, [N(t.$slots, "header")])) : _("", !0),
|
|
315
|
+
y("div", { class: E(["flex-1 p-6 space-y-2 overflow-y-auto", {
|
|
316
|
+
"pt-6": !e.title && !t.$slots.header,
|
|
317
|
+
"pt-4": e.title || t.$slots.header
|
|
318
|
+
}]) }, [S(m, {
|
|
319
|
+
"enter-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
|
|
320
|
+
"leave-active-class": "transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)]",
|
|
321
|
+
"enter-from-class": F(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0",
|
|
322
|
+
"enter-to-class": "translate-x-0 opacity-100",
|
|
323
|
+
"leave-from-class": "translate-x-0 opacity-100",
|
|
324
|
+
"leave-to-class": F(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0"
|
|
325
|
+
}, {
|
|
326
|
+
default: L(() => [(A(!0), v(f, null, M(s.value, (e, t) => (A(), v("button", {
|
|
327
|
+
key: e.key || e.label || t,
|
|
328
|
+
style: O({ transitionDelay: `${t * 40}ms` }),
|
|
329
|
+
class: E(["cursor-pointer w-full text-left p-3 rounded-xl transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group", [e.isActive ? "bg-primary-500/20 border border-primary-500/40" : "hover:bg-white/10", e.isDisabled && "opacity-50 cursor-not-allowed"]]),
|
|
330
|
+
disabled: e.isDisabled,
|
|
331
|
+
onClick: (t) => handleItemClick(e)
|
|
332
|
+
}, [y("div", Oe, [e.icon?.src ? (A(), v("i", {
|
|
333
|
+
key: 0,
|
|
334
|
+
class: E(["size-5 flex-shrink-0 transition-transform duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group-hover:scale-110", [e.icon.src, e.isActive ? "text-primary-400" : "text-white/70 group-hover:text-white"]])
|
|
335
|
+
}, null, 2)) : _("", !0), y("div", ke, [y("div", { class: E(["font-medium text-sm", e.isActive ? "text-primary-300" : "text-white"]) }, P(e.label), 3), e.subLabel ? (A(), v("div", Ae, P(e.subLabel), 1)) : _("", !0)])])], 14, De))), 128))]),
|
|
336
|
+
_: 1
|
|
337
|
+
}, 8, ["enter-from-class", "leave-to-class"])], 2),
|
|
338
|
+
y("div", je, [N(t.$slots, "footer")])
|
|
339
|
+
], 2)], 2)) : _("", !0)]),
|
|
340
|
+
_: 3
|
|
341
|
+
}, 8, ["enter-from-class", "leave-to-class"])], 64));
|
|
342
|
+
}
|
|
343
|
+
}), Me = /* @__PURE__ */ C({
|
|
344
|
+
name: "BotModeSidebar",
|
|
345
|
+
__name: "ElBotModeSidebar",
|
|
346
|
+
props: {
|
|
347
|
+
modelValue: { type: Boolean },
|
|
348
|
+
chatController: {}
|
|
349
|
+
},
|
|
350
|
+
emits: ["update:modelValue"],
|
|
351
|
+
setup(e, { emit: t }) {
|
|
352
|
+
let n = e, r = t, i = h({
|
|
353
|
+
get: () => n.modelValue,
|
|
354
|
+
set: (e) => r("update:modelValue", e)
|
|
355
|
+
}), a = h(() => n.chatController?.botMode?.value ?? "self"), o = h(() => B.map((e) => ({
|
|
356
|
+
key: e.mode,
|
|
357
|
+
icon: { src: e.icon },
|
|
358
|
+
label: e.label,
|
|
359
|
+
isActive: a.value === e.mode,
|
|
360
|
+
onClick: () => {
|
|
361
|
+
n.chatController?.setMode(e.mode);
|
|
362
|
+
}
|
|
363
|
+
})));
|
|
364
|
+
return (e, t) => (A(), g(Z, {
|
|
365
|
+
modelValue: i.value,
|
|
366
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => i.value = e),
|
|
367
|
+
items: o.value,
|
|
368
|
+
position: "right",
|
|
369
|
+
title: "Mode",
|
|
370
|
+
"width-classes": "w-[80%] max-w-[255px]"
|
|
371
|
+
}, null, 8, ["modelValue", "items"]));
|
|
372
|
+
}
|
|
373
|
+
}), Ne = /* @__PURE__ */ C({
|
|
374
|
+
name: "BotSidebar",
|
|
375
|
+
__name: "ElBotSidebar",
|
|
376
|
+
props: {
|
|
377
|
+
modelValue: { type: Boolean },
|
|
378
|
+
bot: {},
|
|
379
|
+
sdk: {},
|
|
380
|
+
title: {}
|
|
381
|
+
},
|
|
382
|
+
emits: ["update:modelValue"],
|
|
383
|
+
setup(e, { emit: t }) {
|
|
384
|
+
let n = e, r = t, i = h({
|
|
385
|
+
get: () => n.modelValue,
|
|
386
|
+
set: (e) => r("update:modelValue", e)
|
|
387
|
+
}), a = h(() => {
|
|
388
|
+
let e = [
|
|
389
|
+
{
|
|
390
|
+
key: "share",
|
|
391
|
+
icon: { src: "i-tabler-share" },
|
|
392
|
+
label: "Share this assistant",
|
|
393
|
+
onClick: () => {
|
|
394
|
+
let e = `${window.location.origin}/@${n.bot.handle.value || n.bot.botId.value}`;
|
|
395
|
+
navigator.clipboard.writeText(e).catch((e) => {
|
|
396
|
+
console.error("ElBotSidebar: clipboard.writeText rejected", e);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
key: "profile",
|
|
402
|
+
icon: { src: "i-tabler-user" },
|
|
403
|
+
label: "View full profile",
|
|
404
|
+
onClick: () => {
|
|
405
|
+
window.open(`/@${n.bot.handle.value || n.bot.botId.value}`, "_blank");
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
key: "create",
|
|
410
|
+
icon: { src: "i-tabler-sparkles" },
|
|
411
|
+
label: "Create your own",
|
|
412
|
+
onClick: () => {
|
|
413
|
+
window.open("/auth", "_blank");
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
];
|
|
417
|
+
return n.sdk.activeUser.value && e.push({
|
|
418
|
+
key: "logout",
|
|
419
|
+
icon: { src: "i-tabler-logout" },
|
|
420
|
+
label: "Logout",
|
|
421
|
+
onClick: async () => {
|
|
422
|
+
await n.sdk.auth.logout();
|
|
423
|
+
}
|
|
424
|
+
}), e;
|
|
425
|
+
});
|
|
426
|
+
return (t, n) => (A(), g(Z, {
|
|
427
|
+
modelValue: i.value,
|
|
428
|
+
"onUpdate:modelValue": n[0] || (n[0] = (e) => i.value = e),
|
|
429
|
+
items: a.value,
|
|
430
|
+
position: "left",
|
|
431
|
+
title: e.title || "Menu"
|
|
432
|
+
}, null, 8, [
|
|
433
|
+
"modelValue",
|
|
434
|
+
"items",
|
|
435
|
+
"title"
|
|
436
|
+
]));
|
|
437
|
+
}
|
|
438
|
+
}), Pe = {
|
|
439
|
+
key: 0,
|
|
440
|
+
class: "absolute inset-0 flex items-center justify-center bg-gradient-to-br from-theme-800 to-theme-950 rounded-3xl z-10"
|
|
441
|
+
}, Fe = ["data-quality"], Ie = {
|
|
442
|
+
key: 0,
|
|
443
|
+
class: "flex flex-1 items-center gap-3 pl-2"
|
|
444
|
+
}, Le = ["src", "alt"], Re = { class: "text-sm font-medium text-white/90" }, ze = {
|
|
445
|
+
key: 1,
|
|
446
|
+
class: "flex justify-end"
|
|
447
|
+
}, Be = { class: "text-sm" }, Ve = {
|
|
448
|
+
key: 0,
|
|
449
|
+
class: "flex-1 basis-0 flex justify-end"
|
|
450
|
+
}, He = {
|
|
451
|
+
key: 0,
|
|
452
|
+
class: "h-full pb-12 flex-1 flex flex-col relative z-20 min-h-0 px-4 @[480px]/bot:px-6 max-w-md mx-auto w-full"
|
|
453
|
+
}, Q = { class: "flex-1 basis-0 flex flex-col justify-start pt-8 gap-7" }, Ue = {
|
|
454
|
+
key: 0,
|
|
455
|
+
class: "flex items-center justify-center gap-3"
|
|
456
|
+
}, We = ["href"], Ge = {
|
|
457
|
+
key: 1,
|
|
458
|
+
class: "flex-1 flex flex-col relative z-20 min-h-0 w-full gap-4 px-4"
|
|
459
|
+
}, Ke = { class: "max-w-md mx-auto" }, qe = {
|
|
460
|
+
key: 2,
|
|
461
|
+
class: "flex-1 flex flex-col relative z-20 min-h-0 w-full px-4 @[480px]/bot:px-6"
|
|
462
|
+
}, Je = { class: "flex-1 min-h-0 max-w-md mx-auto w-full" }, Ye = {
|
|
463
|
+
key: 2,
|
|
464
|
+
class: "bg-gradient-to-br from-theme-800 to-theme-950 text-white flex items-center justify-center h-full p-8"
|
|
465
|
+
}, Xe = { class: "text-center max-w-md space-y-4" }, Ze = { class: "text-sm text-white/70 leading-relaxed" }, Qe = {
|
|
466
|
+
key: 3,
|
|
467
|
+
class: "bg-white/10 backdrop-blur-sm text-white/70 flex items-center justify-center h-full"
|
|
468
|
+
}, $ = /* @__PURE__ */ C({
|
|
469
|
+
__name: "BotChat",
|
|
470
|
+
props: {
|
|
471
|
+
sdk: {},
|
|
472
|
+
bot: {},
|
|
473
|
+
context: {},
|
|
474
|
+
firstMessage: {},
|
|
475
|
+
buttonText: {},
|
|
476
|
+
buttonIcon: {},
|
|
477
|
+
hasClose: {
|
|
478
|
+
type: Boolean,
|
|
479
|
+
default: !1
|
|
480
|
+
},
|
|
481
|
+
isActive: {
|
|
482
|
+
type: Boolean,
|
|
483
|
+
default: !0
|
|
484
|
+
},
|
|
485
|
+
loading: {
|
|
486
|
+
type: Boolean,
|
|
487
|
+
default: !1
|
|
488
|
+
},
|
|
489
|
+
theme: { default: "green" },
|
|
490
|
+
requireAuth: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
default: !1
|
|
493
|
+
},
|
|
494
|
+
chatOnly: {
|
|
495
|
+
type: Boolean,
|
|
496
|
+
default: !1
|
|
497
|
+
},
|
|
498
|
+
bare: {
|
|
499
|
+
type: Boolean,
|
|
500
|
+
default: !1
|
|
501
|
+
},
|
|
502
|
+
emptyStateMessage: {},
|
|
503
|
+
createVoiceClientFn: { type: Function }
|
|
504
|
+
},
|
|
505
|
+
emits: [
|
|
506
|
+
"close",
|
|
507
|
+
"error",
|
|
508
|
+
"turnStarted",
|
|
509
|
+
"turnCompleted"
|
|
510
|
+
],
|
|
511
|
+
setup(o, { emit: c }) {
|
|
512
|
+
let l = c, u = ne(), d = j(!1), p = j(!1), m = j(), C = j(), T = h(() => u.value?.botMode?.value ?? "self"), R = h(() => u.value?.textState.value.isConnected ?? !1), V = h(() => o.sdk.activeUser.value !== void 0), H = h(() => B.find((e) => e.mode === T.value));
|
|
513
|
+
function createChatController() {
|
|
514
|
+
u.value && u.value.destroy();
|
|
515
|
+
try {
|
|
516
|
+
u.value = new i({
|
|
517
|
+
sdk: o.sdk,
|
|
518
|
+
bot: o.bot,
|
|
519
|
+
context: o.context,
|
|
520
|
+
firstMessage: o.firstMessage,
|
|
521
|
+
...o.createVoiceClientFn ? { createVoiceClientFn: o.createVoiceClientFn } : {},
|
|
522
|
+
onTurnStarted: () => l("turnStarted"),
|
|
523
|
+
onTurnCompleted: (e) => l("turnCompleted", e)
|
|
524
|
+
});
|
|
525
|
+
} catch (e) {
|
|
526
|
+
throw console.error("BotChatController creation failed:", e), e;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
try {
|
|
530
|
+
createChatController();
|
|
531
|
+
} catch (e) {
|
|
532
|
+
let t = e instanceof Error ? e.message : "Couldn't initialize your assistant";
|
|
533
|
+
m.value = t, l("error", t);
|
|
534
|
+
}
|
|
535
|
+
function applyTheme(e) {
|
|
536
|
+
if (!C.value) return;
|
|
537
|
+
let t = ee(e);
|
|
538
|
+
Object.entries(t).forEach(([e, t]) => {
|
|
539
|
+
C.value.style.setProperty(`--primary-${e}`, t);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
k(() => {
|
|
543
|
+
try {
|
|
544
|
+
applyTheme(o.theme), o.chatOnly && u.value && u.value.setMode("chat");
|
|
545
|
+
} catch (e) {
|
|
546
|
+
let t = e instanceof Error ? e.message : "Couldn't initialize your assistant";
|
|
547
|
+
m.value = t, l("error", t);
|
|
548
|
+
}
|
|
549
|
+
}), te(() => {
|
|
550
|
+
u.value && u.value.destroy();
|
|
551
|
+
}), I(() => o.theme, (e) => {
|
|
552
|
+
applyTheme(e);
|
|
553
|
+
}), I(() => o.sdk.activeUser.value, (e, t) => {
|
|
554
|
+
t && !e && u.value && u.value.setMode("self");
|
|
555
|
+
});
|
|
556
|
+
let U = h(() => !!(o.bot.cover.value?.src && o.bot.cover.value?.quality === "low") || !!(o.bot.avatar.value?.src && o.bot.avatar.value?.quality === "low")), W = h(() => {
|
|
557
|
+
let e = [U.value ? "backdrop-blur-sm" : ""];
|
|
558
|
+
return U.value && T.value === "self" ? e.push("from-black/80 via-black/60 to-black/80") : T.value === "self" ? e.push("from-black/70 via-black/50 to-black/80") : e.push("from-black/90 via-black/90 to-black/100"), e.join(" ");
|
|
559
|
+
}), G = {
|
|
560
|
+
phone: "i-heroicons-phone",
|
|
561
|
+
calendar: "i-heroicons-calendar",
|
|
562
|
+
question: "i-heroicons-question-mark-circle",
|
|
563
|
+
message: "i-heroicons-chat-bubble-left-right",
|
|
564
|
+
sparkles: "i-heroicons-sparkles"
|
|
565
|
+
}, K = h(() => r({
|
|
566
|
+
template: o.buttonText || "Talk to {name}",
|
|
567
|
+
bot: o.bot.toData()
|
|
568
|
+
})), q = h(() => G[o.buttonIcon || "phone"] || G.phone);
|
|
569
|
+
return (r, i) => (A(), v("div", {
|
|
570
|
+
ref_key: "rootElement",
|
|
571
|
+
ref: C,
|
|
572
|
+
key: o.bot.avatarUrl.value,
|
|
573
|
+
class: "pagelines-sdk @container/bot pagelines-bot w-full h-full overflow-hidden relative",
|
|
574
|
+
"data-test": "bot-chat"
|
|
575
|
+
}, [
|
|
576
|
+
o.loading ? (A(), v("div", Pe, [S(s, { class: "text-white size-8" })])) : o.bot && !m.value ? (A(), v("div", {
|
|
577
|
+
key: 1,
|
|
578
|
+
class: E(["absolute inset-0", o.bare ? "" : "bg-cover bg-center bg-no-repeat"]),
|
|
579
|
+
style: O(o.bare ? void 0 : { backgroundImage: `url(${o.bot.avatarUrl.value})` }),
|
|
580
|
+
"data-quality": o.bot.avatar.value?.quality || "none"
|
|
581
|
+
}, [o.bare ? _("", !0) : (A(), v("div", {
|
|
582
|
+
key: 0,
|
|
583
|
+
class: E(["absolute inset-0 bg-gradient-to-br z-0", W.value])
|
|
584
|
+
}, null, 2)), y("div", { class: E(["relative z-10 flex flex-col h-full transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] will-change-transform", o.isActive ? "opacity-100 translate-y-0" : "opacity-0 translate-y-2"]) }, [!o.bare || o.hasClose ? (A(), v("div", {
|
|
585
|
+
key: 0,
|
|
586
|
+
class: E(["relative z-30 p-2", !o.bare && T.value !== "self" ? "backdrop-blur-lg" : ""])
|
|
587
|
+
}, [o.chatOnly ? (A(), v("div", {
|
|
588
|
+
key: 0,
|
|
589
|
+
class: E(["flex items-center", o.bare ? "justify-end" : ""])
|
|
590
|
+
}, [o.bare ? _("", !0) : (A(), v("div", Ie, [y("img", {
|
|
591
|
+
src: o.bot.avatarUrl.value,
|
|
592
|
+
alt: o.bot.displayName.value,
|
|
593
|
+
class: "size-8 rounded-full object-cover"
|
|
594
|
+
}, null, 8, Le), y("span", Re, P(o.bot.displayName.value), 1)])), o.hasClose ? (A(), v("div", ze, [y("button", {
|
|
595
|
+
class: E(["flex cursor-pointer items-center rounded-2xl p-3 transition-colors", o.bare ? "text-theme-500 hover:bg-theme-50" : "text-white/70 hover:bg-white/10"]),
|
|
596
|
+
onClick: i[0] || (i[0] = z((e) => l("close", "button"), ["stop"]))
|
|
597
|
+
}, [...i[7] || (i[7] = [y("i", { class: "size-6 i-tabler-x" }, null, -1)])], 2)])) : _("", !0)], 2)) : (A(), v("div", {
|
|
598
|
+
key: 1,
|
|
599
|
+
class: E(["flex items-center", o.hasClose ? "" : "justify-between"])
|
|
600
|
+
}, [
|
|
601
|
+
y("div", { class: E(o.hasClose ? "flex-1 basis-0" : "") }, [y("button", {
|
|
602
|
+
class: "cursor-pointer p-2 flex items-center gap-2 rounded-2xl text-white/70 hover:bg-white/10 transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-105 active:scale-95",
|
|
603
|
+
onClick: i[1] || (i[1] = (e) => d.value = !0)
|
|
604
|
+
}, [...i[8] || (i[8] = [y("i", { class: "i-tabler-menu size-7" }, null, -1)])])], 2),
|
|
605
|
+
y("button", {
|
|
606
|
+
class: E(["flex items-center gap-2 px-3.5 py-3 rounded-2xl text-white/90 hover:bg-white/10 transition-all cursor-pointer flex-grow-0", { "bg-white/10": p.value }]),
|
|
607
|
+
onClick: i[2] || (i[2] = (e) => p.value = !0)
|
|
608
|
+
}, [
|
|
609
|
+
y("i", { class: E([H.value?.icon, "size-4 opacity-60"]) }, null, 2),
|
|
610
|
+
y("span", Be, P(H.value?.label), 1),
|
|
611
|
+
i[9] || (i[9] = y("i", { class: "i-tabler-chevron-down size-4" }, null, -1))
|
|
612
|
+
], 2),
|
|
613
|
+
o.hasClose ? (A(), v("div", Ve, [y("button", {
|
|
614
|
+
class: "cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",
|
|
615
|
+
onClick: i[3] || (i[3] = z((e) => l("close", "button"), ["stop"]))
|
|
616
|
+
}, [...i[10] || (i[10] = [y("i", { class: "size-6 i-tabler-x" }, null, -1)])])])) : _("", !0)
|
|
617
|
+
], 2))], 2)) : _("", !0), o.chatOnly ? (A(), v("div", {
|
|
618
|
+
key: 1,
|
|
619
|
+
class: E(["relative z-20 flex min-h-0 w-full flex-1 flex-col", o.bare ? "" : "px-4"])
|
|
620
|
+
}, [y("div", { class: E(["min-h-0 w-full flex-1", o.bare ? "" : "mx-auto max-w-md"]) }, [S(a, {
|
|
621
|
+
"chat-controller": u.value,
|
|
622
|
+
bot: o.bot,
|
|
623
|
+
scope: V.value ? "private" : "public",
|
|
624
|
+
"empty-state-message": o.emptyStateMessage,
|
|
625
|
+
variant: o.bare ? "light" : "dark",
|
|
626
|
+
"show-header": !o.bare,
|
|
627
|
+
centered: o.bare
|
|
628
|
+
}, b({ _: 2 }, [r.$slots["empty-heading"] ? {
|
|
629
|
+
name: "empty-heading",
|
|
630
|
+
fn: L((e) => [N(r.$slots, "empty-heading", D(w(e)))]),
|
|
631
|
+
key: "0"
|
|
632
|
+
} : void 0]), 1032, [
|
|
633
|
+
"chat-controller",
|
|
634
|
+
"bot",
|
|
635
|
+
"scope",
|
|
636
|
+
"empty-state-message",
|
|
637
|
+
"variant",
|
|
638
|
+
"show-header",
|
|
639
|
+
"centered"
|
|
640
|
+
])], 2)], 2)) : (A(), v(f, { key: 2 }, [T.value === "self" ? (A(), v("div", He, [
|
|
641
|
+
i[11] || (i[11] = y("div", { class: "flex-1 basis-0 mb-12" }, null, -1)),
|
|
642
|
+
S(xe, {
|
|
643
|
+
bot: o.bot,
|
|
644
|
+
"is-online": R.value
|
|
645
|
+
}, null, 8, ["bot", "is-online"]),
|
|
646
|
+
y("div", Q, [S(n, {
|
|
647
|
+
theme: "primary",
|
|
648
|
+
size: "lg",
|
|
649
|
+
class: "w-full",
|
|
650
|
+
icon: q.value,
|
|
651
|
+
"data-test": "voice-button",
|
|
652
|
+
onClick: i[4] || (i[4] = (e) => u.value?.setMode("talk"))
|
|
653
|
+
}, {
|
|
654
|
+
default: L(() => [x(P(K.value), 1)]),
|
|
655
|
+
_: 1
|
|
656
|
+
}, 8, ["icon"]), o.bot.accounts.value && o.bot.accounts.value.length > 0 ? (A(), v("div", Ue, [(A(!0), v(f, null, M((o.bot.accounts.value || []).filter((t) => F(e)[t.platform]), (t) => (A(), v("a", {
|
|
657
|
+
key: `${t.platform}-${t.handle}`,
|
|
658
|
+
href: F(e)[t.platform].getUrl(t.handle),
|
|
659
|
+
target: "_blank",
|
|
660
|
+
class: "size-12 rounded-full text-white/60 hover:text-white hover:bg-white/5 border border-white/0 hover:border-white/10 flex items-center justify-center transition-all duration-200 hover:scale-105"
|
|
661
|
+
}, [y("i", { class: E([F(e)[t.platform].icon, "size-5"]) }, null, 2)], 8, We))), 128))])) : _("", !0)])
|
|
662
|
+
])) : T.value === "talk" ? (A(), v("div", Ge, [o.requireAuth && !V.value ? (A(), g(J, {
|
|
663
|
+
key: 0,
|
|
664
|
+
sdk: o.sdk
|
|
665
|
+
}, null, 8, ["sdk"])) : (A(), v(f, { key: 1 }, [y("div", null, [y("div", Ke, [S(t, {
|
|
666
|
+
bot: o.bot,
|
|
667
|
+
"is-online": R.value
|
|
668
|
+
}, null, 8, ["bot", "is-online"])])]), S(a, {
|
|
669
|
+
"chat-controller": u.value,
|
|
670
|
+
bot: o.bot
|
|
671
|
+
}, null, 8, ["chat-controller", "bot"])], 64))])) : (A(), v("div", qe, [y("div", Je, [T.value === "chat" ? (A(), v(f, { key: 0 }, [o.requireAuth && !V.value ? (A(), g(J, {
|
|
672
|
+
key: 0,
|
|
673
|
+
sdk: o.sdk
|
|
674
|
+
}, null, 8, ["sdk"])) : (A(), g(a, {
|
|
675
|
+
key: 1,
|
|
676
|
+
"chat-controller": u.value,
|
|
677
|
+
bot: o.bot,
|
|
678
|
+
"show-header": ""
|
|
679
|
+
}, null, 8, ["chat-controller", "bot"]))], 64)) : T.value === "info" ? (A(), g(de, {
|
|
680
|
+
key: 1,
|
|
681
|
+
bot: o.bot,
|
|
682
|
+
"is-online": R.value
|
|
683
|
+
}, null, 8, ["bot", "is-online"])) : _("", !0)])]))], 64))], 2)], 14, Fe)) : m.value ? (A(), v("div", Ye, [y("div", Xe, [
|
|
684
|
+
i[12] || (i[12] = y("div", { class: "flex justify-center" }, [y("div", { class: "rounded-full bg-red-500/20 flex items-center justify-center size-10" }, [y("i", { class: "i-tabler-alert-circle size-6 text-red-400" })])], -1)),
|
|
685
|
+
i[13] || (i[13] = y("h3", { class: "text-lg font-medium" }, " Bot Error ", -1)),
|
|
686
|
+
y("p", Ze, P(m.value), 1)
|
|
687
|
+
])])) : (A(), v("div", Qe, " Couldn't load your assistant. Please try again later. ")),
|
|
688
|
+
o.chatOnly ? _("", !0) : (A(), g(Ne, {
|
|
689
|
+
key: 4,
|
|
690
|
+
modelValue: d.value,
|
|
691
|
+
"onUpdate:modelValue": i[5] || (i[5] = (e) => d.value = e),
|
|
692
|
+
bot: o.bot,
|
|
693
|
+
sdk: o.sdk,
|
|
694
|
+
title: o.bot.displayName.value,
|
|
695
|
+
"data-test": "bot-sidebar"
|
|
696
|
+
}, null, 8, [
|
|
697
|
+
"modelValue",
|
|
698
|
+
"bot",
|
|
699
|
+
"sdk",
|
|
700
|
+
"title"
|
|
701
|
+
])),
|
|
702
|
+
o.chatOnly ? _("", !0) : (A(), g(Me, {
|
|
703
|
+
key: 5,
|
|
704
|
+
modelValue: p.value,
|
|
705
|
+
"onUpdate:modelValue": i[6] || (i[6] = (e) => p.value = e),
|
|
706
|
+
"chat-controller": u.value,
|
|
707
|
+
"data-test": "bot-mode-sidebar"
|
|
708
|
+
}, null, 8, ["modelValue", "chat-controller"]))
|
|
709
|
+
]));
|
|
710
|
+
}
|
|
711
|
+
}), $e = /* @__PURE__ */ C({
|
|
712
|
+
__name: "BotProvider",
|
|
713
|
+
props: {
|
|
714
|
+
sdk: {},
|
|
715
|
+
bot: {},
|
|
716
|
+
handle: {},
|
|
717
|
+
context: {},
|
|
718
|
+
clientContext: {},
|
|
719
|
+
firstMessage: {},
|
|
720
|
+
buttonText: {},
|
|
721
|
+
buttonIcon: {},
|
|
722
|
+
hasClose: { type: Boolean },
|
|
723
|
+
chatOnly: { type: Boolean },
|
|
724
|
+
bare: { type: Boolean },
|
|
725
|
+
apiBase: {},
|
|
726
|
+
emptyStateMessage: {}
|
|
727
|
+
},
|
|
728
|
+
emits: [
|
|
729
|
+
"close",
|
|
730
|
+
"error",
|
|
731
|
+
"turnStarted",
|
|
732
|
+
"turnCompleted"
|
|
733
|
+
],
|
|
734
|
+
setup(e, { emit: t }) {
|
|
735
|
+
let n = e, r = t;
|
|
736
|
+
return (e, t) => (A(), g(l, T(n, { class: "bot-provider size-full relative" }), {
|
|
737
|
+
default: L((i) => [S($, {
|
|
738
|
+
sdk: i.sdk,
|
|
739
|
+
bot: i.bot,
|
|
740
|
+
context: i.context,
|
|
741
|
+
"first-message": i.firstMessage,
|
|
742
|
+
"button-text": n.buttonText,
|
|
743
|
+
"button-icon": n.buttonIcon,
|
|
744
|
+
"has-close": n.hasClose,
|
|
745
|
+
"chat-only": n.chatOnly,
|
|
746
|
+
bare: n.bare,
|
|
747
|
+
"empty-state-message": n.emptyStateMessage,
|
|
748
|
+
"is-active": !0,
|
|
749
|
+
class: "size-full",
|
|
750
|
+
onClose: t[0] || (t[0] = (e) => r("close", e)),
|
|
751
|
+
onError: t[1] || (t[1] = (e) => r("error", e)),
|
|
752
|
+
onTurnStarted: t[2] || (t[2] = (e) => r("turnStarted")),
|
|
753
|
+
onTurnCompleted: t[3] || (t[3] = (e) => r("turnCompleted", e))
|
|
754
|
+
}, b({ _: 2 }, [e.$slots["empty-heading"] ? {
|
|
755
|
+
name: "empty-heading",
|
|
756
|
+
fn: L((t) => [N(e.$slots, "empty-heading", D(w(t)))]),
|
|
757
|
+
key: "0"
|
|
758
|
+
} : void 0]), 1032, [
|
|
759
|
+
"sdk",
|
|
760
|
+
"bot",
|
|
761
|
+
"context",
|
|
762
|
+
"first-message",
|
|
763
|
+
"button-text",
|
|
764
|
+
"button-icon",
|
|
765
|
+
"has-close",
|
|
766
|
+
"chat-only",
|
|
767
|
+
"bare",
|
|
768
|
+
"empty-state-message"
|
|
769
|
+
])]),
|
|
770
|
+
_: 3
|
|
771
|
+
}, 16));
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
//#endregion
|
|
775
|
+
export { d as i, $ as n, B as r, $e as t };
|
|
776
|
+
|
|
777
|
+
//# sourceMappingURL=BotProvider.js.map
|