@pagelines/sdk 1.0.682 → 1.0.684

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