bstp-agent-widget 0.2.43 → 0.2.44
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 +68 -60
- package/dist/agent-widget.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/index.d.ts +1 -0
package/dist/agent-widget.js
CHANGED
|
@@ -23747,17 +23747,24 @@ 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,
|
|
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: f, isVoiceSupported: p, onToggleVoice: m, drawerTitle: h, runtimeInfo: g, scrollViewportRef: _, drawerDraggable: v, drawerResizableWidth: y, drawerResizableHeight: b, drawerBaseWidth: x = 420, topOffset: S = 0 }) {
|
|
23751
23751
|
return /* @__PURE__ */ T(w, { children: /* @__PURE__ */ E(ub, {
|
|
23752
23752
|
opened: e,
|
|
23753
23753
|
onClose: t,
|
|
23754
|
-
size: Math.max(280,
|
|
23754
|
+
size: Math.max(280, x + y.offset),
|
|
23755
23755
|
zIndex: n,
|
|
23756
23756
|
withinPortal: r,
|
|
23757
|
-
overlayProps: {
|
|
23757
|
+
overlayProps: i ? {
|
|
23758
23758
|
backgroundOpacity: .45,
|
|
23759
23759
|
blur: 0,
|
|
23760
23760
|
style: { zIndex: Math.max(1, n - 1) }
|
|
23761
|
+
} : {
|
|
23762
|
+
backgroundOpacity: 0,
|
|
23763
|
+
blur: 0,
|
|
23764
|
+
style: {
|
|
23765
|
+
zIndex: Math.max(1, n - 1),
|
|
23766
|
+
pointerEvents: "none"
|
|
23767
|
+
}
|
|
23761
23768
|
},
|
|
23762
23769
|
classNames: {
|
|
23763
23770
|
root: db.root,
|
|
@@ -23765,46 +23772,46 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, messages: i, co
|
|
|
23765
23772
|
content: db.content
|
|
23766
23773
|
},
|
|
23767
23774
|
styles: { content: {
|
|
23768
|
-
marginTop:
|
|
23769
|
-
height: `calc(100vh - ${
|
|
23775
|
+
marginTop: S,
|
|
23776
|
+
height: `calc(100vh - ${S}px)`
|
|
23770
23777
|
} },
|
|
23771
23778
|
title: /* @__PURE__ */ T(Y, { children: /* @__PURE__ */ E(kl, {
|
|
23772
23779
|
gap: "xs",
|
|
23773
23780
|
align: "center",
|
|
23774
23781
|
wrap: "nowrap",
|
|
23775
23782
|
children: [
|
|
23776
|
-
|
|
23783
|
+
h,
|
|
23777
23784
|
/* @__PURE__ */ T(Xd, {
|
|
23778
23785
|
size: "xs",
|
|
23779
23786
|
c: "dimmed",
|
|
23780
|
-
children:
|
|
23787
|
+
children: g.customerId ? `#${g.customerId}` : "#-"
|
|
23781
23788
|
}),
|
|
23782
23789
|
/* @__PURE__ */ T(Xd, {
|
|
23783
23790
|
size: "xs",
|
|
23784
|
-
c:
|
|
23785
|
-
children:
|
|
23791
|
+
c: g.hasCustomerToken ? "green" : "red",
|
|
23792
|
+
children: g.hasCustomerToken ? "cust✓" : "cust✗"
|
|
23786
23793
|
}),
|
|
23787
23794
|
/* @__PURE__ */ T(Xd, {
|
|
23788
23795
|
size: "xs",
|
|
23789
|
-
c:
|
|
23790
|
-
children:
|
|
23796
|
+
c: g.hasGenaiToken ? "green" : "red",
|
|
23797
|
+
children: g.hasGenaiToken ? "genai✓" : "genai✗"
|
|
23791
23798
|
})
|
|
23792
23799
|
]
|
|
23793
23800
|
}) }),
|
|
23794
23801
|
children: [
|
|
23795
|
-
/* @__PURE__ */ E(ub.Body, { children: [
|
|
23802
|
+
/* @__PURE__ */ E(ub.Body, { children: [l && /* @__PURE__ */ T(Xd, {
|
|
23796
23803
|
size: "xs",
|
|
23797
23804
|
c: "red",
|
|
23798
23805
|
mb: "sm",
|
|
23799
|
-
children:
|
|
23806
|
+
children: l
|
|
23800
23807
|
}), /* @__PURE__ */ T(uc, {
|
|
23801
23808
|
h: "100%",
|
|
23802
23809
|
type: "auto",
|
|
23803
23810
|
offsetScrollbars: !0,
|
|
23804
|
-
viewportRef:
|
|
23811
|
+
viewportRef: _,
|
|
23805
23812
|
children: /* @__PURE__ */ E(zv, {
|
|
23806
23813
|
gap: "sm",
|
|
23807
|
-
children: [
|
|
23814
|
+
children: [a.map((e) => /* @__PURE__ */ T(Y, {
|
|
23808
23815
|
style: {
|
|
23809
23816
|
alignSelf: e.sentBy === "user" ? "flex-end" : "flex-start",
|
|
23810
23817
|
maxWidth: "90%",
|
|
@@ -23820,7 +23827,7 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, messages: i, co
|
|
|
23820
23827
|
},
|
|
23821
23828
|
children: e.text
|
|
23822
23829
|
})
|
|
23823
|
-
}, e.id)),
|
|
23830
|
+
}, e.id)), c && /* @__PURE__ */ T(Y, {
|
|
23824
23831
|
style: {
|
|
23825
23832
|
alignSelf: "flex-start",
|
|
23826
23833
|
maxWidth: "90%",
|
|
@@ -23847,12 +23854,12 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, messages: i, co
|
|
|
23847
23854
|
width: "100%"
|
|
23848
23855
|
},
|
|
23849
23856
|
children: [/* @__PURE__ */ T(JO, {
|
|
23850
|
-
composerText:
|
|
23851
|
-
onComposerTextChange:
|
|
23852
|
-
isLoading:
|
|
23853
|
-
isListening:
|
|
23854
|
-
isVoiceSupported:
|
|
23855
|
-
onSubmit:
|
|
23857
|
+
composerText: o,
|
|
23858
|
+
onComposerTextChange: s,
|
|
23859
|
+
isLoading: c,
|
|
23860
|
+
isListening: f,
|
|
23861
|
+
isVoiceSupported: p,
|
|
23862
|
+
onSubmit: d
|
|
23856
23863
|
}), /* @__PURE__ */ E(kl, {
|
|
23857
23864
|
gap: 4,
|
|
23858
23865
|
align: "center",
|
|
@@ -23862,13 +23869,13 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, messages: i, co
|
|
|
23862
23869
|
top: "50%",
|
|
23863
23870
|
transform: "translateY(-50%)"
|
|
23864
23871
|
},
|
|
23865
|
-
children: [
|
|
23866
|
-
isListening:
|
|
23867
|
-
isLoading:
|
|
23868
|
-
onToggleVoice:
|
|
23872
|
+
children: [p && /* @__PURE__ */ T(qO, {
|
|
23873
|
+
isListening: f,
|
|
23874
|
+
isLoading: c,
|
|
23875
|
+
onToggleVoice: m
|
|
23869
23876
|
}), /* @__PURE__ */ T(yl, {
|
|
23870
|
-
onClick:
|
|
23871
|
-
disabled: !
|
|
23877
|
+
onClick: d,
|
|
23878
|
+
disabled: !u || c,
|
|
23872
23879
|
size: 32,
|
|
23873
23880
|
radius: "xl",
|
|
23874
23881
|
variant: "filled",
|
|
@@ -23881,26 +23888,26 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, messages: i, co
|
|
|
23881
23888
|
})
|
|
23882
23889
|
}) }),
|
|
23883
23890
|
/* @__PURE__ */ T(Y, {
|
|
23884
|
-
onPointerDown:
|
|
23891
|
+
onPointerDown: b.handlePointerDown,
|
|
23885
23892
|
style: {
|
|
23886
23893
|
position: "absolute",
|
|
23887
23894
|
bottom: 0,
|
|
23888
23895
|
left: 0,
|
|
23889
23896
|
right: 0,
|
|
23890
23897
|
height: "8px",
|
|
23891
|
-
...
|
|
23898
|
+
...b.style,
|
|
23892
23899
|
zIndex: 10
|
|
23893
23900
|
}
|
|
23894
23901
|
}),
|
|
23895
23902
|
/* @__PURE__ */ T(Y, {
|
|
23896
|
-
onPointerDown:
|
|
23903
|
+
onPointerDown: y.handlePointerDown,
|
|
23897
23904
|
style: {
|
|
23898
23905
|
position: "absolute",
|
|
23899
23906
|
top: 0,
|
|
23900
23907
|
bottom: 0,
|
|
23901
23908
|
left: 0,
|
|
23902
23909
|
width: "8px",
|
|
23903
|
-
...
|
|
23910
|
+
...y.style,
|
|
23904
23911
|
zIndex: 10
|
|
23905
23912
|
}
|
|
23906
23913
|
})
|
|
@@ -29102,58 +29109,59 @@ var XF = 1e4, ZF = {
|
|
|
29102
29109
|
};
|
|
29103
29110
|
function QF({ ui: e }) {
|
|
29104
29111
|
YF();
|
|
29105
|
-
let [t, { open: n, close: r }] = mt(!1), i = e?.zIndex ?? XF, a = e?.withinPortal ?? !0, o = e?.drawerWidth ?? 420,
|
|
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 = {
|
|
29106
29113
|
bottom: e?.fabBottomOffset ?? ZF.bottom,
|
|
29107
29114
|
right: e?.fabRightOffset ?? ZF.right
|
|
29108
|
-
}, { messages:
|
|
29115
|
+
}, { messages: u, composerText: d, setComposerText: f, isLoading: p, error: m, sendMessage: h, sendInitialMessage: g, canSend: v } = zF(), { runtimeInfo: y, refreshRuntimeInfo: b } = BF(), x = ek({ skipSelector: "button, input, textarea, [role=\"button\"]" }), S = VF({ axis: "y" }), C = VF({
|
|
29109
29116
|
axis: "x",
|
|
29110
29117
|
direction: -1
|
|
29111
|
-
}),
|
|
29118
|
+
}), D = UF([u.length, p]), { isListening: O, isSupported: k, startListening: A, stopListening: j, reset: M } = WF({
|
|
29112
29119
|
lang: GF(),
|
|
29113
29120
|
continuous: !0,
|
|
29114
29121
|
pauseOnSubmit: !0,
|
|
29115
|
-
onTextChange:
|
|
29116
|
-
}),
|
|
29122
|
+
onTextChange: f
|
|
29123
|
+
}), N = _(() => /* @__PURE__ */ T(Xd, {
|
|
29117
29124
|
fw: 800,
|
|
29118
29125
|
children: "Agent Chat"
|
|
29119
|
-
}), []),
|
|
29120
|
-
n(), await
|
|
29126
|
+
}), []), P = async () => {
|
|
29127
|
+
n(), await b(), await g();
|
|
29121
29128
|
};
|
|
29122
29129
|
return /* @__PURE__ */ E(w, { children: [!t && /* @__PURE__ */ T(nk, {
|
|
29123
|
-
onClick: () => void
|
|
29130
|
+
onClick: () => void P(),
|
|
29124
29131
|
zIndex: i,
|
|
29125
|
-
position:
|
|
29132
|
+
position: l,
|
|
29126
29133
|
color: e?.accentColor,
|
|
29127
29134
|
label: e?.fabButtonLabel
|
|
29128
29135
|
}), /* @__PURE__ */ T(XO, {
|
|
29129
29136
|
opened: t,
|
|
29130
29137
|
onClose: () => {
|
|
29131
|
-
|
|
29138
|
+
O && j(), r();
|
|
29132
29139
|
},
|
|
29133
29140
|
zIndex: i,
|
|
29134
29141
|
withinPortal: a,
|
|
29135
|
-
|
|
29136
|
-
|
|
29137
|
-
|
|
29138
|
-
|
|
29139
|
-
|
|
29140
|
-
|
|
29141
|
-
|
|
29142
|
-
|
|
29142
|
+
withOverlay: o,
|
|
29143
|
+
topOffset: c,
|
|
29144
|
+
drawerBaseWidth: s,
|
|
29145
|
+
messages: u,
|
|
29146
|
+
composerText: d,
|
|
29147
|
+
onComposerTextChange: f,
|
|
29148
|
+
isLoading: p,
|
|
29149
|
+
error: m,
|
|
29150
|
+
canSend: v,
|
|
29143
29151
|
onSubmit: () => {
|
|
29144
|
-
|
|
29152
|
+
O && j(), M(), h(d);
|
|
29145
29153
|
},
|
|
29146
|
-
isListening:
|
|
29147
|
-
isVoiceSupported:
|
|
29154
|
+
isListening: O,
|
|
29155
|
+
isVoiceSupported: k,
|
|
29148
29156
|
onToggleVoice: () => {
|
|
29149
|
-
|
|
29157
|
+
O ? j() : (f(""), A());
|
|
29150
29158
|
},
|
|
29151
|
-
drawerTitle:
|
|
29152
|
-
runtimeInfo:
|
|
29153
|
-
scrollViewportRef:
|
|
29154
|
-
drawerDraggable:
|
|
29155
|
-
drawerResizableWidth:
|
|
29156
|
-
drawerResizableHeight:
|
|
29159
|
+
drawerTitle: N,
|
|
29160
|
+
runtimeInfo: y,
|
|
29161
|
+
scrollViewportRef: D,
|
|
29162
|
+
drawerDraggable: x,
|
|
29163
|
+
drawerResizableWidth: C,
|
|
29164
|
+
drawerResizableHeight: S
|
|
29157
29165
|
})] });
|
|
29158
29166
|
}
|
|
29159
29167
|
//#endregion
|