@pagelines/sdk 1.0.794 → 1.0.796

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/AgentWrap.js CHANGED
@@ -4578,7 +4578,7 @@ var kr = [
4578
4578
  }), oi = 80, si = 600, ci = /* @__PURE__ */ S({
4579
4579
  __name: "ChatScroller",
4580
4580
  setup(e, { expose: t }) {
4581
- let n = M(), r = M(), i = M(!0), a, o = 0;
4581
+ let n = M(), r = M(), i = M(!0), a, o, s = 0;
4582
4582
  function scrollToBottom() {
4583
4583
  let e = n.value;
4584
4584
  e && (e.scrollTop = e.scrollHeight);
@@ -4588,21 +4588,25 @@ var kr = [
4588
4588
  e && (i.value = e.scrollHeight - e.scrollTop - e.clientHeight <= oi);
4589
4589
  }
4590
4590
  function markUserGesture() {
4591
- o = Date.now() + si;
4591
+ s = Date.now() + si;
4592
+ }
4593
+ function followPinned() {
4594
+ i.value && Date.now() > s && scrollToBottom();
4592
4595
  }
4593
4596
  function pin() {
4594
- i.value = !0, o = 0, scrollToBottom(), requestAnimationFrame(() => {
4597
+ i.value = !0, s = 0, scrollToBottom(), requestAnimationFrame(() => {
4595
4598
  scrollToBottom(), requestAnimationFrame(scrollToBottom);
4596
4599
  });
4597
4600
  }
4598
4601
  return t({ pin }), te(() => {
4599
4602
  requestAnimationFrame(() => {
4600
4603
  scrollToBottom(), requestAnimationFrame(scrollToBottom);
4601
- }), r.value && (a = new ResizeObserver(() => {
4602
- i.value && Date.now() > o && scrollToBottom();
4603
- }), a.observe(r.value), n.value && a.observe(n.value));
4604
+ }), r.value && (a = new ResizeObserver(followPinned), a.observe(r.value), n.value && a.observe(n.value), o = new MutationObserver(followPinned), o.observe(r.value, {
4605
+ childList: !0,
4606
+ subtree: !0
4607
+ }));
4604
4608
  }), A(() => {
4605
- a?.disconnect();
4609
+ a?.disconnect(), o?.disconnect();
4606
4610
  }), (e, t) => (j(), _("div", {
4607
4611
  ref_key: "viewport",
4608
4612
  ref: n,
@@ -4840,9 +4844,13 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
4840
4844
  class: "i-tabler-arrow-up size-[17px]"
4841
4845
  }, ga = { class: "sr-only" }, _a = {
4842
4846
  key: 3,
4847
+ "data-test": "messaging-ai-notice",
4848
+ class: "mx-auto max-w-[720px] pt-2 text-center text-[11.5px] leading-none text-theme-300"
4849
+ }, va = {
4850
+ key: 4,
4843
4851
  "data-test": "messaging-suggested-prompts",
4844
4852
  class: "mt-3 w-full sm:mx-auto sm:mt-5 sm:max-w-[720px]"
4845
- }, va = { class: "flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-center" }, ya = ["disabled", "onClick"], ba = ["aria-expanded"], xa = /* @__PURE__ */ S({
4853
+ }, ya = { class: "flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-center" }, ba = ["disabled", "onClick"], xa = ["aria-expanded"], Sa = /* @__PURE__ */ S({
4846
4854
  __name: "ElAgentChat",
4847
4855
  props: {
4848
4856
  chatController: {},
@@ -5015,7 +5023,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5015
5023
  if (!e.chatController || Me.value !== "send") return;
5016
5024
  i.value && (i.value.style.height = "auto", i.value.focus()), r.value?.pin();
5017
5025
  let t = e.chatController.sendComposerMessage();
5018
- window.matchMedia("(hover: none) and (pointer: coarse)").matches && i.value?.blur(), await t;
5026
+ window.matchMedia("(pointer: coarse)").matches && i.value?.blur(), await t;
5019
5027
  }
5020
5028
  async function handleCardAction(t) {
5021
5029
  !e.chatController || Se.value || (r.value?.pin(), await e.chatController.sendChatMessage(t));
@@ -5357,7 +5365,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5357
5365
  "data-test": "messaging-composer-footer",
5358
5366
  class: T(["left-0 right-0 z-30 px-5 pb-[max(env(safe-area-inset-bottom),1rem)]", [
5359
5367
  B.value.length === 0 || e.centered ? "relative shrink-0" : "absolute bottom-0",
5360
- e.centered && B.value.length > 0 ? "pt-0" : "pt-3",
5368
+ e.centered && B.value.length > 0 ? "pt-0 sm:pb-7" : "pt-3",
5361
5369
  K.value ? e.centered ? "bg-theme-0" : "bg-gradient-to-t from-theme-0/90 via-theme-0/55 to-transparent" : "bg-gradient-to-t from-black/90 via-black/60 to-transparent"
5362
5370
  ]])
5363
5371
  }, [
@@ -5396,7 +5404,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5396
5404
  v("div", {
5397
5405
  "data-test": "messaging-composer",
5398
5406
  "data-composer-action": Me.value,
5399
- class: T(["w-full cursor-text rounded-2xl px-4 pb-2.5 pt-3 transition-colors duration-200", [e.centered ? "max-w-[720px] mx-auto" : "", K.value ? "bg-white shadow-[0_1px_2px_rgba(15,23,42,0.05),0_8px_24px_rgba(15,23,42,0.05)] ring-1 ring-theme-200 hover:ring-theme-300 focus-within:ring-theme-300" : "bg-white/10 backdrop-blur-xl ring-1 ring-white/15 hover:ring-white/25 focus-within:bg-white/15 focus-within:ring-white/25"]]),
5407
+ class: T(["w-full cursor-text rounded-2xl px-4 pb-2.5 pt-3 transition-colors duration-200", [e.centered ? B.value.length === 0 ? "max-w-[680px] mx-auto" : "max-w-[720px] mx-auto" : "", K.value ? "bg-white shadow-[0_1px_2px_rgba(15,23,42,0.05),0_8px_24px_rgba(15,23,42,0.05)] ring-1 ring-theme-200 hover:ring-theme-300 focus-within:ring-theme-300" : "bg-white/10 backdrop-blur-xl ring-1 ring-white/15 hover:ring-white/25 focus-within:bg-white/15 focus-within:ring-white/25"]]),
5400
5408
  onClick: focusComposer
5401
5409
  }, [Be.value ? (j(), _("div", {
5402
5410
  key: 1,
@@ -5513,34 +5521,35 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5513
5521
  onClick: o[20] || (o[20] = (e) => handleComposerAction())
5514
5522
  }, [Me.value === "stop" ? (j(), _("i", ma)) : (j(), _("i", ha)), v("span", ga, I(Le.value), 1)], 10, pa)], 64))])
5515
5523
  ])], 10, ea),
5516
- !We.value && B.value.length === 0 && e.suggestedPrompts.length > 0 ? (j(), _("div", _a, [v("div", va, [(j(!0), _(f, null, P(e.suggestedPrompts, (e, t) => (j(), _("button", {
5524
+ e.centered && B.value.length > 0 ? (j(), _("p", _a, I(e.agent.displayName.value) + " is AI and can make mistakes. ", 1)) : h("", !0),
5525
+ !We.value && B.value.length === 0 && e.suggestedPrompts.length > 0 ? (j(), _("div", va, [v("div", ya, [(j(!0), _(f, null, P(e.suggestedPrompts, (e, t) => (j(), _("button", {
5517
5526
  key: e.id,
5518
5527
  type: "button",
5519
5528
  disabled: Se.value,
5520
5529
  "data-test": "messaging-suggested-prompt",
5521
5530
  class: T(["w-full rounded-2xl bg-theme-50 px-4 py-3 text-left text-[14.5px] font-medium transition-colors sm:w-auto sm:rounded-full sm:py-2 sm:text-center sm:text-[14px]", [Se.value ? "cursor-not-allowed text-theme-300" : "cursor-pointer text-theme-600 hover:bg-theme-100 hover:text-theme-900", !A.value && t >= 3 ? "max-sm:hidden" : ""]]),
5522
5531
  onClick: (t) => sendSuggestedPrompt(e)
5523
- }, I(e.label), 11, ya))), 128)), e.suggestedPrompts.length > 3 ? (j(), _("button", {
5532
+ }, I(e.label), 11, ba))), 128)), e.suggestedPrompts.length > 3 ? (j(), _("button", {
5524
5533
  key: 0,
5525
5534
  type: "button",
5526
5535
  "data-test": "messaging-suggested-prompts-more",
5527
5536
  "aria-expanded": A.value,
5528
5537
  class: "flex w-full cursor-pointer items-center justify-center gap-1.5 rounded-2xl px-4 py-3 text-[14px] font-medium text-theme-600 ring-1 ring-theme-200 transition-colors hover:bg-theme-50 hover:text-theme-900 sm:hidden",
5529
5538
  onClick: o[21] || (o[21] = (e) => A.value = !A.value)
5530
- }, [b(I(A.value ? "See less" : "See more") + " ", 1), v("i", { class: T(["i-tabler-chevron-down size-4 transition-transform", A.value ? "rotate-180" : ""]) }, null, 2)], 8, ba)) : h("", !0)])])) : h("", !0)
5539
+ }, [b(I(A.value ? "See less" : "See more") + " ", 1), v("i", { class: T(["i-tabler-chevron-down size-4 transition-transform", A.value ? "rotate-180" : ""]) }, null, 2)], 8, xa)) : h("", !0)])])) : h("", !0)
5531
5540
  ], 2)
5532
5541
  ], 2));
