bstp-agent-widget 0.2.45 → 0.2.47
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/agent-widget.js +70 -53
- package/dist/agent-widget.js.map +1 -1
- package/dist/bstp-agent-widget.css +1 -1
- package/package.json +1 -1
- package/src/lib/index.d.ts +3 -0
package/dist/agent-widget.js
CHANGED
|
@@ -15691,12 +15691,12 @@ var ub = ({ ...e }) => {
|
|
|
15691
15691
|
};
|
|
15692
15692
|
ub.Body = cb, ub.Footer = lb;
|
|
15693
15693
|
var db = {
|
|
15694
|
-
root: "
|
|
15695
|
-
inner: "
|
|
15696
|
-
content: "
|
|
15697
|
-
header: "
|
|
15698
|
-
body: "
|
|
15699
|
-
title: "
|
|
15694
|
+
root: "_root_nppjj_1",
|
|
15695
|
+
inner: "_inner_nppjj_6",
|
|
15696
|
+
content: "_content_nppjj_12",
|
|
15697
|
+
header: "_header_nppjj_19",
|
|
15698
|
+
body: "_body_nppjj_29",
|
|
15699
|
+
title: "_title_nppjj_34"
|
|
15700
15700
|
};
|
|
15701
15701
|
//#endregion
|
|
15702
15702
|
//#region node_modules/marked/lib/marked.esm.js
|
|
@@ -23747,11 +23747,22 @@ function YO({ ...e }) {
|
|
|
23747
23747
|
}
|
|
23748
23748
|
//#endregion
|
|
23749
23749
|
//#region src/components/AgentChat/AgentChatDrawer.tsx
|
|
23750
|
-
function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i = !0, messages: a, composerText: o, onComposerTextChange: s, isLoading: c, error: l, canSend: u, onSubmit: d, isListening:
|
|
23751
|
-
|
|
23750
|
+
function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i = !0, messages: a, composerText: o, onComposerTextChange: s, isLoading: c, error: l, canSend: u, onSubmit: d, isListening: p, isVoiceSupported: m, onToggleVoice: h, drawerTitle: g, runtimeInfo: _, scrollViewportRef: v, drawerDraggable: y, drawerResizableWidth: b, drawerResizableHeight: x, drawerBaseWidth: S = 420, topOffset: C = 0, drawerRightOffset: D = 0, drawerBorderRadius: O = 0, drawerShadow: k = !1 }) {
|
|
23751
|
+
let A = Math.max(280, S + b.offset);
|
|
23752
|
+
return f(() => {
|
|
23753
|
+
if (typeof document > "u") return;
|
|
23754
|
+
let t = document.documentElement;
|
|
23755
|
+
if (!e) {
|
|
23756
|
+
t.style.setProperty("--agent-widget-drawer-width", "0px");
|
|
23757
|
+
return;
|
|
23758
|
+
}
|
|
23759
|
+
return t.style.setProperty("--agent-widget-drawer-width", `${A}px`), () => {
|
|
23760
|
+
t.style.setProperty("--agent-widget-drawer-width", "0px");
|
|
23761
|
+
};
|
|
23762
|
+
}, [e, A]), /* @__PURE__ */ T(w, { children: /* @__PURE__ */ E(ub, {
|
|
23752
23763
|
opened: e,
|
|
23753
23764
|
onClose: t,
|
|
23754
|
-
size:
|
|
23765
|
+
size: A,
|
|
23755
23766
|
zIndex: n,
|
|
23756
23767
|
withinPortal: r,
|
|
23757
23768
|
overlayProps: i ? {
|
|
@@ -23772,29 +23783,32 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
|
|
|
23772
23783
|
content: db.content
|
|
23773
23784
|
},
|
|
23774
23785
|
styles: { content: {
|
|
23775
|
-
marginTop:
|
|
23776
|
-
|
|
23786
|
+
marginTop: C,
|
|
23787
|
+
marginRight: D,
|
|
23788
|
+
height: `calc(100dvh - ${C}px)`,
|
|
23789
|
+
borderRadius: O,
|
|
23790
|
+
boxShadow: k ? "0 16px 40px rgba(15, 23, 42, 0.24)" : "none"
|
|
23777
23791
|
} },
|
|
23778
23792
|
title: /* @__PURE__ */ T(Y, { children: /* @__PURE__ */ E(kl, {
|
|
23779
23793
|
gap: "xs",
|
|
23780
23794
|
align: "center",
|
|
23781
23795
|
wrap: "nowrap",
|
|
23782
23796
|
children: [
|
|
23783
|
-
|
|
23797
|
+
g,
|
|
23784
23798
|
/* @__PURE__ */ T(Xd, {
|
|
23785
23799
|
size: "xs",
|
|
23786
23800
|
c: "dimmed",
|
|
23787
|
-
children:
|
|
23801
|
+
children: _.customerId ? `#${_.customerId}` : "#-"
|
|
23788
23802
|
}),
|
|
23789
23803
|
/* @__PURE__ */ T(Xd, {
|
|
23790
23804
|
size: "xs",
|
|
23791
|
-
c:
|
|
23792
|
-
children:
|
|
23805
|
+
c: _.hasCustomerToken ? "green" : "red",
|
|
23806
|
+
children: _.hasCustomerToken ? "cust✓" : "cust✗"
|
|
23793
23807
|
}),
|
|
23794
23808
|
/* @__PURE__ */ T(Xd, {
|
|
23795
23809
|
size: "xs",
|
|
23796
|
-
c:
|
|
23797
|
-
children:
|
|
23810
|
+
c: _.hasGenaiToken ? "green" : "red",
|
|
23811
|
+
children: _.hasGenaiToken ? "genai✓" : "genai✗"
|
|
23798
23812
|
})
|
|
23799
23813
|
]
|
|
23800
23814
|
}) }),
|
|
@@ -23808,7 +23822,7 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
|
|
|
23808
23822
|
h: "100%",
|
|
23809
23823
|
type: "auto",
|
|
23810
23824
|
offsetScrollbars: !0,
|
|
23811
|
-
viewportRef:
|
|
23825
|
+
viewportRef: v,
|
|
23812
23826
|
children: /* @__PURE__ */ E(zv, {
|
|
23813
23827
|
gap: "sm",
|
|
23814
23828
|
children: [a.map((e) => /* @__PURE__ */ T(Y, {
|
|
@@ -23857,8 +23871,8 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
|
|
|
23857
23871
|
composerText: o,
|
|
23858
23872
|
onComposerTextChange: s,
|
|
23859
23873
|
isLoading: c,
|
|
23860
|
-
isListening:
|
|
23861
|
-
isVoiceSupported:
|
|
23874
|
+
isListening: p,
|
|
23875
|
+
isVoiceSupported: m,
|
|
23862
23876
|
onSubmit: d
|
|
23863
23877
|
}), /* @__PURE__ */ E(kl, {
|
|
23864
23878
|
gap: 4,
|
|
@@ -23869,10 +23883,10 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
|
|
|
23869
23883
|
top: "50%",
|
|
23870
23884
|
transform: "translateY(-50%)"
|
|
23871
23885
|
},
|
|
23872
|
-
children: [
|
|
23873
|
-
isListening:
|
|
23886
|
+
children: [m && /* @__PURE__ */ T(qO, {
|
|
23887
|
+
isListening: p,
|
|
23874
23888
|
isLoading: c,
|
|
23875
|
-
onToggleVoice:
|
|
23889
|
+
onToggleVoice: h
|
|
23876
23890
|
}), /* @__PURE__ */ T(yl, {
|
|
23877
23891
|
onClick: d,
|
|
23878
23892
|
disabled: !u || c,
|
|
@@ -23888,26 +23902,26 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
|
|
|
23888
23902
|
})
|
|
23889
23903
|
}) }),
|
|
23890
23904
|
/* @__PURE__ */ T(Y, {
|
|
23891
|
-
onPointerDown:
|
|
23905
|
+
onPointerDown: x.handlePointerDown,
|
|
23892
23906
|
style: {
|
|
23893
23907
|
position: "absolute",
|
|
23894
23908
|
bottom: 0,
|
|
23895
23909
|
left: 0,
|
|
23896
23910
|
right: 0,
|
|
23897
23911
|
height: "8px",
|
|
23898
|
-
...
|
|
23912
|
+
...x.style,
|
|
23899
23913
|
zIndex: 10
|
|
23900
23914
|
}
|
|
23901
23915
|
}),
|
|
23902
23916
|
/* @__PURE__ */ T(Y, {
|
|
23903
|
-
onPointerDown:
|
|
23917
|
+
onPointerDown: b.handlePointerDown,
|
|
23904
23918
|
style: {
|
|
23905
23919
|
position: "absolute",
|
|
23906
23920
|
top: 0,
|
|
23907
23921
|
bottom: 0,
|
|
23908
23922
|
left: 0,
|
|
23909
23923
|
width: "8px",
|
|
23910
|
-
...
|
|
23924
|
+
...b.style,
|
|
23911
23925
|
zIndex: 10
|
|
23912
23926
|
}
|
|
23913
23927
|
})
|
|
@@ -29109,59 +29123,62 @@ var XF = 1e4, ZF = {
|
|
|
29109
29123
|
};
|
|
29110
29124
|
function QF({ ui: e }) {
|
|
29111
29125
|
YF();
|
|
29112
|
-
let [t, { open: n, close: r }] = mt(!1), i = e?.zIndex ?? XF, a = e?.withinPortal ?? !0, o = e?.withOverlay ?? !0, s = e?.drawerWidth ?? 420, c = e?.topOffset ?? 0, l = {
|
|
29126
|
+
let [t, { open: n, close: r }] = mt(!1), i = e?.zIndex ?? XF, a = e?.withinPortal ?? !0, o = e?.withOverlay ?? !0, s = e?.drawerWidth ?? 420, c = e?.topOffset ?? 0, l = e?.drawerRightOffset ?? 0, u = e?.drawerBorderRadius ?? 0, d = e?.drawerShadow ?? !1, f = {
|
|
29113
29127
|
bottom: e?.fabBottomOffset ?? ZF.bottom,
|
|
29114
29128
|
right: e?.fabRightOffset ?? ZF.right
|
|
29115
|
-
}, { messages:
|
|
29129
|
+
}, { messages: p, composerText: m, setComposerText: h, isLoading: g, error: v, sendMessage: y, sendInitialMessage: b, canSend: x } = zF(), { runtimeInfo: S, refreshRuntimeInfo: C } = BF(), D = ek({ skipSelector: "button, input, textarea, [role=\"button\"]" }), O = VF({ axis: "y" }), k = VF({
|
|
29116
29130
|
axis: "x",
|
|
29117
29131
|
direction: -1
|
|
29118
|
-
}),
|
|
29132
|
+
}), A = UF([p.length, g]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: F } = WF({
|
|
29119
29133
|
lang: GF(),
|
|
29120
29134
|
continuous: !0,
|
|
29121
29135
|
pauseOnSubmit: !0,
|
|
29122
|
-
onTextChange:
|
|
29123
|
-
}),
|
|
29136
|
+
onTextChange: h
|
|
29137
|
+
}), ee = _(() => /* @__PURE__ */ T(Xd, {
|
|
29124
29138
|
fw: 800,
|
|
29125
29139
|
children: "Agent Chat"
|
|
29126
|
-
}), []),
|
|
29127
|
-
n(), await
|
|
29140
|
+
}), []), te = async () => {
|
|
29141
|
+
n(), await C(), await b();
|
|
29128
29142
|
};
|
|
29129
29143
|
return /* @__PURE__ */ E(w, { children: [!t && /* @__PURE__ */ T(nk, {
|
|
29130
|
-
onClick: () => void
|
|
29144
|
+
onClick: () => void te(),
|
|
29131
29145
|
zIndex: i,
|
|
29132
|
-
position:
|
|
29146
|
+
position: f,
|
|
29133
29147
|
color: e?.accentColor,
|
|
29134
29148
|
label: e?.fabButtonLabel
|
|
29135
29149
|
}), /* @__PURE__ */ T(XO, {
|
|
29136
29150
|
opened: t,
|
|
29137
29151
|
onClose: () => {
|
|
29138
|
-
|
|
29152
|
+
j && P(), r();
|
|
29139
29153
|
},
|
|
29140
29154
|
zIndex: i,
|
|
29141
29155
|
withinPortal: a,
|
|
29142
29156
|
withOverlay: o,
|
|
29143
29157
|
topOffset: c,
|
|
29144
29158
|
drawerBaseWidth: s,
|
|
29145
|
-
|
|
29146
|
-
|
|
29147
|
-
|
|
29148
|
-
|
|
29149
|
-
|
|
29150
|
-
|
|
29159
|
+
drawerRightOffset: l,
|
|
29160
|
+
drawerBorderRadius: u,
|
|
29161
|
+
drawerShadow: d,
|
|
29162
|
+
messages: p,
|
|
29163
|
+
composerText: m,
|
|
29164
|
+
onComposerTextChange: h,
|
|
29165
|
+
isLoading: g,
|
|
29166
|
+
error: v,
|
|
29167
|
+
canSend: x,
|
|
29151
29168
|
onSubmit: () => {
|
|
29152
|
-
|
|
29169
|
+
j && P(), F(), y(m);
|
|
29153
29170
|
},
|
|
29154
|
-
isListening:
|
|
29155
|
-
isVoiceSupported:
|
|
29171
|
+
isListening: j,
|
|
29172
|
+
isVoiceSupported: M,
|
|
29156
29173
|
onToggleVoice: () => {
|
|
29157
|
-
|
|
29174
|
+
j ? P() : (h(""), N());
|
|
29158
29175
|
},
|
|
29159
|
-
drawerTitle:
|
|
29160
|
-
runtimeInfo:
|
|
29161
|
-
scrollViewportRef:
|
|
29162
|
-
drawerDraggable:
|
|
29163
|
-
drawerResizableWidth:
|
|
29164
|
-
drawerResizableHeight:
|
|
29176
|
+
drawerTitle: ee,
|
|
29177
|
+
runtimeInfo: S,
|
|
29178
|
+
scrollViewportRef: A,
|
|
29179
|
+
drawerDraggable: D,
|
|
29180
|
+
drawerResizableWidth: k,
|
|
29181
|
+
drawerResizableHeight: O
|
|
29165
29182
|
})] });
|
|
29166
29183
|
}
|
|
29167
29184
|
//#endregion
|