@pluno/product-agent-web 0.1.28 → 0.1.29

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.
@@ -1,4 +1,4 @@
1
- import { PlunoProductAgent as qt } from "./product-agent-sdk.js";
1
+ import { PlunoProductAgent as jt } from "./product-agent-sdk.js";
2
2
  const Kt = "#7c3aed";
3
3
  function Yt(e) {
4
4
  const t = en(e);
@@ -78,15 +78,15 @@ function Yt(e) {
78
78
  function Xt(e) {
79
79
  return `data:image/svg+xml,${encodeURIComponent(Yt(e))}`;
80
80
  }
81
- const X = "#2c2a1e", je = [253, 250, 241], qe = 3.5;
81
+ const X = "#2c2a1e", qe = [253, 250, 241], je = 3.5;
82
82
  function bt(e) {
83
83
  const t = wt(e);
84
- if (Ke(ae(t), je) >= qe)
84
+ if (Ke(ae(t), qe) >= je)
85
85
  return t;
86
86
  let o = ae(t);
87
87
  const a = ae(X);
88
88
  for (let i = 0; i < 6; i += 1)
89
- if (o = tn(o, a, 0.22), Ke(o, je) >= qe)
89
+ if (o = tn(o, a, 0.22), Ke(o, qe) >= je)
90
90
  return Le(o);
91
91
  return Le(o);
92
92
  }
@@ -427,7 +427,7 @@ async function Vn(e = {}) {
427
427
  return u.token;
428
428
  }), R = window.fetch.bind(window);
429
429
  let w;
430
- w = await qt.init({
430
+ w = await jt.init({
431
431
  token: t.token,
432
432
  tokenProvider: I,
433
433
  backendUrl: t.backendUrl,
@@ -442,8 +442,8 @@ async function Vn(e = {}) {
442
442
  webSocketFactory: t.webSocketFactory,
443
443
  autoConnect: t.loginRequired ? !1 : void 0
444
444
  });
445
- const H = Vo(t), ge = new Set(H.openToolGroupKeys), j = new Set(H.seenShareCandidateIds), ie = new Set(j);
446
- let he = H.sharePromptsDisabled || await jo(t), F = t.movableLauncher ? H.launcherPosition : null, Oe = F !== null, G = null, me = !1;
445
+ const H = Vo(t), ge = new Set(H.openToolGroupKeys), q = new Set(H.seenShareCandidateIds), ie = new Set(q);
446
+ let he = H.sharePromptsDisabled || await qo(t), F = t.movableLauncher ? H.launcherPosition : null, Oe = F !== null, G = null, me = !1;
447
447
  const Ut = () => {
448
448
  me || typeof document > "u" || (gt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
449
449
  }, Be = new MutationObserver(Ut);
@@ -461,7 +461,7 @@ async function Vn(e = {}) {
461
461
  composerValue: g.value,
462
462
  openToolGroupKeys: [...ge],
463
463
  launcherPosition: Oe ? F : null,
464
- seenShareCandidateIds: [...j].slice(-xt),
464
+ seenShareCandidateIds: [...q].slice(-xt),
465
465
  sharePromptsDisabled: he
466
466
  });
467
467
  }, W = (r, u = {}) => {
@@ -506,7 +506,7 @@ async function Vn(e = {}) {
506
506
  };
507
507
  let ze = () => {
508
508
  };
509
- window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze = qn({
509
+ window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze = jn({
510
510
  root: a,
511
511
  launcher: c,
512
512
  launcherDragHandle: d,
@@ -530,7 +530,7 @@ async function Vn(e = {}) {
530
530
  be = !1;
531
531
  }
532
532
  }
533
- }, q = (r = "", u = !0) => {
533
+ }, j = (r = "", u = !0) => {
534
534
  Ge(), G !== null && (window.clearTimeout(G), G = null), f.hidden = !1, v.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
535
535
  const A = re(), ne = at(a, A, t.position);
536
536
  if (Fe(ne, A), W("Opening launcher at clamped open panel position", { openPanelPosition: ne, visibleLauncherPosition: A }), !u) {
@@ -548,18 +548,18 @@ async function Vn(e = {}) {
548
548
  }, 220);
549
549
  };
550
550
  c.addEventListener("submit", (r) => {
551
- r.preventDefault(), q(s.value), s.value = "";
551
+ r.preventDefault(), j(s.value), s.value = "";
552
552
  }), d?.addEventListener("click", (r) => {
553
553
  r.preventDefault(), r.stopPropagation();
554
554
  }), c.addEventListener("click", (r) => {
555
- r.target === s && !d || (q(s.value), s.value = "");
555
+ r.target === s && !d || (j(s.value), s.value = "");
556
556
  }), s.addEventListener("focus", () => {
557
- q(s.value), s.value = "";
557
+ j(s.value), s.value = "";
558
558
  }), s.addEventListener("input", () => {
559
559
  if (!s.value)
560
560
  return;
561
561
  const r = s.value;
562
- q(r), s.value = "";
562
+ j(r), s.value = "";
563
563
  }), v.addEventListener("click", zt);
564
564
  const O = () => {
565
565
  h.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && b.length === 0;
@@ -626,7 +626,7 @@ async function Vn(e = {}) {
626
626
  }
627
627
  }), a.addEventListener("click", (r) => {
628
628
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && M();
629
- }), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen && q(g.value, !1);
629
+ }), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen && j(g.value, !1);
630
630
  const $e = () => i;
631
631
  let we = w.getState().appearance !== null, le = null, te = null, K = null, He = w.getState().isThinking, Y = null, _e = null, We = () => {
632
632
  };
@@ -654,16 +654,16 @@ async function Vn(e = {}) {
654
654
  draftingCandidateId: le,
655
655
  error: te,
656
656
  onSeen: (u) => {
657
- j.add(u.id), M();
657
+ q.add(u.id), M();
658
658
  },
659
659
  onDraft: (u) => {
660
- jt(u);
660
+ qt(u);
661
661
  },
662
662
  onDismiss: (u) => {
663
- j.add(u.id), ie.add(u.id), M(), te = null, T(w.getState());
663
+ q.add(u.id), ie.add(u.id), M(), te = null, T(w.getState());
664
664
  },
665
665
  onDisable: (u) => {
666
- he = !0, j.add(u.id), ie.add(u.id), M(), qo(t, !0), te = null, T(w.getState());
666
+ he = !0, q.add(u.id), ie.add(u.id), M(), jo(t, !0), te = null, T(w.getState());
667
667
  }
668
668
  } : void 0
669
669
  );
@@ -693,13 +693,13 @@ async function Vn(e = {}) {
693
693
  ), O());
694
694
  },
