@2uinc/frontend-component-xpert-chatbot 1.3.10-beta.3 → 1.3.10
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 +44 -39
- package/package.json +1 -1
package/dist/lib/index.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import ue, { useState as pe, useEffect as
|
1
|
+
import ue, { useState as pe, useEffect as ye, useCallback as at, useRef as Fe } from "react";
|
2
2
|
const tl = {
|
3
3
|
xpertKey: "edx",
|
4
4
|
chatApiEndpoint: "https://xpert-platform-services-api.prod.ai.2u.com/xpert/chat",
|
@@ -386,7 +386,7 @@ function wn(e, t) {
|
|
386
386
|
var De = wn(ml, { path: "/" });
|
387
387
|
function yl(e) {
|
388
388
|
const [t, n] = pe(null);
|
389
|
-
return
|
389
|
+
return ye(() => {
|
390
390
|
console.log("Chatbot - optimizely mount");
|
391
391
|
try {
|
392
392
|
(() => {
|
@@ -423,7 +423,7 @@ const Ml = 576, xl = (e) => {
|
|
423
423
|
).matches
|
424
424
|
);
|
425
425
|
}, [e]);
|
426
|
-
return
|
426
|
+
return ye(() => (r(), window.addEventListener("resize", r), () => window.removeEventListener("resize", r)), [r]), t;
|
427
427
|
}, pt = xl, nt = /^[a-z0-9]+(-[a-z0-9]+)*$/, _t = (e, t, n, r = "") => {
|
428
428
|
const i = e.split(":");
|
429
429
|
if (e.slice(0, 1) === "@") {
|
@@ -1690,13 +1690,13 @@ const jr = {
|
|
1690
1690
|
function Vn(e) {
|
1691
1691
|
var l;
|
1692
1692
|
const [t, n] = pe(!0), r = t && (!(window != null && window.OnetrustActiveGroups) || ((l = window == null ? void 0 : window.OnetrustActiveGroups) == null ? void 0 : l.includes("C0003"))) && De.get(e.cookieName) === void 0;
|
1693
|
-
|
1693
|
+
ye(() => {
|
1694
1694
|
var a;
|
1695
1695
|
(a = window == null ? void 0 : window.OneTrust) == null || a.OnConsentChanged(() => {
|
1696
1696
|
var s;
|
1697
1697
|
!((s = window == null ? void 0 : window.OnetrustActiveGroups) != null && s.includes("C0003")) && De.get(e.cookieName) !== void 0 && De.remove(e.cookieName);
|
1698
1698
|
});
|
1699
|
-
}, [e.cookieName]),
|
1699
|
+
}, [e.cookieName]), ye(() => {
|
1700
1700
|
var a;
|
1701
1701
|
e.showMessage || (!(window != null && window.OnetrustActiveGroups) || (a = window == null ? void 0 : window.OnetrustActiveGroups) != null && a.includes("C0003")) && o(e.cookieName, 1, 1);
|
1702
1702
|
}, [e.showMessage, e.cookieName]);
|
@@ -2832,7 +2832,7 @@ const pu = /* @__PURE__ */ Ue(cu), fu = (e) => {
|
|
2832
2832
|
}, n = () => {
|
2833
2833
|
document.body.style.overflow = "unset";
|
2834
2834
|
};
|
2835
|
-
|
2835
|
+
ye(() => {
|
2836
2836
|
const r = e == null ? void 0 : e.current;
|
2837
2837
|
return r == null || r.addEventListener("mouseover", t), r == null || r.addEventListener("mouseout", n), () => {
|
2838
2838
|
n(), r == null || r.removeEventListener("mouseover", t), r == null || r.removeEventListener("mouseout", n);
|
@@ -2967,36 +2967,40 @@ lo.propTypes = {
|
|
2967
2967
|
function Qt({
|
2968
2968
|
loading: e,
|
2969
2969
|
inputRef: t,
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2970
|
+
hasError: n,
|
2971
|
+
userInput: r,
|
2972
|
+
handleSend: i,
|
2973
|
+
handleInput: o,
|
2974
|
+
handleChange: l,
|
2975
|
+
handleKeyDown: a,
|
2976
|
+
containerStyle: s,
|
2977
|
+
configurations: u
|
2977
2978
|
}) {
|
2978
|
-
return
|
2979
|
+
return ye(() => {
|
2980
|
+
var c;
|
2981
|
+
(c = t == null ? void 0 : t.current) == null || c.focus();
|
2982
|
+
}, [e, n, t]), /* @__PURE__ */ D.jsxs("div", { className: "xpert-chatbot-popup__input--group", style: s, children: [
|
2979
2983
|
/* @__PURE__ */ D.jsx(
|
2980
2984
|
"textarea",
|
2981
2985
|
{
|
2982
2986
|
disabled: e,
|
2983
|
-
value:
|
2987
|
+
value: r,
|
2984
2988
|
ref: t,
|
2985
|
-
onInput:
|
2986
|
-
onChange:
|
2989
|
+
onInput: o,
|
2990
|
+
onChange: l,
|
2987
2991
|
placeholder: "Write a message",
|
2988
2992
|
cols: "5",
|
2989
2993
|
rows: "1",
|
2990
2994
|
maxLength: "150",
|
2991
|
-
onKeyDown:
|
2995
|
+
onKeyDown: a,
|
2992
2996
|
style: {
|
2993
|
-
outlineColor:
|
2997
|
+
outlineColor: u.primaryColor,
|
2994
2998
|
width: "100%",
|
2995
2999
|
minHeight: "3.25rem",
|
2996
3000
|
borderRadius: "1rem",
|
2997
3001
|
padding: "12.5px 45px 12.5px 12.5px",
|
2998
3002
|
fontFamily: "inherit",
|
2999
|
-
fontSize: "
|
3003
|
+
fontSize: ".9rem",
|
3000
3004
|
fontWeight: "300",
|
3001
3005
|
lineHeight: "1.56rem",
|
3002
3006
|
boxSizing: "border-box",
|
@@ -3009,8 +3013,8 @@ function Qt({
|
|
3009
3013
|
{
|
3010
3014
|
disabled: e,
|
3011
3015
|
className: "xpert-chatbot-popup__input--send-btn",
|
3012
|
-
onClick: (
|
3013
|
-
|
3016
|
+
onClick: (c) => {
|
3017
|
+
c.preventDefault(), i(r);
|
3014
3018
|
},
|
3015
3019
|
"aria-label": "Send message",
|
3016
3020
|
children: /* @__PURE__ */ D.jsx(Ae, { icon: "material-symbols:send", style: { fontSize: "1.75rem" } })
|
@@ -3021,6 +3025,7 @@ function Qt({
|
|
3021
3025
|
Qt.propTypes = {
|
3022
3026
|
loading: g.bool.isRequired,
|
3023
3027
|
inputRef: g.shape({ current: g.instanceOf(Object) }).isRequired,
|
3028
|
+
hasError: g.bool.isRequired,
|
3024
3029
|
handleSend: g.func.isRequired,
|
3025
3030
|
userInput: g.string.isRequired,
|
3026
3031
|
handleInput: g.func.isRequired,
|
@@ -3154,7 +3159,7 @@ ao.propTypes = {
|
|
3154
3159
|
};
|
3155
3160
|
function uo({ disableScroll: e }) {
|
3156
3161
|
const t = Fe(null);
|
3157
|
-
return
|
3162
|
+
return ye(() => {
|
3158
3163
|
var n;
|
3159
3164
|
e || (n = t.current) == null || n.scrollIntoView({
|
3160
3165
|
behavior: "smooth",
|
@@ -3179,7 +3184,7 @@ uo.propTypes = {
|
|
3179
3184
|
};
|
3180
3185
|
const so = () => {
|
3181
3186
|
const e = Fe(null);
|
3182
|
-
return
|
3187
|
+
return ye(() => {
|
3183
3188
|
var t;
|
3184
3189
|
(t = e.current) == null || t.scrollIntoView({
|
3185
3190
|
behavior: "instant"
|
@@ -4020,7 +4025,7 @@ function ke(e, t, n, r) {
|
|
4020
4025
|
for (n && e.splice(t, n); o < r.length; )
|
4021
4026
|
l = r.slice(o, o + 1e4), l.unshift(t, 0), e.splice(...l), o += 1e4, t += 1e4;
|
4022
4027
|
}
|
4023
|
-
function
|
4028
|
+
function Me(e, t) {
|
4024
4029
|
return e.length > 0 ? (ke(e, e.length, 0, t), e) : t;
|
4025
4030
|
}
|
4026
4031
|
const Kr = {}.hasOwnProperty;
|
@@ -4317,27 +4322,27 @@ function ns(e, t) {
|
|
4317
4322
|
type: s > 1 ? "strong" : "emphasis",
|
4318
4323
|
start: Object.assign({}, l.start),
|
4319
4324
|
end: Object.assign({}, a.end)
|
4320
|
-
}, e[r][1].end = Object.assign({}, l.start), e[n][1].start = Object.assign({}, a.end), u = [], e[r][1].end.offset - e[r][1].start.offset && (u =
|
4325
|
+
}, e[r][1].end = Object.assign({}, l.start), e[n][1].start = Object.assign({}, a.end), u = [], e[r][1].end.offset - e[r][1].start.offset && (u = Me(u, [
|
4321
4326
|
["enter", e[r][1], t],
|
4322
4327
|
["exit", e[r][1], t]
|
4323
|
-
])), u =
|
4328
|
+
])), u = Me(u, [
|
4324
4329
|
["enter", i, t],
|
4325
4330
|
["enter", l, t],
|
4326
4331
|
["exit", l, t],
|
4327
4332
|
["enter", o, t]
|
4328
|
-
]), u =
|
4333
|
+
]), u = Me(
|
4329
4334
|
u,
|
4330
4335
|
Gn(
|
4331
4336
|
t.parser.constructs.insideSpan.null,
|
4332
4337
|
e.slice(r + 1, n),
|
4333
4338
|
t
|
4334
4339
|
)
|
4335
|
-
), u =
|
4340
|
+
), u = Me(u, [
|
4336
4341
|
["exit", o, t],
|
4337
4342
|
["enter", a, t],
|
4338
4343
|
["exit", a, t],
|
4339
4344
|
["exit", i, t]
|
4340
|
-
]), e[n][1].end.offset - e[n][1].start.offset ? (c = 2, u =
|
4345
|
+
]), e[n][1].end.offset - e[n][1].start.offset ? (c = 2, u = Me(u, [
|
4341
4346
|
["enter", e[n][1], t],
|
4342
4347
|
["exit", e[n][1], t]
|
4343
4348
|
])) : c = 0, ke(e, r - 1, n - r + 3, u), n = r + u.length - c - 2;
|
@@ -5355,19 +5360,19 @@ function Gs(e, t) {
|
|
5355
5360
|
return a = [
|
5356
5361
|
["enter", s, t],
|
5357
5362
|
["enter", u, t]
|
5358
|
-
], a =
|
5363
|
+
], a = Me(a, e.slice(o + 1, o + r + 3)), a = Me(a, [["enter", c, t]]), a = Me(
|
5359
5364
|
a,
|
5360
5365
|
Gn(
|
5361
5366
|
t.parser.constructs.insideSpan.null,
|
5362
5367
|
e.slice(o + r + 4, l - 3),
|
5363
5368
|
t
|
5364
5369
|
)
|
5365
|
-
), a =
|
5370
|
+
), a = Me(a, [
|
5366
5371
|
["exit", c, t],
|
5367
5372
|
e[l - 2],
|
5368
5373
|
e[l - 1],
|
5369
5374
|
["exit", u, t]
|
5370
|
-
]), a =
|
5375
|
+
]), a = Me(a, e.slice(l + 1)), a = Me(a, [["exit", s, t]]), ke(e, o, e.length, a), e;
|
5371
5376
|
}
|
5372
5377
|
function Xs(e, t, n) {
|
5373
5378
|
const r = this;
|
@@ -5878,7 +5883,7 @@ function Dc(e, t, n) {
|
|
5878
5883
|
let c = t.tokenize.call(u, s);
|
5879
5884
|
return t.resolveAll && o.push(t), u;
|
5880
5885
|
function p(E) {
|
5881
|
-
return l =
|
5886
|
+
return l = Me(l, E), S(), l[l.length - 1] !== null ? [] : (U(t, 0), u.events = Gn(o, u.events, u), u.events);
|
5882
5887
|
}
|
5883
5888
|
function m(E, M) {
|
5884
5889
|
return Tc(f(E), M);
|
@@ -9354,7 +9359,7 @@ const Of = pr, tn = ({
|
|
9354
9359
|
}) => {
|
9355
9360
|
var s;
|
9356
9361
|
const a = Fe(null);
|
9357
|
-
return
|
9362
|
+
return ye(() => {
|
9358
9363
|
var u;
|
9359
9364
|
(u = a.current) == null || u.scrollIntoView({
|
9360
9365
|
behavior: "instant",
|
@@ -9697,7 +9702,7 @@ function dr({
|
|
9697
9702
|
},
|
9698
9703
|
[n]
|
9699
9704
|
);
|
9700
|
-
|
9705
|
+
ye(() => {
|
9701
9706
|
const u = document.createElement("script");
|
9702
9707
|
u.type = "text/javascript", u.src = e.liveChatUrl, u.async = !0, u.onload = () => {
|
9703
9708
|
window.Five9ChatPlugin(e.liveChatOptions);
|
@@ -9860,12 +9865,12 @@ function el({ xpertKey: e, submitEventExternal: t, configurations: n }) {
|
|
9860
9865
|
_(!1);
|
9861
9866
|
}
|
9862
9867
|
}, [p, o]);
|
9863
|
-
|
9868
|
+
ye(() => (se(), document.addEventListener("visibilitychange", se), () => {
|
9864
9869
|
document.removeEventListener(
|
9865
9870
|
"visibilitychange",
|
9866
9871
|
se
|
9867
9872
|
);
|
9868
|
-
}), [se]),
|
9873
|
+
}), [se]), ye(() => {
|
9869
9874
|
console.log("Chatbot - mount");
|
9870
9875
|
let L, x;
|
9871
9876
|
return s && (L = setInterval(() => {
|
@@ -9876,7 +9881,7 @@ function el({ xpertKey: e, submitEventExternal: t, configurations: n }) {
|
|
9876
9881
|
}, 6e4)), () => {
|
9877
9882
|
console.log("Chatbot - unmount"), clearInterval(L), clearTimeout(x);
|
9878
9883
|
};
|
9879
|
-
}, [u, s]),
|
9884
|
+
}, [u, s]), ye(() => {
|
9880
9885
|
const L = (I) => {
|
9881
9886
|
var O, $;
|
9882
9887
|
(O = I == null ? void 0 : I.target) != null && O.href && W({
|