5533
5542
  }
5534
- }), Sa = { class: "agent-wrap" }, Ca = {
5543
+ }), Ca = { class: "agent-wrap" }, wa = {
5535
5544
  key: 0,
5536
5545
  class: "flex items-center justify-center h-full"
5537
- }, wa = {
5546
+ }, Ta = {
5538
5547
  key: 2,
5539
5548
  class: "flex h-full flex-col items-center justify-center gap-4 px-6 text-center",
5540
5549
  role: "status",
5541
5550
  "aria-live": "polite",
5542
5551
  "data-test": "agent-unavailable"
5543
- }, Ta = /* @__PURE__ */ S({
5552
+ }, Ea = /* @__PURE__ */ S({
5544
5553
  __name: "AgentWrap",
5545
5554
  props: {
5546
5555
  sdk: {},
@@ -5636,7 +5645,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5636
5645
  });
5637
5646
  }
5638
5647
  }
5639
- return te(loadAgent), (t, n) => (j(), _("div", Sa, [s.value ? (j(), _("div", Ca, [v("div", { class: T(["size-6 animate-spin rounded-full border-b-2", i.bare ? "border-theme-400" : "border-white"]) }, null, 2)])) : c.value ? re(t.$slots, "default", {
5648
+ return te(loadAgent), (t, n) => (j(), _("div", Ca, [s.value ? (j(), _("div", wa, [v("div", { class: T(["size-6 animate-spin rounded-full border-b-2", i.bare ? "border-theme-400" : "border-white"]) }, null, 2)])) : c.value ? re(t.$slots, "default", {
5640
5649
  sdk: ae(o),
5641
5650
  agent: c.value,
5642
5651
  context: e.clientContext ?? e.context,
@@ -5644,7 +5653,7 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5644
5653
  buttonText: e.buttonText,
5645
5654
  buttonIcon: e.buttonIcon,
5646
5655
  loading: s.value
5647
- }, void 0, void 0, 1) : u.value ? (j(), _("div", wa, [n[0] || (n[0] = v("p", { class: "text-sm font-medium text-theme-600" }, " This assistant is unavailable right now. ", -1)), v("button", {
5656
+ }, void 0, void 0, 1) : u.value ? (j(), _("div", Ta, [n[0] || (n[0] = v("p", { class: "text-sm font-medium text-theme-600" }, " This assistant is unavailable right now. ", -1)), v("button", {
5648
5657
  type: "button",
5649
5658
  class: "min-h-11 rounded-full bg-theme-900 px-5 text-sm font-semibold text-theme-0 transition-colors hover:bg-theme-700",
5650
5659
  "data-test": "agent-unavailable-retry",
@@ -5653,6 +5662,6 @@ var di = ["data-voice-state", "data-voice-activity"], fi = { class: "flex flex-1
5653
5662
  }
5654
5663
  });
5655
5664
  //#endregion
5656
- export { Pe as a, we as c, parseButtonTemplate as d, AgentChatController as f, pe as h, ai as i, getAgentAvatarUrl as l, n as m, xa as n, Oe as o, he as p, yi as r, Ee as s, Ta as t, handleImageError as u };
5665
+ export { Pe as a, we as c, parseButtonTemplate as d, AgentChatController as f, pe as h, ai as i, getAgentAvatarUrl as l, n as m, Sa as n, Oe as o, he as p, yi as r, Ee as s, Ea as t, handleImageError as u };
5657
5666
 
5658
5667
  //# sourceMappingURL=AgentWrap.js.map