695
695
  openPanel: () => {
696
- q(g.value, !1);
696
+ j(g.value, !1);
697
697
  },
698
698
  destroy: () => {
699
699
  me = !0, Be.disconnect(), window.removeEventListener("resize", Ue), ze(), C !== null && window.clearTimeout(C), We(), K?.remove(), w.destroy(), n.remove();
700
700
  }
701
701
  };
702
- async function jt(r) {
702
+ async function qt(r) {
703
703
  if (!le) {
704
704
  le = r.id, te = null, T(w.getState());
705
705
  try {
@@ -708,7 +708,7 @@ async function Vn(e = {}) {
708
708
  const u = await t.socialPostDraftHandler(r);
709
709
  if (!u.linkedinPost || !u.xPost)
710
710
  throw new Error("Pluno did not return a complete social post draft.");
711
- j.add(r.id), ie.add(r.id), M(), K?.remove(), K = Io(u, {
711
+ q.add(r.id), ie.add(r.id), M(), K?.remove(), K = Io(u, {
712
712
  socialPostRewardsUrl: t.socialPostRewardsUrl,
713
713
  onClose: () => {
714
714
  K?.remove(), K = null;
@@ -745,12 +745,12 @@ function tt(e, t) {
745
745
  function nt(e, t, n) {
746
746
  e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
747
747
  const o = n.scribbleStyle ? bt(n.accentColor) : n.accentColor;
748
- e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle && jn(e.ownerDocument);
748
+ e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle && qn(e.ownerDocument);
749
749
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
750
750
  for (const i of a)
751
751
  i.src = t;
752
752
  }
753
- function jn(e) {
753
+ function qn(e) {
754
754
  if (e.getElementById(Qe))
755
755
  return;
756
756
  const t = e.createElement("style");
@@ -762,7 +762,7 @@ function jn(e) {
762
762
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
763
763
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
764
764
  }
765
- function qn({
765
+ function jn({
766
766
  root: e,
767
767
  launcher: t,
768
768
  launcherDragHandle: n,
@@ -1530,8 +1530,8 @@ function Fo(e, t, n, o) {
1530
1530
  const i = document.createElement("img");
1531
1531
  i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1532
1532
  const l = document.createElement("details"), p = zo(e);
1533
- l.open = t.has(p), l.addEventListener("toggle", () => {
1534
- l.open ? t.add(p) : t.delete(p), n();
1533
+ l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
1534
+ a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
1535
1535
  });
1536
1536
  const c = document.createElement("summary");
1537
1537
  c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(Me());
@@ -1568,7 +1568,7 @@ function Rt() {
1568
1568
  return n.textContent = "Thinking...", e.appendChild(n), e;
1569
1569
  }
1570
1570
  function zo(e) {
1571
- return `tools:${e.map((t) => t.id).join("|")}`;
1571
+ return `tools:${e[0]?.id ?? ""}`;
1572
1572
  }
1573
1573
  function Me() {
1574
1574
  const e = document.createElement("span");
@@ -3151,6 +3151,12 @@ function gt(e, t) {
3151
3151
  align-items: center;
3152
3152
  margin-bottom: -8px;
3153
3153
  }
3154
+ .pluno-pa-widget--scribble .pluno-pa-widget__assistant-marker:not(.pluno-pa-widget__thinking-marker) {
3155
+ margin-bottom: -12px;
3156
+ }
3157
+ .pluno-pa-widget--scribble .pluno-pa-widget__tool-group.pluno-pa-widget__tool-group--open {
3158
+ align-items: flex-start;
3159
+ }
3154
3160
  .pluno-pa-widget--scribble .pluno-pa-widget__tool-group details {
3155
3161
  transform: translateY(-3px);
3156
3162
  }
@@ -3408,7 +3414,7 @@ function Vo(e) {
3408
3414
  return ht();
3409
3415
  }
3410
3416
  }
3411
- async function jo(e) {
3417
+ async function qo(e) {
3412
3418
  if (e.loadSharePromptsDisabled)
3413
3419
  return e.loadSharePromptsDisabled();
3414
3420
  try {
@@ -3417,7 +3423,7 @@ async function jo(e) {
3417
3423
  return !1;
3418
3424
  }
3419
3425
  }
3420
- function qo(e, t) {
3426
+ function jo(e, t) {
3421
3427
  if (e.persistSharePromptsDisabled) {
3422
3428
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3423
3429
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Browser SDK and default widget for embedding Pluno Product Agent into customer web apps.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",