@2uinc/frontend-component-xpert-chatbot 1.13.9 → 1.13.10-beta.1
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/lib/index.min.js +82 -84
- package/package.json +1 -1
package/dist/lib/index.min.js
CHANGED
@@ -10381,7 +10381,7 @@ _n.defaultProps = {
|
|
10381
10381
|
text: null,
|
10382
10382
|
userTrackingName: "clicked"
|
10383
10383
|
};
|
10384
|
-
const Fn = ({
|
10384
|
+
const Kh = "Sure, I can get you to someone who can help.", Fn = ({
|
10385
10385
|
index: e,
|
10386
10386
|
message: t,
|
10387
10387
|
isNormalSize: n,
|
@@ -10392,9 +10392,9 @@ const Fn = ({
|
|
10392
10392
|
setLiveChatOpen: l,
|
10393
10393
|
isTestUser: s
|
10394
10394
|
}) => /* @__PURE__ */ N.jsx(
|
10395
|
-
"
|
10395
|
+
"section",
|
10396
10396
|
{
|
10397
|
-
|
10397
|
+
"aria-label": "The bot said",
|
10398
10398
|
className: "xpert-chatbot-popup__bubble--group",
|
10399
10399
|
ref: i,
|
10400
10400
|
children: /* @__PURE__ */ N.jsxs("div", { className: "xpert-chatbot-popup__bubble--group-inner", children: [
|
@@ -10403,12 +10403,10 @@ const Fn = ({
|
|
10403
10403
|
{
|
10404
10404
|
"data-testid": "message-container",
|
10405
10405
|
className: "xpert-chatbot-popup__bubble--assistant",
|
10406
|
-
role: "region",
|
10407
|
-
"aria-label": "Assistant message",
|
10408
10406
|
style: { maxWidth: n ? "85%" : "67%" },
|
10409
10407
|
children: t.liveAgent ? /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
10410
|
-
/* @__PURE__ */ N.jsx("div", { children:
|
10411
|
-
/* @__PURE__ */ N.jsx(
|
10408
|
+
/* @__PURE__ */ N.jsx("div", { children: Kh }),
|
10409
|
+
/* @__PURE__ */ N.jsx(
|
10412
10410
|
_n,
|
10413
10411
|
{
|
10414
10412
|
submitEvent: a,
|
@@ -10419,21 +10417,23 @@ const Fn = ({
|
|
10419
10417
|
text: "Chat with us",
|
10420
10418
|
userTrackingName: "assistant.response.clicked"
|
10421
10419
|
}
|
10422
|
-
)
|
10420
|
+
)
|
10423
10421
|
] }) : /* @__PURE__ */ N.jsx(
|
10424
10422
|
Ga,
|
10425
10423
|
{
|
10426
10424
|
components: {
|
10427
|
-
a: (u) =>
|
10428
|
-
|
10429
|
-
|
10430
|
-
|
10431
|
-
|
10432
|
-
|
10433
|
-
|
10434
|
-
|
10435
|
-
|
10436
|
-
|
10425
|
+
a: (u) => (
|
10426
|
+
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
10427
|
+
/* @__PURE__ */ N.jsx(
|
10428
|
+
"a",
|
10429
|
+
{
|
10430
|
+
...u,
|
10431
|
+
role: "link",
|
10432
|
+
onClick: o,
|
10433
|
+
onKeyDown: void 0,
|
10434
|
+
children: u.children
|
10435
|
+
}
|
10436
|
+
)
|
10437
10437
|
)
|
10438
10438
|
},
|
10439
10439
|
linkTarget: "_blank",
|
@@ -10471,7 +10471,7 @@ Fn.defaultProps = {
|
|
10471
10471
|
isTestUser: !1
|
10472
10472
|
};
|
10473
10473
|
Fn.displayName = "AssistantMessageBubble";
|
10474
|
-
const
|
10474
|
+
const Xh = Fn, Ka = () => {
|
10475
10475
|
const { disclaimer: e } = _e(Fe), t = We(null);
|
10476
10476
|
return be(() => {
|
10477
10477
|
var n;
|
@@ -10504,7 +10504,7 @@ const Kh = Fn, Ka = () => {
|
|
10504
10504
|
);
|
10505
10505
|
};
|
10506
10506
|
Ka.displayName = "ConversationScreenDisclaimer";
|
10507
|
-
const
|
10507
|
+
const Jh = Ka, Xr = ({ loading: e, onPromptClick: t }) => {
|
10508
10508
|
var i;
|
10509
10509
|
const { primaryColor: n, conversationScreen: r } = _e(Fe);
|
10510
10510
|
return /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
@@ -10535,7 +10535,7 @@ Xr.propTypes = {
|
|
10535
10535
|
onPromptClick: D.func.isRequired
|
10536
10536
|
};
|
10537
10537
|
Xr.displayName = "PromptList";
|
10538
|
-
const
|
10538
|
+
const eg = Xr, Jr = ({ message: e, isNormalSize: t }) => /* @__PURE__ */ N.jsx("div", { role: "status", className: "xpert-chatbot-popup__bubble--group", children: /* @__PURE__ */ N.jsx("div", { className: "xpert-chatbot-popup__bubble--group-inner", children: /* @__PURE__ */ N.jsx(
|
10539
10539
|
"div",
|
10540
10540
|
{
|
10541
10541
|
"data-testid": "message-container",
|
@@ -10549,13 +10549,13 @@ Jr.propTypes = {
|
|
10549
10549
|
isNormalSize: D.bool.isRequired
|
10550
10550
|
};
|
10551
10551
|
Jr.displayName = "SystemMessageBubble";
|
10552
|
-
const
|
10552
|
+
const tg = Jr, ei = ({ content: e, isNormalSize: t }) => {
|
10553
10553
|
var i;
|
10554
10554
|
const { primaryColor: n, conversationScreen: r } = _e(Fe);
|
10555
10555
|
return /* @__PURE__ */ N.jsx(
|
10556
|
-
"
|
10556
|
+
"section",
|
10557
10557
|
{
|
10558
|
-
|
10558
|
+
"aria-label": "The user said",
|
10559
10559
|
className: "xpert-chatbot-popup__bubble--user",
|
10560
10560
|
style: {
|
10561
10561
|
backgroundColor: n,
|
@@ -10571,7 +10571,7 @@ ei.propTypes = {
|
|
10571
10571
|
isNormalSize: D.bool.isRequired
|
10572
10572
|
};
|
10573
10573
|
ei.displayName = "UserMessageBubble";
|
10574
|
-
const
|
10574
|
+
const ng = ei, Pn = ({
|
10575
10575
|
messages: e,
|
10576
10576
|
loading: t,
|
10577
10577
|
isNormalSize: n,
|
@@ -10590,51 +10590,49 @@ const tg = ei, Pn = ({
|
|
10590
10590
|
block: "start"
|
10591
10591
|
});
|
10592
10592
|
}, [e.length]), /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
10593
|
-
/* @__PURE__ */ N.jsx(
|
10594
|
-
(c == null ? void 0 : c.length) > 0 && /* @__PURE__ */ N.jsx(
|
10595
|
-
/* @__PURE__ */ N.
|
10596
|
-
|
10593
|
+
/* @__PURE__ */ N.jsx(Jh, {}),
|
10594
|
+
(c == null ? void 0 : c.length) > 0 && /* @__PURE__ */ N.jsx(eg, { loading: t, onPromptClick: i }),
|
10595
|
+
p && /* @__PURE__ */ N.jsx(
|
10596
|
+
tg,
|
10597
10597
|
{
|
10598
|
+
message: p,
|
10599
|
+
isNormalSize: n
|
10600
|
+
}
|
10601
|
+
),
|
10602
|
+
/* @__PURE__ */ N.jsx(
|
10603
|
+
"section",
|
10604
|
+
{
|
10605
|
+
id: "chat-content",
|
10598
10606
|
"aria-live": "polite",
|
10599
|
-
role: "region",
|
10600
10607
|
"aria-relevant": "additions",
|
10601
10608
|
"aria-atomic": "false",
|
10602
|
-
"aria-label": "Chat
|
10609
|
+
"aria-label": "Chat conversation",
|
10603
10610
|
"aria-busy": t,
|
10604
10611
|
style: { display: "flex", flexDirection: "column" },
|
10605
|
-
children:
|
10606
|
-
|
10607
|
-
|
10612
|
+
children: e.map(
|
10613
|
+
(f, v) => f.role === "assistant" ? /* @__PURE__ */ N.jsx(
|
10614
|
+
Xh,
|
10615
|
+
{
|
10616
|
+
index: v,
|
10617
|
+
message: f,
|
10618
|
+
isNormalSize: n,
|
10619
|
+
onFeedbackThumbSelection: r,
|
10620
|
+
messageRef: m,
|
10621
|
+
handleMessageLinkClicked: o,
|
10622
|
+
submitEvent: a,
|
10623
|
+
setLiveChatOpen: l,
|
10624
|
+
isTestUser: s
|
10625
|
+
},
|
10626
|
+
`${f.role}-${v}`
|
10627
|
+
) : /* @__PURE__ */ N.jsx(
|
10628
|
+
ng,
|
10608
10629
|
{
|
10609
|
-
|
10630
|
+
content: f.content,
|
10610
10631
|
isNormalSize: n
|
10611
|
-
}
|
10612
|
-
|
10613
|
-
e.map(
|
10614
|
-
(f, v) => f.role === "assistant" ? /* @__PURE__ */ N.jsx(
|
10615
|
-
Kh,
|
10616
|
-
{
|
10617
|
-
index: v,
|
10618
|
-
message: f,
|
10619
|
-
isNormalSize: n,
|
10620
|
-
onFeedbackThumbSelection: r,
|
10621
|
-
messageRef: m,
|
10622
|
-
handleMessageLinkClicked: o,
|
10623
|
-
submitEvent: a,
|
10624
|
-
setLiveChatOpen: l,
|
10625
|
-
isTestUser: s
|
10626
|
-
},
|
10627
|
-
`${f.role}-${v}`
|
10628
|
-
) : /* @__PURE__ */ N.jsx(
|
10629
|
-
tg,
|
10630
|
-
{
|
10631
|
-
content: f.content,
|
10632
|
-
isNormalSize: n
|
10633
|
-
},
|
10634
|
-
`${f.role}-${f.timestamp || v}`
|
10635
|
-
)
|
10632
|
+
},
|
10633
|
+
`${f.role}-${f.timestamp || v}`
|
10636
10634
|
)
|
10637
|
-
|
10635
|
+
)
|
10638
10636
|
}
|
10639
10637
|
)
|
10640
10638
|
] });
|
@@ -10664,7 +10662,7 @@ Pn.defaultProps = {
|
|
10664
10662
|
isTestUser: !1
|
10665
10663
|
};
|
10666
10664
|
Pn.displayName = "ConversationsMessages";
|
10667
|
-
const
|
10665
|
+
const rg = Pn;
|
10668
10666
|
function Xa({ disableScroll: e }) {
|
10669
10667
|
const t = We(null);
|
10670
10668
|
return be(() => {
|
@@ -10676,9 +10674,9 @@ function Xa({ disableScroll: e }) {
|
|
10676
10674
|
}, [e]), /* @__PURE__ */ N.jsx(
|
10677
10675
|
"div",
|
10678
10676
|
{
|
10679
|
-
"aria-label": "Loading",
|
10677
|
+
"aria-label": "Loading messages",
|
10680
10678
|
ref: t,
|
10681
|
-
role: "
|
10679
|
+
role: "alert",
|
10682
10680
|
className: "xpert_chatbot__loader__wrapper",
|
10683
10681
|
children: /* @__PURE__ */ N.jsxs("div", { className: "xpert_chatbot__loader__ellipsis", children: [
|
10684
10682
|
/* @__PURE__ */ N.jsx("div", { className: "xpert_chatbot__loader__ellipsis-bullets--first" }),
|
@@ -10691,7 +10689,7 @@ function Xa({ disableScroll: e }) {
|
|
10691
10689
|
Xa.propTypes = {
|
10692
10690
|
disableScroll: D.bool
|
10693
10691
|
};
|
10694
|
-
const
|
10692
|
+
const ig = () => {
|
10695
10693
|
const e = We(null);
|
10696
10694
|
return be(() => {
|
10697
10695
|
var t;
|
@@ -10754,7 +10752,7 @@ const rg = () => {
|
|
10754
10752
|
]
|
10755
10753
|
}
|
10756
10754
|
);
|
10757
|
-
}, lr =
|
10755
|
+
}, lr = ig;
|
10758
10756
|
function Ja({
|
10759
10757
|
children: e,
|
10760
10758
|
cookieName: t,
|
@@ -10843,7 +10841,7 @@ Ja.propTypes = {
|
|
10843
10841
|
showMessage: D.bool,
|
10844
10842
|
style: D.shape()
|
10845
10843
|
};
|
10846
|
-
function
|
10844
|
+
function og(e, t, n) {
|
10847
10845
|
const r = vt(
|
10848
10846
|
(i) => {
|
10849
10847
|
const { data: o } = i || {}, { chatState: a, show: l, type: s } = o || {};
|
@@ -10873,7 +10871,7 @@ function ig(e, t, n) {
|
|
10873
10871
|
};
|
10874
10872
|
}, [e, t]);
|
10875
10873
|
}
|
10876
|
-
function
|
10874
|
+
function ag(e) {
|
10877
10875
|
const [t, n] = ye(null);
|
10878
10876
|
return be(() => {
|
10879
10877
|
try {
|
@@ -10903,7 +10901,7 @@ function og(e) {
|
|
10903
10901
|
`Chatbot - Optimizely experimentVariation: ${t}`
|
10904
10902
|
), t;
|
10905
10903
|
}
|
10906
|
-
function
|
10904
|
+
function lg(e) {
|
10907
10905
|
be(() => {
|
10908
10906
|
e();
|
10909
10907
|
const t = () => document.visibilityState === "visible" && e();
|
@@ -10912,21 +10910,21 @@ function ag(e) {
|
|
10912
10910
|
};
|
10913
10911
|
}, [e]);
|
10914
10912
|
}
|
10915
|
-
function
|
10913
|
+
function sg(e, t) {
|
10916
10914
|
if (!(e instanceof Date && t instanceof Date))
|
10917
10915
|
throw new Error(
|
10918
10916
|
`Both start and end must be valid Date objects: start=${e} end=${t}`
|
10919
10917
|
);
|
10920
10918
|
return (t.getTime() - e.getTime()) / 1e3;
|
10921
10919
|
}
|
10922
|
-
function
|
10920
|
+
function ug(e) {
|
10923
10921
|
const t = /\[(.+)\]\(([^ ]+)( "(.+)")?\)/gm, n = e.match(t);
|
10924
10922
|
return (n == null ? void 0 : n.length) || 0;
|
10925
10923
|
}
|
10926
|
-
function
|
10924
|
+
function cg(e) {
|
10927
10925
|
return new TextEncoder().encode(e).length;
|
10928
10926
|
}
|
10929
|
-
const
|
10927
|
+
const pg = 991, fg = [];
|
10930
10928
|
function ti({ submitEventExternal: e }) {
|
10931
10929
|
var at, mt;
|
10932
10930
|
const {
|
@@ -10937,8 +10935,8 @@ function ti({ submitEventExternal: e }) {
|
|
10937
10935
|
userTracking: o,
|
10938
10936
|
webExperimentation: a,
|
10939
10937
|
xpertKey: l
|
10940
|
-
} = _e(Fe), s = rt(
|
10941
|
-
|
10938
|
+
} = _e(Fe), s = rt(pg), [, u] = ye(!1), [, c] = ye(!1), [p, m] = ye(fg), [f, v] = ye(!1), [b, k] = ye(!1), [M, z] = ye(!1), [E, _] = ye(""), [U, x] = ye(!1), [L, $] = ye(!0), [W, X] = ye(!1), [A, w] = ye(!1), [j, O] = ye(!1), F = We(null), B = We(null), V = We(null), q = Le.get(`${l}-test`) === "1";
|
10939
|
+
og(
|
10942
10940
|
n.liveChat.enabled,
|
10943
10941
|
M,
|
10944
10942
|
z
|
@@ -10990,7 +10988,7 @@ function ti({ submitEventExternal: e }) {
|
|
10990
10988
|
v(!1);
|
10991
10989
|
}
|
10992
10990
|
}, [l, t.endpoint]);
|
10993
|
-
|
10991
|
+
lg(g), be(() => {
|
10994
10992
|
let R, ee;
|
10995
10993
|
return o.enabled && (R = setInterval(() => {
|
10996
10994
|
var le;
|
@@ -11021,7 +11019,7 @@ function ti({ submitEventExternal: e }) {
|
|
11021
11019
|
isTestUser: q
|
11022
11020
|
}
|
11023
11021
|
});
|
11024
|
-
}, Me =
|
11022
|
+
}, Me = ag(
|
11025
11023
|
a.experimentName
|
11026
11024
|
);
|
11027
11025
|
if (a.enabled && !a.experimentName && !q)
|
@@ -11038,7 +11036,7 @@ function ti({ submitEventExternal: e }) {
|
|
11038
11036
|
payload: {
|
11039
11037
|
category: "2u",
|
11040
11038
|
label: "xpert-chatbot",
|
11041
|
-
linkCount:
|
11039
|
+
linkCount: ug(R),
|
11042
11040
|
apiResponseMessage: R,
|
11043
11041
|
isTestUser: q,
|
11044
11042
|
conversationHistoryId: ee
|
@@ -11125,11 +11123,11 @@ function ti({ submitEventExternal: e }) {
|
|
11125
11123
|
ge(I, le);
|
11126
11124
|
const Y = /* @__PURE__ */ new Date();
|
11127
11125
|
Ie({
|
11128
|
-
conversationByteSize:
|
11126
|
+
conversationByteSize: cg(JSON.stringify(Qe)),
|
11129
11127
|
conversationSize: p.length + 2,
|
11130
11128
|
userInputMessage: R,
|
11131
11129
|
apiResponseMessage: I,
|
11132
|
-
elapsedSeconds:
|
11130
|
+
elapsedSeconds: sg(ee, Y)
|
11133
11131
|
}), m((J) => [
|
11134
11132
|
...J,
|
11135
11133
|
{
|
@@ -11293,7 +11291,7 @@ function ti({ submitEventExternal: e }) {
|
|
11293
11291
|
},
|
11294
11292
|
children: [
|
11295
11293
|
/* @__PURE__ */ N.jsx(
|
11296
|
-
|
11294
|
+
rg,
|
11297
11295
|
{
|
11298
11296
|
messages: p,
|
11299
11297
|
loading: f,
|
@@ -11361,7 +11359,7 @@ el.propTypes = {
|
|
11361
11359
|
configurations: D.object,
|
11362
11360
|
xpertKey: D.string
|
11363
11361
|
};
|
11364
|
-
function
|
11362
|
+
function dg({ configurations: e = {}, key: t, submitEventExternal: n, xpertKey: r }) {
|
11365
11363
|
return /* @__PURE__ */ N.jsx(
|
11366
11364
|
el,
|
11367
11365
|
{
|
@@ -11372,14 +11370,14 @@ function fg({ configurations: e = {}, key: t, submitEventExternal: n, xpertKey:
|
|
11372
11370
|
t
|
11373
11371
|
);
|
11374
11372
|
}
|
11375
|
-
|
11373
|
+
dg.propTypes = {
|
11376
11374
|
configurations: D.object,
|
11377
11375
|
key: D.string,
|
11378
11376
|
submitEventExternal: D.func,
|
11379
11377
|
xpertKey: D.string.isRequired
|
11380
11378
|
};
|
11381
11379
|
export {
|
11382
|
-
|
11380
|
+
dg as Chatbot,
|
11383
11381
|
is as EDXConfig,
|
11384
11382
|
os as EmersonSpeechConfig,
|
11385
11383
|
as as GetSmarterConfig,
|