@pluno/product-agent-web 0.1.52 → 0.1.53
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 +69 -68
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -224,7 +224,7 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
224
224
|
"application/pdf"
|
|
225
225
|
]), ko = Array.from(
|
|
226
226
|
mn
|
|
227
|
-
).join(","), Lo = 3,
|
|
227
|
+
).join(","), Lo = 3, Po = "No recent chats for this page yet.", Z = {
|
|
228
228
|
launcherLabel: "Ask for anything...",
|
|
229
229
|
accentColor: "#7c3aed",
|
|
230
230
|
colorScheme: "light",
|
|
@@ -232,7 +232,7 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
232
232
|
scribbleStyle: !1,
|
|
233
233
|
position: "bottom-right",
|
|
234
234
|
movableLauncher: !1
|
|
235
|
-
},
|
|
235
|
+
}, Ao = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Ot = "pluno-pa-scribble-font", bn = 190, fn = 41, Ut = 22, Io = 16, To = 24, No = 1, Do = 48, Ro = 420, Mo = 520, zo = 0.24, Bo = 680, Oo = 800, Uo = 0.76, W = 8, ut = 50, wn = "http://www.w3.org/2000/svg", Ft = 26, Ht = 8, Fo = 36, Gt = [
|
|
236
236
|
{
|
|
237
237
|
ellipseCx: "17.5",
|
|
238
238
|
ellipseCy: "24.5",
|
|
@@ -311,6 +311,7 @@ async function Vo(e = {}) {
|
|
|
311
311
|
sdkPreviewChannelId: e.sdkPreviewChannelId,
|
|
312
312
|
initialDisplayState: e.initialDisplayState,
|
|
313
313
|
onDisplayStateChange: e.onDisplayStateChange,
|
|
314
|
+
onPanelOpenChange: e.onPanelOpenChange,
|
|
314
315
|
showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0
|
|
315
316
|
};
|
|
316
317
|
X(
|
|
@@ -378,7 +379,7 @@ async function Vo(e = {}) {
|
|
|
378
379
|
".pluno-pa-widget__launcher-drag-handle"
|
|
379
380
|
), y = i.querySelector(
|
|
380
381
|
".pluno-pa-widget__launcher-input"
|
|
381
|
-
),
|
|
382
|
+
), A = i.querySelector(
|
|
382
383
|
".pluno-pa-widget__launcher-minimize"
|
|
383
384
|
), T = i.querySelector(".pluno-pa-widget__panel"), f = i.querySelector(
|
|
384
385
|
".pluno-pa-widget__close"
|
|
@@ -414,12 +415,12 @@ async function Vo(e = {}) {
|
|
|
414
415
|
".pluno-pa-widget__timeline-jump"
|
|
415
416
|
), be = i.querySelector(
|
|
416
417
|
".pluno-pa-widget__active-users-counter"
|
|
417
|
-
),
|
|
418
|
+
), P = i.querySelector(
|
|
418
419
|
".pluno-pa-widget__timeline"
|
|
419
420
|
), je = i.querySelector(
|
|
420
421
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
421
422
|
);
|
|
422
|
-
if (!h || !y || !T || !f || !E || !g || !S || !k || !R || !Ce || !b || !ie || !ae || !_ || !N || !F || !H || !L || !I || !be || !
|
|
423
|
+
if (!h || !y || !T || !f || !E || !g || !S || !k || !R || !Ce || !b || !ie || !ae || !_ || !N || !F || !H || !L || !I || !be || !P || !je)
|
|
423
424
|
throw new Error("Failed to mount Pluno widget");
|
|
424
425
|
if (t.movableLauncher && !x)
|
|
425
426
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
@@ -483,7 +484,7 @@ async function Vo(e = {}) {
|
|
|
483
484
|
}, Bn = () => {
|
|
484
485
|
I.hidden = !1;
|
|
485
486
|
}, On = (r = "jump") => {
|
|
486
|
-
V(!0, r), Y(), Ie(
|
|
487
|
+
V(!0, r), Y(), Ie(P, () => ce.enabled), ue = P.scrollTop;
|
|
487
488
|
}, ge = () => {
|
|
488
489
|
if (_.hidden = t.loginRequired, N.hidden = !re, _.setAttribute("aria-expanded", String(re)), F.classList.toggle(
|
|
489
490
|
"pluno-pa-widget__history-list--center",
|
|
@@ -525,7 +526,7 @@ async function Vo(e = {}) {
|
|
|
525
526
|
{
|
|
526
527
|
message: s instanceof Error ? s.message : String(s)
|
|
527
528
|
}
|
|
528
|
-
), Ee =
|
|
529
|
+
), Ee = Po;
|
|
529
530
|
} finally {
|
|
530
531
|
ne = !1, ge();
|
|
531
532
|
}
|
|
@@ -693,16 +694,16 @@ async function Vo(e = {}) {
|
|
|
693
694
|
openPanelPosition: B,
|
|
694
695
|
visibleLauncherPosition: C
|
|
695
696
|
}), V(!0, "open"), Y(), !s) {
|
|
696
|
-
i.classList.add("pluno-pa-widget--open"), h.hidden = !0, r && (b.value = r,
|
|
697
|
+
i.classList.add("pluno-pa-widget--open"), h.hidden = !0, r && (b.value = r, Ae(b)), Ie(P, () => ce.enabled), ue = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), G(), Re("shown"), t.onPanelOpenChange?.(!0);
|
|
697
698
|
return;
|
|
698
699
|
}
|
|
699
700
|
window.requestAnimationFrame(() => {
|
|
700
|
-
i.classList.add("pluno-pa-widget--open"), r && (b.value = r,
|
|
701
|
-
h.hidden = !0, Ie(
|
|
701
|
+
i.classList.add("pluno-pa-widget--open"), r && (b.value = r, Ae(b)), Ie(P, () => ce.enabled), ue = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), G(), Re("shown"), t.onPanelOpenChange?.(!0), j = window.setTimeout(() => {
|
|
702
|
+
h.hidden = !0, Ie(P, () => ce.enabled), ue = P.scrollTop;
|
|
702
703
|
}, 220);
|
|
703
704
|
});
|
|
704
705
|
}, Hn = () => {
|
|
705
|
-
j !== null && (window.clearTimeout(j), j = null), h.hidden = !1, p && (ke(!1), he("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), G(), j = window.setTimeout(() => {
|
|
706
|
+
j !== null && (window.clearTimeout(j), j = null), h.hidden = !1, p && (ke(!1), he("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), G(), t.onPanelOpenChange?.(!1), j = window.setTimeout(() => {
|
|
706
707
|
T.hidden = !0, f.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
|
|
707
708
|
}, 220);
|
|
708
709
|
};
|
|
@@ -721,12 +722,12 @@ async function Vo(e = {}) {
|
|
|
721
722
|
pe(r), y.value = "";
|
|
722
723
|
}), h.addEventListener("keydown", (r) => {
|
|
723
724
|
!i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), pe());
|
|
724
|
-
}),
|
|
725
|
+
}), A?.addEventListener("pointerdown", (r) => {
|
|
725
726
|
r.stopPropagation();
|
|
726
|
-
}),
|
|
727
|
+
}), A?.addEventListener("click", (r) => {
|
|
727
728
|
r.preventDefault(), r.stopPropagation(), Se("minimized");
|
|
728
|
-
}), f.addEventListener("click", Hn),
|
|
729
|
-
|
|
729
|
+
}), f.addEventListener("click", Hn), P.addEventListener("scroll", () => {
|
|
730
|
+
P.scrollTop < ue - 1 && V(!1, "userScroll"), ue = P.scrollTop;
|
|
730
731
|
}), I.addEventListener("click", () => {
|
|
731
732
|
On();
|
|
732
733
|
});
|
|
@@ -734,7 +735,7 @@ async function Vo(e = {}) {
|
|
|
734
735
|
([r]) => {
|
|
735
736
|
r?.isIntersecting && (V(!0, "bottom"), Y());
|
|
736
737
|
},
|
|
737
|
-
{ root:
|
|
738
|
+
{ root: P, threshold: 0 }
|
|
738
739
|
);
|
|
739
740
|
kt?.observe(je);
|
|
740
741
|
const Me = () => t.loginRequired || t.signupRequired, Lt = () => {
|
|
@@ -761,13 +762,13 @@ async function Vo(e = {}) {
|
|
|
761
762
|
let Le = 0;
|
|
762
763
|
const Gn = () => {
|
|
763
764
|
Le = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
764
|
-
},
|
|
765
|
+
}, Pt = (r) => {
|
|
765
766
|
te !== null && window.clearTimeout(te), g.textContent = r, g.hidden = !1, te = window.setTimeout(() => {
|
|
766
767
|
g.textContent = "", g.hidden = !0, te = null;
|
|
767
768
|
}, 3e3);
|
|
768
769
|
}, Wn = () => {
|
|
769
770
|
te !== null && (window.clearTimeout(te), te = null), g.textContent = "", g.hidden = !0;
|
|
770
|
-
},
|
|
771
|
+
}, At = async (r) => {
|
|
771
772
|
if (r.length === 0)
|
|
772
773
|
return;
|
|
773
774
|
const s = await Mi(r);
|
|
@@ -781,8 +782,8 @@ async function Vo(e = {}) {
|
|
|
781
782
|
t.loginRequired || J(t.billingStatus) || R.click();
|
|
782
783
|
}), R.addEventListener("change", () => {
|
|
783
784
|
const r = Array.from(R.files ?? []);
|
|
784
|
-
R.value = "",
|
|
785
|
-
|
|
785
|
+
R.value = "", At(r).catch((s) => {
|
|
786
|
+
Pt(
|
|
786
787
|
s instanceof Error ? s.message : "Failed to attach file"
|
|
787
788
|
), X("web-sdk.widget", "Attachment failed", {
|
|
788
789
|
message: s instanceof Error ? s.message : String(s)
|
|
@@ -797,8 +798,8 @@ async function Vo(e = {}) {
|
|
|
797
798
|
Oe(r.dataTransfer) && (r.stopPropagation(), Le = Math.max(0, Le - 1), Le === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
798
799
|
}), i.addEventListener("drop", (r) => {
|
|
799
800
|
const s = r.dataTransfer;
|
|
800
|
-
!Oe(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Gn(),
|
|
801
|
-
|
|
801
|
+
!Oe(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Gn(), At(s.files).catch((C) => {
|
|
802
|
+
Pt(
|
|
802
803
|
C instanceof Error ? C.message : "Failed to attach file"
|
|
803
804
|
), X("web-sdk.widget", "Attachment failed", {
|
|
804
805
|
message: C instanceof Error ? C.message : String(C)
|
|
@@ -823,7 +824,7 @@ async function Vo(e = {}) {
|
|
|
823
824
|
}), H.addEventListener("click", () => {
|
|
824
825
|
re = !1, ge();
|
|
825
826
|
}), F.addEventListener("scroll", Un), b.addEventListener("input", () => {
|
|
826
|
-
|
|
827
|
+
Ae(b), G(), $(), O(w.getState());
|
|
827
828
|
}), b.addEventListener("keydown", (r) => {
|
|
828
829
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
829
830
|
if (r.preventDefault(), t.loginRequired) {
|
|
@@ -838,14 +839,14 @@ async function Vo(e = {}) {
|
|
|
838
839
|
}
|
|
839
840
|
}), i.addEventListener("click", (r) => {
|
|
840
841
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && G();
|
|
841
|
-
}), l.composerValue && (b.value = l.composerValue,
|
|
842
|
+
}), l.composerValue && (b.value = l.composerValue, Ae(b)), t.initialDisplayState === "minimized" ? Se("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
|
|
842
843
|
const ze = () => a;
|
|
843
|
-
let Je = w.getState().appearance !== null, Be = null,
|
|
844
|
+
let Je = w.getState().appearance !== null, Be = null, Pe = null, _e = null, It = w.getState().isThinking, xe = null, Qe = null, Tt = () => {
|
|
844
845
|
};
|
|
845
846
|
const $n = !!t.socialPostDraftHandler;
|
|
846
847
|
let ye = null;
|
|
847
848
|
const qn = () => {
|
|
848
|
-
de = !0, V(!0, "newSession"), Y(), re = !1, ge(), w.startNewSession(), Ve.clear(), b.value = "", z = [], fe(),
|
|
849
|
+
de = !0, V(!0, "newSession"), Y(), re = !1, ge(), w.startNewSession(), Ve.clear(), b.value = "", z = [], fe(), Ae(b), G(), $(), b.focus(), O(w.getState());
|
|
849
850
|
}, et = (r) => {
|
|
850
851
|
if (!r) {
|
|
851
852
|
ye?.remove(), ye = null;
|
|
@@ -864,7 +865,7 @@ async function Vo(e = {}) {
|
|
|
864
865
|
xe
|
|
865
866
|
), t.loginRequired) {
|
|
866
867
|
on(
|
|
867
|
-
|
|
868
|
+
P,
|
|
868
869
|
ie,
|
|
869
870
|
et,
|
|
870
871
|
ze,
|
|
@@ -877,7 +878,7 @@ async function Vo(e = {}) {
|
|
|
877
878
|
}
|
|
878
879
|
if (t.signupRequired) {
|
|
879
880
|
on(
|
|
880
|
-
|
|
881
|
+
P,
|
|
881
882
|
ie,
|
|
882
883
|
et,
|
|
883
884
|
ze,
|
|
@@ -892,7 +893,7 @@ async function Vo(e = {}) {
|
|
|
892
893
|
_t = s;
|
|
893
894
|
const B = de || ce.enabled;
|
|
894
895
|
de = !1, Vi(
|
|
895
|
-
|
|
896
|
+
P,
|
|
896
897
|
je,
|
|
897
898
|
ie,
|
|
898
899
|
et,
|
|
@@ -914,7 +915,7 @@ async function Vo(e = {}) {
|
|
|
914
915
|
$n && !Ye ? {
|
|
915
916
|
dismissedCandidateIds: Ne,
|
|
916
917
|
draftingCandidateId: Be,
|
|
917
|
-
error:
|
|
918
|
+
error: Pe,
|
|
918
919
|
characterIconOptions: ze(),
|
|
919
920
|
onSeen: (D) => {
|
|
920
921
|
we.add(D.id), G();
|
|
@@ -923,13 +924,13 @@ async function Vo(e = {}) {
|
|
|
923
924
|
jn(D);
|
|
924
925
|
},
|
|
925
926
|
onDismiss: (D) => {
|
|
926
|
-
we.add(D.id), Ne.add(D.id), G(),
|
|
927
|
+
we.add(D.id), Ne.add(D.id), G(), Pe = null, O(w.getState());
|
|
927
928
|
},
|
|
928
929
|
onDisable: (D) => {
|
|
929
|
-
Ye = !0, we.add(D.id), Ne.add(D.id), G(), ga(t, !0),
|
|
930
|
+
Ye = !0, we.add(D.id), Ne.add(D.id), G(), ga(t, !0), Pe = null, O(w.getState());
|
|
930
931
|
}
|
|
931
932
|
} : void 0
|
|
932
|
-
), B ? (ue =
|
|
933
|
+
), B ? (ue = P.scrollTop, Y()) : C && pi(r) && Bn();
|
|
933
934
|
};
|
|
934
935
|
return Tt = co(
|
|
935
936
|
(r) => {
|
|
@@ -1005,7 +1006,7 @@ async function Vo(e = {}) {
|
|
|
1005
1006
|
};
|
|
1006
1007
|
async function jn(r) {
|
|
1007
1008
|
if (!Be) {
|
|
1008
|
-
Be = r.id,
|
|
1009
|
+
Be = r.id, Pe = null, O(w.getState());
|
|
1009
1010
|
try {
|
|
1010
1011
|
if (!t.socialPostDraftHandler)
|
|
1011
1012
|
throw new Error("Social post drafting is not available here.");
|
|
@@ -1019,7 +1020,7 @@ async function Vo(e = {}) {
|
|
|
1019
1020
|
}
|
|
1020
1021
|
}), i.appendChild(_e);
|
|
1021
1022
|
} catch (s) {
|
|
1022
|
-
|
|
1023
|
+
Pe = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1023
1024
|
} finally {
|
|
1024
1025
|
Be = null, O(w.getState());
|
|
1025
1026
|
}
|
|
@@ -1084,7 +1085,7 @@ function jt(e, t, n) {
|
|
|
1084
1085
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1085
1086
|
"--pluno-pa-accent-contrast",
|
|
1086
1087
|
Yo(o)
|
|
1087
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1088
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ao : n.fontFamily, n.scribbleStyle && Zo(e.ownerDocument);
|
|
1088
1089
|
const i = Array.from(
|
|
1089
1090
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1090
1091
|
);
|
|
@@ -1127,7 +1128,7 @@ function Jo({
|
|
|
1127
1128
|
g.preventDefault();
|
|
1128
1129
|
const S = g.clientX - p.x, k = g.clientY - p.y;
|
|
1129
1130
|
!u && Math.hypot(S, k) < Wt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + S, y: c.y + k }));
|
|
1130
|
-
},
|
|
1131
|
+
}, A = (g) => {
|
|
1131
1132
|
l === g.pointerId && (g.preventDefault(), g.stopPropagation(), u && (d = { x: g.clientX, y: g.clientY }, a()), h());
|
|
1132
1133
|
}, T = (g) => {
|
|
1133
1134
|
l === g.pointerId && (g.preventDefault(), h());
|
|
@@ -1146,8 +1147,8 @@ function Jo({
|
|
|
1146
1147
|
let R = null;
|
|
1147
1148
|
g.key === "ArrowUp" ? R = { x: k.x, y: k.y - S } : g.key === "ArrowDown" ? R = { x: k.x, y: k.y + S } : g.key === "ArrowLeft" ? R = { x: k.x - S, y: k.y } : g.key === "ArrowRight" && (R = { x: k.x + S, y: k.y }), R && (g.preventDefault(), g.stopPropagation(), i(R), a());
|
|
1148
1149
|
};
|
|
1149
|
-
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", y), t.addEventListener("pointerup",
|
|
1150
|
-
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", y), t.removeEventListener("pointerup",
|
|
1150
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", y), t.addEventListener("pointerup", A), t.addEventListener("pointercancel", T), t.addEventListener("click", f, !0), n.addEventListener("keydown", E), () => {
|
|
1151
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", y), t.removeEventListener("pointerup", A), t.removeEventListener("pointercancel", T), t.removeEventListener("click", f, !0), n.removeEventListener("keydown", E);
|
|
1151
1152
|
};
|
|
1152
1153
|
}
|
|
1153
1154
|
function $e(e, t = !0) {
|
|
@@ -1336,7 +1337,7 @@ function rt(e, t, n) {
|
|
|
1336
1337
|
attachments: n.length > 0 ? n : void 0
|
|
1337
1338
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1338
1339
|
}
|
|
1339
|
-
function
|
|
1340
|
+
function Ae(e) {
|
|
1340
1341
|
e.style.height = "0px";
|
|
1341
1342
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1342
1343
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
@@ -1649,7 +1650,7 @@ function _i(e, t) {
|
|
|
1649
1650
|
"flood-color": n.shadow,
|
|
1650
1651
|
"flood-opacity": "0.3"
|
|
1651
1652
|
});
|
|
1652
|
-
const
|
|
1653
|
+
const A = m(a, "filter", {
|
|
1653
1654
|
id: o.pupilGloss,
|
|
1654
1655
|
x: "-15%",
|
|
1655
1656
|
y: "-15%",
|
|
@@ -1657,7 +1658,7 @@ function _i(e, t) {
|
|
|
1657
1658
|
height: "130%",
|
|
1658
1659
|
"color-interpolation-filters": "sRGB"
|
|
1659
1660
|
});
|
|
1660
|
-
m(
|
|
1661
|
+
m(A, "feDropShadow", {
|
|
1661
1662
|
dx: "0",
|
|
1662
1663
|
dy: "3",
|
|
1663
1664
|
stdDeviation: "3",
|
|
@@ -2053,7 +2054,7 @@ function Li() {
|
|
|
2053
2054
|
})
|
|
2054
2055
|
), e;
|
|
2055
2056
|
}
|
|
2056
|
-
function
|
|
2057
|
+
function Pi() {
|
|
2057
2058
|
const e = ee("0 0 24 24", 18, 18, "currentColor");
|
|
2058
2059
|
return e.appendChild(
|
|
2059
2060
|
v("rect", {
|
|
@@ -2065,7 +2066,7 @@ function Ai() {
|
|
|
2065
2066
|
})
|
|
2066
2067
|
), e;
|
|
2067
2068
|
}
|
|
2068
|
-
function
|
|
2069
|
+
function Ai() {
|
|
2069
2070
|
const e = ee(
|
|
2070
2071
|
"0 0 24 24",
|
|
2071
2072
|
12,
|
|
@@ -2130,7 +2131,7 @@ function Ti(e, t, n) {
|
|
|
2130
2131
|
const l = document.createElement("span");
|
|
2131
2132
|
l.textContent = i.name, a.appendChild(l);
|
|
2132
2133
|
const p = document.createElement("button");
|
|
2133
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2134
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ai()), p.addEventListener("click", () => n(o)), a.appendChild(p), e.appendChild(a);
|
|
2134
2135
|
}
|
|
2135
2136
|
}
|
|
2136
2137
|
function Ni(e) {
|
|
@@ -2253,7 +2254,7 @@ function pt(e, t, n = null) {
|
|
|
2253
2254
|
}
|
|
2254
2255
|
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", J(t) || wt(n) ? e.appendChild(
|
|
2255
2256
|
Fi(t, n)
|
|
2256
|
-
) :
|
|
2257
|
+
) : Pn(t) && e.appendChild(Hi(t));
|
|
2257
2258
|
}
|
|
2258
2259
|
function Fi(e, t) {
|
|
2259
2260
|
const n = document.createElement("div");
|
|
@@ -2262,7 +2263,7 @@ function Fi(e, t) {
|
|
|
2262
2263
|
i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
|
|
2263
2264
|
const a = document.createElement("span");
|
|
2264
2265
|
return a.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(a), n.appendChild(
|
|
2265
|
-
|
|
2266
|
+
An(
|
|
2266
2267
|
e,
|
|
2267
2268
|
"Upgrade plan",
|
|
2268
2269
|
"pluno-pa-widget__billing-action-card-actions"
|
|
@@ -2276,7 +2277,7 @@ function Hi(e) {
|
|
|
2276
2277
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2277
2278
|
const o = document.createElement("span");
|
|
2278
2279
|
return o.textContent = Wi(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2279
|
-
|
|
2280
|
+
An(
|
|
2280
2281
|
e,
|
|
2281
2282
|
"Upgrade",
|
|
2282
2283
|
"pluno-pa-widget__billing-action-card-actions"
|
|
@@ -2284,7 +2285,7 @@ function Hi(e) {
|
|
|
2284
2285
|
), t;
|
|
2285
2286
|
}
|
|
2286
2287
|
function ht(e, t) {
|
|
2287
|
-
return e !== null && (J(e) ||
|
|
2288
|
+
return e !== null && (J(e) || Pn(e) || wt(t));
|
|
2288
2289
|
}
|
|
2289
2290
|
function Qt(e, t, n) {
|
|
2290
2291
|
return ht(t, n) || Gi(t) ? !0 : !ht(e, n);
|
|
@@ -2298,7 +2299,7 @@ function J(e) {
|
|
|
2298
2299
|
function wt(e) {
|
|
2299
2300
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2300
2301
|
}
|
|
2301
|
-
function
|
|
2302
|
+
function Pn(e) {
|
|
2302
2303
|
return !J(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2303
2304
|
}
|
|
2304
2305
|
function Wi(e) {
|
|
@@ -2309,7 +2310,7 @@ function $i(e) {
|
|
|
2309
2310
|
maximumFractionDigits: 0
|
|
2310
2311
|
}).format(Math.ceil(e));
|
|
2311
2312
|
}
|
|
2312
|
-
function
|
|
2313
|
+
function An(e, t, n) {
|
|
2313
2314
|
const o = document.createElement("div");
|
|
2314
2315
|
return o.className = n, o.appendChild(
|
|
2315
2316
|
en(t, e.pricingUrl)
|
|
@@ -2361,7 +2362,7 @@ function tn(e, t) {
|
|
|
2361
2362
|
(o) => !In(o)
|
|
2362
2363
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2363
2364
|
}
|
|
2364
|
-
function Vi(e, t, n, o, i, a, l, p, c, u, d, h, x, y,
|
|
2365
|
+
function Vi(e, t, n, o, i, a, l, p, c, u, d, h, x, y, A) {
|
|
2365
2366
|
const T = Yi(a), f = T.filter(
|
|
2366
2367
|
(_) => !In(_)
|
|
2367
2368
|
), E = e.scrollTop;
|
|
@@ -2416,11 +2417,11 @@ function Vi(e, t, n, o, i, a, l, p, c, u, d, h, x, y, P) {
|
|
|
2416
2417
|
}
|
|
2417
2418
|
if (mt(N)) {
|
|
2418
2419
|
if (b()) {
|
|
2419
|
-
const
|
|
2420
|
-
e.appendChild(
|
|
2420
|
+
const P = bt();
|
|
2421
|
+
e.appendChild(P), S = null, k = P;
|
|
2421
2422
|
} else {
|
|
2422
|
-
const
|
|
2423
|
-
e.appendChild(
|
|
2423
|
+
const P = an(x());
|
|
2424
|
+
e.appendChild(P), S = null, k = P;
|
|
2424
2425
|
}
|
|
2425
2426
|
continue;
|
|
2426
2427
|
}
|
|
@@ -2449,17 +2450,17 @@ function Vi(e, t, n, o, i, a, l, p, c, u, d, h, x, y, P) {
|
|
|
2449
2450
|
const _ = document.createElement("div");
|
|
2450
2451
|
_.className = "pluno-pa-widget__error", _.textContent = a.lastError, e.appendChild(_), S = _, k = null;
|
|
2451
2452
|
}
|
|
2452
|
-
const ae =
|
|
2453
|
-
if (
|
|
2453
|
+
const ae = A && !a.isThinking ? eo(T) : null;
|
|
2454
|
+
if (A && ae && !A.dismissedCandidateIds.has(ae.id)) {
|
|
2454
2455
|
const _ = Zi(ae, {
|
|
2455
|
-
isDrafting:
|
|
2456
|
-
error:
|
|
2457
|
-
characterIconOptions:
|
|
2458
|
-
onDraft:
|
|
2459
|
-
onDismiss:
|
|
2460
|
-
onDisable:
|
|
2456
|
+
isDrafting: A.draftingCandidateId === ae.id,
|
|
2457
|
+
error: A.error,
|
|
2458
|
+
characterIconOptions: A.characterIconOptions,
|
|
2459
|
+
onDraft: A.onDraft,
|
|
2460
|
+
onDismiss: A.onDismiss,
|
|
2461
|
+
onDisable: A.onDisable
|
|
2461
2462
|
});
|
|
2462
|
-
e.appendChild(_),
|
|
2463
|
+
e.appendChild(_), A.onSeen(ae), S = null, k = _;
|
|
2463
2464
|
}
|
|
2464
2465
|
S?.classList.add(
|
|
2465
2466
|
"pluno-pa-widget__message--bottom-reserve"
|
|
@@ -2623,8 +2624,8 @@ function Ji(e, t) {
|
|
|
2623
2624
|
x.className = "pluno-pa-widget__share-dialog-step";
|
|
2624
2625
|
const y = document.createElement("strong");
|
|
2625
2626
|
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "2) Share on", x.appendChild(y);
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2627
|
+
const A = document.createElement("p");
|
|
2628
|
+
A.className = "pluno-pa-widget__share-dialog-hint", A.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(A);
|
|
2628
2629
|
const T = document.createElement("footer");
|
|
2629
2630
|
T.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2630
2631
|
for (const f of ea(e)) {
|
|
@@ -2766,7 +2767,7 @@ function ft() {
|
|
|
2766
2767
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2767
2768
|
}
|
|
2768
2769
|
function Nn(e, t) {
|
|
2769
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2770
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Pi() : kn());
|
|
2770
2771
|
}
|
|
2771
2772
|
function ra(e, t) {
|
|
2772
2773
|
const n = t.replace(/\r\n/g, `
|
package/dist/widget.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ type WidgetOptions = {
|
|
|
37
37
|
sdkPreviewChannelId?: string;
|
|
38
38
|
initialDisplayState?: "shown" | "minimized";
|
|
39
39
|
onDisplayStateChange?: (state: "shown" | "minimized") => void;
|
|
40
|
+
onPanelOpenChange?: (open: boolean) => void;
|
|
40
41
|
showLauncherMinimizeButton?: boolean;
|
|
41
42
|
};
|
|
42
43
|
type ProductAgentWidgetBillingStatus = {
|
package/package.json
CHANGED