@pluno/product-agent-web 0.1.63 → 0.1.64
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/product-agent-widget.js +106 -103
- package/package.json +1 -1
|
@@ -173,8 +173,8 @@ function Ho(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
n = Math.round(g + (c - g) * qo(
|
|
176
|
+
const w = Math.min(1, (performance.now() - S) / zo);
|
|
177
|
+
n = Math.round(g + (c - g) * qo(w)), e(n), w >= 1 && (n = c, e(c), l());
|
|
178
178
|
}, Uo);
|
|
179
179
|
}, u = async () => {
|
|
180
180
|
try {
|
|
@@ -224,7 +224,7 @@ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-conne
|
|
|
224
224
|
scribbleStyle: !1,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
movableLauncher: !1
|
|
227
|
-
}, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680,
|
|
227
|
+
}, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680, wi = 800, bi = 0.76, W = 8, Pt = 50, Hn = "http://www.w3.org/2000/svg", cn = 26, un = 8, _i = 36, gn = [
|
|
228
228
|
{
|
|
229
229
|
ellipseCx: "17.5",
|
|
230
230
|
ellipseCy: "24.5",
|
|
@@ -350,7 +350,7 @@ async function ki(e = {}) {
|
|
|
350
350
|
p,
|
|
351
351
|
t.position
|
|
352
352
|
)
|
|
353
|
-
)), Nn(n, t.accentColor),
|
|
353
|
+
)), Nn(n, t.accentColor), wn(i, r, {
|
|
354
354
|
accentColor: t.accentColor,
|
|
355
355
|
colorScheme: t.colorScheme,
|
|
356
356
|
fontFamily: t.fontFamily,
|
|
@@ -371,7 +371,7 @@ async function ki(e = {}) {
|
|
|
371
371
|
".pluno-pa-widget__launcher"
|
|
372
372
|
), S = i.querySelector(
|
|
373
373
|
".pluno-pa-widget__launcher-drag-handle"
|
|
374
|
-
),
|
|
374
|
+
), w = i.querySelector(
|
|
375
375
|
".pluno-pa-widget__launcher-input"
|
|
376
376
|
), H = i.querySelector(
|
|
377
377
|
".pluno-pa-widget__launcher-minimize"
|
|
@@ -422,11 +422,11 @@ async function ki(e = {}) {
|
|
|
422
422
|
), ao = i.querySelector(
|
|
423
423
|
".pluno-pa-widget__notify-suggestion-never"
|
|
424
424
|
);
|
|
425
|
-
if (!g || !
|
|
425
|
+
if (!g || !w || !k || !y || !v || !h || !N || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
|
|
426
426
|
throw new Error("Failed to mount Pluno widget");
|
|
427
427
|
if (t.movableLauncher && !S)
|
|
428
428
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
429
|
-
vn(
|
|
429
|
+
vn(w), vn(f);
|
|
430
430
|
let B = [], ie = null;
|
|
431
431
|
const ve = () => {
|
|
432
432
|
ga(
|
|
@@ -435,7 +435,7 @@ async function ki(e = {}) {
|
|
|
435
435
|
(a) => {
|
|
436
436
|
B = B.filter(
|
|
437
437
|
(s, _) => _ !== a
|
|
438
|
-
), ve(), F(
|
|
438
|
+
), ve(), F(b.getState()), q();
|
|
439
439
|
}
|
|
440
440
|
);
|
|
441
441
|
}, ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
@@ -457,14 +457,14 @@ async function ki(e = {}) {
|
|
|
457
457
|
throw new Error("Pluno token endpoint did not return a token");
|
|
458
458
|
return s.token;
|
|
459
459
|
}), lo = window.fetch.bind(window);
|
|
460
|
-
let
|
|
461
|
-
|
|
460
|
+
let b;
|
|
461
|
+
b = await So.init({
|
|
462
462
|
token: t.token,
|
|
463
463
|
tokenProvider: ro,
|
|
464
464
|
backendUrl: t.backendUrl,
|
|
465
465
|
metadata: () => ({
|
|
466
466
|
...t.metadata ?? {},
|
|
467
|
-
...!
|
|
467
|
+
...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
468
468
|
}),
|
|
469
469
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
470
470
|
clientId: t.clientId,
|
|
@@ -488,7 +488,7 @@ async function ki(e = {}) {
|
|
|
488
488
|
x.hidden = !1;
|
|
489
489
|
}, so = (a = "jump") => {
|
|
490
490
|
X(!0, a), Z(), We(I, () => me.enabled), fe = I.scrollTop;
|
|
491
|
-
},
|
|
491
|
+
}, we = () => {
|
|
492
492
|
if (ue.hidden = t.loginRequired, ye.hidden = !le, ue.setAttribute("aria-expanded", String(le)), G.classList.toggle(
|
|
493
493
|
"pluno-pa-widget__history-list--center",
|
|
494
494
|
ae && pe.length === 0
|
|
@@ -508,7 +508,7 @@ async function ki(e = {}) {
|
|
|
508
508
|
);
|
|
509
509
|
const P = document.createElement("small");
|
|
510
510
|
P.className = "pluno-pa-widget__history-path", P.textContent = ji(a), s.append(_, E, P), s.addEventListener("click", () => {
|
|
511
|
-
le = !1, De = null,
|
|
511
|
+
le = !1, De = null, we(), X(!0, "newSession"), Z(), b.loadSession(a.id), F(b.getState());
|
|
512
512
|
}), G.appendChild(s);
|
|
513
513
|
}
|
|
514
514
|
if (ae && pe.length > 0) {
|
|
@@ -518,9 +518,9 @@ async function ki(e = {}) {
|
|
|
518
518
|
Y.textContent = De ?? (!ae && pe.length === 0 ? "No recent chats for this page yet." : ""), Y.hidden = Y.textContent.length === 0;
|
|
519
519
|
}, Ht = async (a) => {
|
|
520
520
|
if (!ae) {
|
|
521
|
-
ae = !0, De = null,
|
|
521
|
+
ae = !0, De = null, we();
|
|
522
522
|
try {
|
|
523
|
-
const s = await
|
|
523
|
+
const s = await b.listSessions({ cursor: a, limit: 20 });
|
|
524
524
|
pe = a ? [...pe, ...s.sessions] : s.sessions, st = s.nextCursor;
|
|
525
525
|
} catch (s) {
|
|
526
526
|
K(
|
|
@@ -531,7 +531,7 @@ async function ki(e = {}) {
|
|
|
531
531
|
}
|
|
532
532
|
), De = li;
|
|
533
533
|
} finally {
|
|
534
|
-
ae = !1,
|
|
534
|
+
ae = !1, we();
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
}, co = () => {
|
|
@@ -555,7 +555,7 @@ async function ki(e = {}) {
|
|
|
555
555
|
s
|
|
556
556
|
);
|
|
557
557
|
}, O = () => {
|
|
558
|
-
const a = Fi(n,
|
|
558
|
+
const a = Fi(n, w, f);
|
|
559
559
|
Va(t, {
|
|
560
560
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
561
561
|
composerValue: f.value,
|
|
@@ -583,7 +583,7 @@ async function ki(e = {}) {
|
|
|
583
583
|
t.position
|
|
584
584
|
)
|
|
585
585
|
), _n(i), O(), s && je("minimized");
|
|
586
|
-
},
|
|
586
|
+
}, be = (a, s = {}) => {
|
|
587
587
|
Bi(a, {
|
|
588
588
|
debugVersion: Si,
|
|
589
589
|
launcherPosition: p,
|
|
@@ -606,7 +606,7 @@ async function ki(e = {}) {
|
|
|
606
606
|
if (!p)
|
|
607
607
|
return xe(i, null), dt(a);
|
|
608
608
|
const s = dt(a);
|
|
609
|
-
return xe(i, s),
|
|
609
|
+
return xe(i, s), be("Applied stored closed launcher position", {
|
|
610
610
|
visibleLauncherPosition: s
|
|
611
611
|
}), s;
|
|
612
612
|
}, Gt = (a, s) => {
|
|
@@ -632,16 +632,16 @@ async function ki(e = {}) {
|
|
|
632
632
|
}
|
|
633
633
|
const a = Me();
|
|
634
634
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
635
|
-
const s =
|
|
635
|
+
const s = bn(
|
|
636
636
|
i,
|
|
637
637
|
a,
|
|
638
638
|
t.position
|
|
639
639
|
);
|
|
640
|
-
Gt(s, a),
|
|
640
|
+
Gt(s, a), be(
|
|
641
641
|
"Applied open panel position after viewport resize",
|
|
642
642
|
{ openPanelPosition: s }
|
|
643
643
|
);
|
|
644
|
-
} else p &&
|
|
644
|
+
} else p && be(
|
|
645
645
|
"Applied visible launcher position after viewport resize",
|
|
646
646
|
{ visibleLauncherPosition: a }
|
|
647
647
|
);
|
|
@@ -662,12 +662,12 @@ async function ki(e = {}) {
|
|
|
662
662
|
p = Ri(
|
|
663
663
|
E,
|
|
664
664
|
_
|
|
665
|
-
), xe(i, E),
|
|
665
|
+
), xe(i, E), be("Dragging closed launcher", {
|
|
666
666
|
requestedPosition: s
|
|
667
667
|
});
|
|
668
668
|
},
|
|
669
669
|
persist: () => {
|
|
670
|
-
d = !0, O(),
|
|
670
|
+
d = !0, O(), be("Persisted closed launcher drag position");
|
|
671
671
|
}
|
|
672
672
|
})) : xe(i, null);
|
|
673
673
|
let ct = !1;
|
|
@@ -679,11 +679,11 @@ async function ki(e = {}) {
|
|
|
679
679
|
Sn(
|
|
680
680
|
t.billingStatus,
|
|
681
681
|
a,
|
|
682
|
-
|
|
682
|
+
b.getState().lastErrorCode
|
|
683
683
|
) && (t.billingStatus = a, Lt(
|
|
684
684
|
N,
|
|
685
685
|
t.billingStatus,
|
|
686
|
-
|
|
686
|
+
b.getState().lastErrorCode
|
|
687
687
|
), q());
|
|
688
688
|
} finally {
|
|
689
689
|
ct = !1;
|
|
@@ -691,12 +691,12 @@ async function ki(e = {}) {
|
|
|
691
691
|
}
|
|
692
692
|
}, se = (a = "", s = !0) => {
|
|
693
693
|
jt(), Oe && (Oe = !1, gt()), V !== null && (window.clearTimeout(V), V = null), Re("shown", !1), k.hidden = !1, y.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
|
|
694
|
-
const _ = Me(), E =
|
|
694
|
+
const _ = Me(), E = bn(
|
|
695
695
|
i,
|
|
696
696
|
_,
|
|
697
697
|
t.position
|
|
698
698
|
);
|
|
699
|
-
if (Gt(E, _),
|
|
699
|
+
if (Gt(E, _), be("Opening launcher at clamped open panel position", {
|
|
700
700
|
openPanelPosition: E,
|
|
701
701
|
visibleLauncherPosition: _
|
|
702
702
|
}), X(!0, "open"), Z(), !s) {
|
|
@@ -709,26 +709,26 @@ async function ki(e = {}) {
|
|
|
709
709
|
}, 220);
|
|
710
710
|
});
|
|
711
711
|
}, go = () => {
|
|
712
|
-
V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1),
|
|
712
|
+
V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), O(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
|
|
713
713
|
k.hidden = !0, y.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
|
|
714
714
|
}, 220);
|
|
715
715
|
};
|
|
716
716
|
g.addEventListener("submit", (a) => {
|
|
717
|
-
a.preventDefault(), se(
|
|
717
|
+
a.preventDefault(), se(w.value), w.value = "";
|
|
718
718
|
}), S?.addEventListener("click", (a) => {
|
|
719
719
|
a.preventDefault(), a.stopPropagation();
|
|
720
720
|
}), g.addEventListener("click", (a) => {
|
|
721
|
-
a.target ===
|
|
722
|
-
}),
|
|
723
|
-
se(
|
|
724
|
-
}),
|
|
725
|
-
if (!
|
|
721
|
+
a.target === w && !S || (se(w.value), w.value = "");
|
|
722
|
+
}), w.addEventListener("focus", () => {
|
|
723
|
+
se(w.value), w.value = "";
|
|
724
|
+
}), w.addEventListener("input", () => {
|
|
725
|
+
if (!w.value)
|
|
726
726
|
return;
|
|
727
|
-
const a =
|
|
728
|
-
se(a),
|
|
727
|
+
const a = w.value;
|
|
728
|
+
se(a), w.value = "";
|
|
729
729
|
});
|
|
730
730
|
let ut = null, Ve = null, _e = null;
|
|
731
|
-
const Vt = (a) => a ===
|
|
731
|
+
const Vt = (a) => a === w || a === f, ho = (a) => {
|
|
732
732
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
733
733
|
return null;
|
|
734
734
|
let s = a;
|
|
@@ -798,13 +798,13 @@ async function ki(e = {}) {
|
|
|
798
798
|
let ze = null, Oe = !1;
|
|
799
799
|
const Ye = () => {
|
|
800
800
|
const a = Ke(), s = ze !== null;
|
|
801
|
-
|
|
801
|
+
w.readOnly = a || s, f.readOnly = s, w.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
|
|
802
802
|
}, q = () => {
|
|
803
|
-
R.disabled = te(t.billingStatus) || !
|
|
803
|
+
R.disabled = te(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && B.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
|
|
804
804
|
};
|
|
805
805
|
Ye();
|
|
806
806
|
const gt = () => {
|
|
807
|
-
const a =
|
|
807
|
+
const a = b.getState().isThinking;
|
|
808
808
|
i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
|
|
809
809
|
"pluno-pa-widget--unread",
|
|
810
810
|
!a && Oe
|
|
@@ -820,25 +820,25 @@ async function ki(e = {}) {
|
|
|
820
820
|
return;
|
|
821
821
|
}
|
|
822
822
|
te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), B = Et(
|
|
823
|
-
|
|
823
|
+
b,
|
|
824
824
|
f,
|
|
825
825
|
B
|
|
826
826
|
), ve(), q());
|
|
827
827
|
});
|
|
828
828
|
let Ue = 0;
|
|
829
|
-
const
|
|
829
|
+
const wo = () => {
|
|
830
830
|
Ue = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
831
831
|
}, ht = (a) => {
|
|
832
832
|
ie !== null && window.clearTimeout(ie), h.textContent = a, h.hidden = !1, ie = window.setTimeout(() => {
|
|
833
833
|
h.textContent = "", h.hidden = !0, ie = null;
|
|
834
834
|
}, 3e3);
|
|
835
|
-
},
|
|
835
|
+
}, bo = () => {
|
|
836
836
|
ie !== null && (window.clearTimeout(ie), ie = null), h.textContent = "", h.hidden = !0;
|
|
837
837
|
}, mt = async (a) => {
|
|
838
838
|
if (a.length === 0)
|
|
839
839
|
return;
|
|
840
|
-
const s = fa(
|
|
841
|
-
B = [...B, ...s], ve(),
|
|
840
|
+
const s = fa(b, a);
|
|
841
|
+
B = [...B, ...s], ve(), bo(), q(), F(b.getState()), i.classList.contains("pluno-pa-widget--open") || se();
|
|
842
842
|
};
|
|
843
843
|
Pe.addEventListener("click", () => {
|
|
844
844
|
t.loginRequired || te(t.billingStatus) || L.click();
|
|
@@ -860,7 +860,7 @@ async function ki(e = {}) {
|
|
|
860
860
|
Qe(a.dataTransfer) && (a.stopPropagation(), Ue = Math.max(0, Ue - 1), Ue === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
861
861
|
}), i.addEventListener("drop", (a) => {
|
|
862
862
|
const s = a.dataTransfer;
|
|
863
|
-
!Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(),
|
|
863
|
+
!Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), wo(), mt(s.files).catch((_) => {
|
|
864
864
|
ht(
|
|
865
865
|
_ instanceof Error ? _.message : "Failed to attach file"
|
|
866
866
|
), K("web-sdk.widget", "Attachment failed", {
|
|
@@ -881,19 +881,19 @@ async function ki(e = {}) {
|
|
|
881
881
|
t.onLoginClick?.();
|
|
882
882
|
return;
|
|
883
883
|
}
|
|
884
|
-
if (
|
|
885
|
-
|
|
884
|
+
if (b.getState().isThinking) {
|
|
885
|
+
b.stop();
|
|
886
886
|
return;
|
|
887
887
|
}
|
|
888
888
|
he = !0, X(!0, "send"), Z(), B = Et(
|
|
889
|
-
|
|
889
|
+
b,
|
|
890
890
|
f,
|
|
891
891
|
B
|
|
892
|
-
), ve(), q(), F(
|
|
892
|
+
), ve(), q(), F(b.getState());
|
|
893
893
|
}), ue.addEventListener("click", () => {
|
|
894
|
-
le = !le, De = null,
|
|
894
|
+
le = !le, De = null, we(), le && pe.length === 0 && Ht(null);
|
|
895
895
|
}), $e.addEventListener("click", () => {
|
|
896
|
-
le = !1,
|
|
896
|
+
le = !1, we();
|
|
897
897
|
}), G.addEventListener("scroll", co), f.addEventListener("input", () => {
|
|
898
898
|
He(f), O(), q(), yo();
|
|
899
899
|
}), f.addEventListener("keydown", (a) => {
|
|
@@ -903,24 +903,24 @@ async function ki(e = {}) {
|
|
|
903
903
|
return;
|
|
904
904
|
}
|
|
905
905
|
he = !0, X(!0, "send"), Z(), B = Et(
|
|
906
|
-
|
|
906
|
+
b,
|
|
907
907
|
f,
|
|
908
908
|
B
|
|
909
|
-
), ve(), q(), F(
|
|
909
|
+
), ve(), q(), F(b.getState());
|
|
910
910
|
}
|
|
911
911
|
}), i.addEventListener("click", (a) => {
|
|
912
912
|
(a.target instanceof Element ? a.target : null)?.closest("a[href]") && O();
|
|
913
|
-
}), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i,
|
|
913
|
+
}), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i, w, f);
|
|
914
914
|
const Xe = () => r;
|
|
915
|
-
let ft =
|
|
915
|
+
let ft = b.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = b.getState().isThinking, ke = null;
|
|
916
916
|
const Fe = t.taskNotifications;
|
|
917
917
|
let Le = null, Ie = !1;
|
|
918
918
|
const Zt = () => {
|
|
919
919
|
Le !== null && (window.clearTimeout(Le), Le = null);
|
|
920
920
|
}, Je = () => {
|
|
921
921
|
A && (A.hidden = !0);
|
|
922
|
-
}, Jt = () =>
|
|
923
|
-
if (!Fe || !A || Ie || Se || !
|
|
922
|
+
}, Jt = () => b.getState().assistantDraft.trim().length > 0, _o = async () => {
|
|
923
|
+
if (!Fe || !A || Ie || Se || !b.getState().isThinking || Jt())
|
|
924
924
|
return;
|
|
925
925
|
let a;
|
|
926
926
|
try {
|
|
@@ -928,7 +928,7 @@ async function ki(e = {}) {
|
|
|
928
928
|
} catch {
|
|
929
929
|
return;
|
|
930
930
|
}
|
|
931
|
-
a.enabled || a.neverSuggest || !
|
|
931
|
+
a.enabled || a.neverSuggest || !b.getState().isThinking || Jt() || Ie || Se || (A.hidden = !1);
|
|
932
932
|
};
|
|
933
933
|
T?.addEventListener("click", () => {
|
|
934
934
|
Ie = !0, Je(), Fe?.enable().catch(() => {
|
|
@@ -941,13 +941,13 @@ async function ki(e = {}) {
|
|
|
941
941
|
});
|
|
942
942
|
let Ae = null, Qt = () => {
|
|
943
943
|
};
|
|
944
|
-
const xo = !!t.socialPostDraftHandler,
|
|
945
|
-
const a = Ae !== null && It(
|
|
944
|
+
const xo = !!t.socialPostDraftHandler, wt = /* @__PURE__ */ new Map(), bt = () => f.value.trim().length > 0 || B.length > 0, yo = () => {
|
|
945
|
+
const a = Ae !== null && It(b.getState(), bt());
|
|
946
946
|
z.hidden = !a, a && Ae !== null && Vn(z, Ae);
|
|
947
947
|
};
|
|
948
948
|
let Ne = null;
|
|
949
949
|
const vo = () => {
|
|
950
|
-
he = !0, X(!0, "newSession"), Z(), le = !1,
|
|
950
|
+
he = !0, X(!0, "newSession"), Z(), le = !1, we(), b.startNewSession(), lt.clear(), f.value = "", B = [], ve(), He(f), O(), q(), f.focus(), F(b.getState());
|
|
951
951
|
}, _t = (a) => {
|
|
952
952
|
if (!a) {
|
|
953
953
|
Ne?.remove(), Ne = null;
|
|
@@ -960,12 +960,12 @@ async function ki(e = {}) {
|
|
|
960
960
|
!1
|
|
961
961
|
), Ne.addEventListener("click", vo), ce.insertBefore(Ne, ue));
|
|
962
962
|
}, F = (a) => {
|
|
963
|
-
if (
|
|
963
|
+
if (we(), Bt(a.lastErrorCode) ? ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
|
|
964
964
|
N,
|
|
965
965
|
t.billingStatus,
|
|
966
966
|
ke
|
|
967
967
|
), t.loginRequired) {
|
|
968
|
-
|
|
968
|
+
wt.clear(), In(
|
|
969
969
|
I,
|
|
970
970
|
R,
|
|
971
971
|
_t,
|
|
@@ -978,7 +978,7 @@ async function ki(e = {}) {
|
|
|
978
978
|
return;
|
|
979
979
|
}
|
|
980
980
|
if (t.signupRequired) {
|
|
981
|
-
|
|
981
|
+
wt.clear(), In(
|
|
982
982
|
I,
|
|
983
983
|
R,
|
|
984
984
|
_t,
|
|
@@ -1001,15 +1001,15 @@ async function ki(e = {}) {
|
|
|
1001
1001
|
z,
|
|
1002
1002
|
a,
|
|
1003
1003
|
Ae,
|
|
1004
|
-
Ae !== null && It(a,
|
|
1004
|
+
Ae !== null && It(a, bt()),
|
|
1005
1005
|
E,
|
|
1006
1006
|
() => me.enabled,
|
|
1007
1007
|
lt,
|
|
1008
|
-
|
|
1008
|
+
wt,
|
|
1009
1009
|
O,
|
|
1010
1010
|
Xe,
|
|
1011
1011
|
(P) => {
|
|
1012
|
-
he = !0, X(!0, "send"), Z(),
|
|
1012
|
+
he = !0, X(!0, "send"), Z(), b.sendMessage(P);
|
|
1013
1013
|
},
|
|
1014
1014
|
xo && !pt ? {
|
|
1015
1015
|
dismissedCandidateIds: qe,
|
|
@@ -1023,24 +1023,24 @@ async function ki(e = {}) {
|
|
|
1023
1023
|
Co(P);
|
|
1024
1024
|
},
|
|
1025
1025
|
onDismiss: (P) => {
|
|
1026
|
-
Ce.add(P.id), qe.add(P.id), O(), Be = null, F(
|
|
1026
|
+
Ce.add(P.id), qe.add(P.id), O(), Be = null, F(b.getState());
|
|
1027
1027
|
},
|
|
1028
1028
|
onDisable: (P) => {
|
|
1029
|
-
pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(
|
|
1029
|
+
pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(b.getState());
|
|
1030
1030
|
}
|
|
1031
1031
|
} : void 0
|
|
1032
1032
|
), E ? (fe = I.scrollTop, Z()) : _ && $i(a) && po();
|
|
1033
1033
|
};
|
|
1034
1034
|
return Qt = Ho(
|
|
1035
1035
|
(a) => {
|
|
1036
|
-
Ae = a, !Se && It(
|
|
1036
|
+
Ae = a, !Se && It(b.getState(), bt()) && F(b.getState());
|
|
1037
1037
|
},
|
|
1038
1038
|
{
|
|
1039
1039
|
backendUrl: t.backendUrl,
|
|
1040
1040
|
fetcher: lo,
|
|
1041
1041
|
loader: t.activeUsersLoader
|
|
1042
1042
|
}
|
|
1043
|
-
),
|
|
1043
|
+
), b.on("state", (a) => {
|
|
1044
1044
|
const s = Xt && !a.isThinking;
|
|
1045
1045
|
Xt = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Fe && !Ie && Le === null && A?.hidden !== !1 && (Le = window.setTimeout(() => {
|
|
1046
1046
|
Le = null, _o();
|
|
@@ -1059,8 +1059,8 @@ async function ki(e = {}) {
|
|
|
1059
1059
|
fallbackFontFamily: t.fontFamily
|
|
1060
1060
|
}
|
|
1061
1061
|
), xt({}, "agent.state.appearance-cleared")), F(a), q(), s && jt();
|
|
1062
|
-
}), F(
|
|
1063
|
-
agent:
|
|
1062
|
+
}), F(b.getState()), q(), {
|
|
1063
|
+
agent: b,
|
|
1064
1064
|
updateAppearance: (a) => {
|
|
1065
1065
|
a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), xt(a, "widgetHandle.updateAppearance");
|
|
1066
1066
|
},
|
|
@@ -1078,7 +1078,7 @@ async function ki(e = {}) {
|
|
|
1078
1078
|
},
|
|
1079
1079
|
updateAuthGate: (a) => {
|
|
1080
1080
|
const s = Ke();
|
|
1081
|
-
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(
|
|
1081
|
+
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(b.getState()), q(), s && !Ke() && b.connect().catch((_) => {
|
|
1082
1082
|
K(
|
|
1083
1083
|
"web-sdk.widget",
|
|
1084
1084
|
"Failed to connect after auth gate cleared",
|
|
@@ -1099,12 +1099,12 @@ async function ki(e = {}) {
|
|
|
1099
1099
|
Re("minimized", !1);
|
|
1100
1100
|
},
|
|
1101
1101
|
destroy: () => {
|
|
1102
|
-
Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(),
|
|
1102
|
+
Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(), b.destroy(), o.remove());
|
|
1103
1103
|
}
|
|
1104
1104
|
};
|
|
1105
1105
|
async function Co(a) {
|
|
1106
1106
|
if (!Ze) {
|
|
1107
|
-
Ze = a.id, Be = null, F(
|
|
1107
|
+
Ze = a.id, Be = null, F(b.getState());
|
|
1108
1108
|
try {
|
|
1109
1109
|
if (!t.socialPostDraftHandler)
|
|
1110
1110
|
throw new Error("Social post drafting is not available here.");
|
|
@@ -1120,7 +1120,7 @@ async function ki(e = {}) {
|
|
|
1120
1120
|
} catch (s) {
|
|
1121
1121
|
Be = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1122
1122
|
} finally {
|
|
1123
|
-
Ze = null, F(
|
|
1123
|
+
Ze = null, F(b.getState());
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
@@ -1129,7 +1129,7 @@ async function ki(e = {}) {
|
|
|
1129
1129
|
r = fn(
|
|
1130
1130
|
_,
|
|
1131
1131
|
yt
|
|
1132
|
-
),
|
|
1132
|
+
), wn(i, r, {
|
|
1133
1133
|
accentColor: _,
|
|
1134
1134
|
colorScheme: E,
|
|
1135
1135
|
fontFamily: P,
|
|
@@ -1171,7 +1171,7 @@ function Ai([e, t, o]) {
|
|
|
1171
1171
|
};
|
|
1172
1172
|
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1174
|
+
function wn(e, t, o) {
|
|
1175
1175
|
e.classList.toggle(
|
|
1176
1176
|
"pluno-pa-widget--dark",
|
|
1177
1177
|
o.colorScheme === "dark"
|
|
@@ -1220,7 +1220,7 @@ function Ti({
|
|
|
1220
1220
|
l = null, p = null, d = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1221
1221
|
}, S = (h) => {
|
|
1222
1222
|
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = n(), u = !1, t.setPointerCapture?.(h.pointerId));
|
|
1223
|
-
},
|
|
1223
|
+
}, w = (h) => {
|
|
1224
1224
|
if (l !== h.pointerId || !p || !d)
|
|
1225
1225
|
return;
|
|
1226
1226
|
h.preventDefault();
|
|
@@ -1245,8 +1245,8 @@ function Ti({
|
|
|
1245
1245
|
let L = null;
|
|
1246
1246
|
h.key === "ArrowUp" ? L = { x: D.x, y: D.y - N } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + N } : h.key === "ArrowLeft" ? L = { x: D.x - N, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + N, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
|
|
1247
1247
|
};
|
|
1248
|
-
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove",
|
|
1249
|
-
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove",
|
|
1248
|
+
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", w), t.addEventListener("pointerup", H), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
|
|
1249
|
+
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", w), t.removeEventListener("pointerup", H), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
1252
|
function it(e, t = !0) {
|
|
@@ -1275,9 +1275,9 @@ function $n() {
|
|
|
1275
1275
|
),
|
|
1276
1276
|
height: Math.min(
|
|
1277
1277
|
Te(
|
|
1278
|
-
e.height *
|
|
1278
|
+
e.height * bi,
|
|
1279
1279
|
fi,
|
|
1280
|
-
|
|
1280
|
+
wi
|
|
1281
1281
|
),
|
|
1282
1282
|
e.height - Pt - W
|
|
1283
1283
|
)
|
|
@@ -1354,7 +1354,7 @@ function Mi(e, t) {
|
|
|
1354
1354
|
function zi(e) {
|
|
1355
1355
|
return e.classList.contains("pluno-pa-widget--scribble") ? yi : xi;
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1357
|
+
function bn(e, t, o) {
|
|
1358
1358
|
const n = it(e), i = $n(), r = {
|
|
1359
1359
|
x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
|
|
1360
1360
|
y: t.y + n.height - i.height
|
|
@@ -1769,7 +1769,7 @@ function ta(e, t) {
|
|
|
1769
1769
|
in2: "innerLight",
|
|
1770
1770
|
mode: "screen"
|
|
1771
1771
|
});
|
|
1772
|
-
const
|
|
1772
|
+
const w = m(r, "filter", {
|
|
1773
1773
|
id: n.eyeShadow,
|
|
1774
1774
|
x: "-24%",
|
|
1775
1775
|
y: "-20%",
|
|
@@ -1777,7 +1777,7 @@ function ta(e, t) {
|
|
|
1777
1777
|
height: "148%",
|
|
1778
1778
|
"color-interpolation-filters": "sRGB"
|
|
1779
1779
|
});
|
|
1780
|
-
m(
|
|
1780
|
+
m(w, "feDropShadow", {
|
|
1781
1781
|
dx: "0",
|
|
1782
1782
|
dy: "8",
|
|
1783
1783
|
stdDeviation: "5",
|
|
@@ -2321,10 +2321,10 @@ function Cn(e) {
|
|
|
2321
2321
|
function fa(e, t) {
|
|
2322
2322
|
return t ? Array.from(t).map((n) => ({
|
|
2323
2323
|
...e.createLocalAttachment(n),
|
|
2324
|
-
previewUrl:
|
|
2324
|
+
previewUrl: wa(n)
|
|
2325
2325
|
})) : [];
|
|
2326
2326
|
}
|
|
2327
|
-
function
|
|
2327
|
+
function wa(e) {
|
|
2328
2328
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2329
2329
|
}
|
|
2330
2330
|
function Qe(e) {
|
|
@@ -2336,10 +2336,10 @@ function Lt(e, t, o = null) {
|
|
|
2336
2336
|
return;
|
|
2337
2337
|
}
|
|
2338
2338
|
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Bt(o) ? e.appendChild(
|
|
2339
|
-
|
|
2339
|
+
ba(t, o)
|
|
2340
2340
|
) : Jn(t) && e.appendChild(_a(t));
|
|
2341
2341
|
}
|
|
2342
|
-
function
|
|
2342
|
+
function ba(e, t) {
|
|
2343
2343
|
const o = document.createElement("div");
|
|
2344
2344
|
o.className = "pluno-pa-widget__billing-action-card";
|
|
2345
2345
|
const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
@@ -2417,7 +2417,7 @@ function It(e, t) {
|
|
|
2417
2417
|
(n) => !eo(n)
|
|
2418
2418
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2419
2419
|
}
|
|
2420
|
-
function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S,
|
|
2420
|
+
function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, w, H, k) {
|
|
2421
2421
|
const y = La(r), v = y.filter(
|
|
2422
2422
|
(x) => !eo(x)
|
|
2423
2423
|
), h = e.scrollTop, N = [], D = /* @__PURE__ */ new Set(), L = (x) => {
|
|
@@ -2432,7 +2432,7 @@ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
|
|
|
2432
2432
|
z.className = "pluno-pa-widget__empty-hero";
|
|
2433
2433
|
const I = de(
|
|
2434
2434
|
"pluno-pa-widget__character--empty",
|
|
2435
|
-
|
|
2435
|
+
w()
|
|
2436
2436
|
);
|
|
2437
2437
|
z.appendChild(I), x.appendChild(z), x.appendChild(jn());
|
|
2438
2438
|
const $ = document.createElement("div");
|
|
@@ -2462,7 +2462,7 @@ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
|
|
|
2462
2462
|
ce,
|
|
2463
2463
|
c,
|
|
2464
2464
|
S,
|
|
2465
|
-
|
|
2465
|
+
w()
|
|
2466
2466
|
);
|
|
2467
2467
|
return L(x), f = null, R = x, ce = [], !0;
|
|
2468
2468
|
};
|
|
@@ -2477,7 +2477,7 @@ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
|
|
|
2477
2477
|
const ge = at();
|
|
2478
2478
|
L(ge), f = null, R = ge;
|
|
2479
2479
|
} else {
|
|
2480
|
-
const ge = An(
|
|
2480
|
+
const ge = An(w());
|
|
2481
2481
|
L(ge), f = null, R = ge;
|
|
2482
2482
|
}
|
|
2483
2483
|
continue;
|
|
@@ -2486,7 +2486,7 @@ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
|
|
|
2486
2486
|
continue;
|
|
2487
2487
|
const I = ye(), $ = za(z.content);
|
|
2488
2488
|
if (z.role === "assistant" && !I) {
|
|
2489
|
-
const T = to(
|
|
2489
|
+
const T = to(w());
|
|
2490
2490
|
L(T), f = null, R = T;
|
|
2491
2491
|
}
|
|
2492
2492
|
const A = Sa(z, $, g, D);
|
|
@@ -2498,7 +2498,7 @@ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
|
|
|
2498
2498
|
const x = at();
|
|
2499
2499
|
L(x), f = null, R = x;
|
|
2500
2500
|
} else {
|
|
2501
|
-
const x = An(
|
|
2501
|
+
const x = An(w());
|
|
2502
2502
|
L(x), f = null, R = x;
|
|
2503
2503
|
}
|
|
2504
2504
|
if (r.lastError) {
|
|
@@ -2718,8 +2718,8 @@ function Ta(e, t) {
|
|
|
2718
2718
|
n.appendChild(d), n.appendChild(p);
|
|
2719
2719
|
const S = document.createElement("div");
|
|
2720
2720
|
S.className = "pluno-pa-widget__share-dialog-step";
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2721
|
+
const w = document.createElement("strong");
|
|
2722
|
+
w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "2) Share on", S.appendChild(w);
|
|
2723
2723
|
const H = document.createElement("p");
|
|
2724
2724
|
H.className = "pluno-pa-widget__share-dialog-hint", H.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(H);
|
|
2725
2725
|
const k = document.createElement("footer");
|
|
@@ -2827,8 +2827,8 @@ function Oa(e, t, o, n) {
|
|
|
2827
2827
|
for (const g of e) {
|
|
2828
2828
|
const S = document.createElement("div");
|
|
2829
2829
|
S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(Ot());
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2830
|
+
const w = document.createElement("span");
|
|
2831
|
+
w.textContent = g.content || "Run tool", S.appendChild(w), c.appendChild(S);
|
|
2832
2832
|
}
|
|
2833
2833
|
r.appendChild(c);
|
|
2834
2834
|
}
|
|
@@ -4710,6 +4710,9 @@ function Nn(e, t) {
|
|
|
4710
4710
|
padding: 2px 0;
|
|
4711
4711
|
text-align: left;
|
|
4712
4712
|
}
|
|
4713
|
+
.pluno-pa-widget__thinking-marker .pluno-pa-widget__status {
|
|
4714
|
+
align-self: center;
|
|
4715
|
+
}
|
|
4713
4716
|
.pluno-pa-widget__thinking-dot {
|
|
4714
4717
|
flex: 0 0 auto;
|
|
4715
4718
|
width: 6px;
|
package/package.json
CHANGED