@2uinc/frontend-component-xpert-chatbot 1.3.10-beta.2 → 1.3.10-beta.3
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 +38 -41
- 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 Me, 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 Me(() => {
|
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 Me(() => (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
|
+
Me(() => {
|
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]), Me(() => {
|
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
|
+
Me(() => {
|
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,32 +2967,30 @@ lo.propTypes = {
|
|
2967
2967
|
function Qt({
|
2968
2968
|
loading: e,
|
2969
2969
|
inputRef: t,
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
configurations: u
|
2970
|
+
userInput: n,
|
2971
|
+
handleSend: r,
|
2972
|
+
handleInput: i,
|
2973
|
+
handleChange: o,
|
2974
|
+
handleKeyDown: l,
|
2975
|
+
containerStyle: a,
|
2976
|
+
configurations: s
|
2978
2977
|
}) {
|
2979
|
-
return
|
2980
|
-
}, [e, n, t]), /* @__PURE__ */ D.jsxs("div", { className: "xpert-chatbot-popup__input--group", style: s, children: [
|
2978
|
+
return /* @__PURE__ */ D.jsxs("div", { className: "xpert-chatbot-popup__input--group", style: a, children: [
|
2981
2979
|
/* @__PURE__ */ D.jsx(
|
2982
2980
|
"textarea",
|
2983
2981
|
{
|
2984
2982
|
disabled: e,
|
2985
|
-
value:
|
2983
|
+
value: n,
|
2986
2984
|
ref: t,
|
2987
|
-
onInput:
|
2988
|
-
onChange:
|
2985
|
+
onInput: i,
|
2986
|
+
onChange: o,
|
2989
2987
|
placeholder: "Write a message",
|
2990
2988
|
cols: "5",
|
2991
2989
|
rows: "1",
|
2992
2990
|
maxLength: "150",
|
2993
|
-
onKeyDown:
|
2991
|
+
onKeyDown: l,
|
2994
2992
|
style: {
|
2995
|
-
outlineColor:
|
2993
|
+
outlineColor: s.primaryColor,
|
2996
2994
|
width: "100%",
|
2997
2995
|
minHeight: "3.25rem",
|
2998
2996
|
borderRadius: "1rem",
|
@@ -3011,8 +3009,8 @@ function Qt({
|
|
3011
3009
|
{
|
3012
3010
|
disabled: e,
|
3013
3011
|
className: "xpert-chatbot-popup__input--send-btn",
|
3014
|
-
onClick: (
|
3015
|
-
|
3012
|
+
onClick: (u) => {
|
3013
|
+
u.preventDefault(), r(n);
|
3016
3014
|
},
|
3017
3015
|
"aria-label": "Send message",
|
3018
3016
|
children: /* @__PURE__ */ D.jsx(Ae, { icon: "material-symbols:send", style: { fontSize: "1.75rem" } })
|
@@ -3023,7 +3021,6 @@ function Qt({
|
|
3023
3021
|
Qt.propTypes = {
|
3024
3022
|
loading: g.bool.isRequired,
|
3025
3023
|
inputRef: g.shape({ current: g.instanceOf(Object) }).isRequired,
|
3026
|
-
hasError: g.bool.isRequired,
|
3027
3024
|
handleSend: g.func.isRequired,
|
3028
3025
|
userInput: g.string.isRequired,
|
3029
3026
|
handleInput: g.func.isRequired,
|
@@ -3157,7 +3154,7 @@ ao.propTypes = {
|
|
3157
3154
|
};
|
3158
3155
|
function uo({ disableScroll: e }) {
|
3159
3156
|
const t = Fe(null);
|
3160
|
-
return
|
3157
|
+
return Me(() => {
|
3161
3158
|
var n;
|
3162
3159
|
e || (n = t.current) == null || n.scrollIntoView({
|
3163
3160
|
behavior: "smooth",
|
@@ -3182,7 +3179,7 @@ uo.propTypes = {
|
|
3182
3179
|
};
|
3183
3180
|
const so = () => {
|
3184
3181
|
const e = Fe(null);
|
3185
|
-
return
|
3182
|
+
return Me(() => {
|
3186
3183
|
var t;
|
3187
3184
|
(t = e.current) == null || t.scrollIntoView({
|
3188
3185
|
behavior: "instant"
|
@@ -4023,7 +4020,7 @@ function ke(e, t, n, r) {
|
|
4023
4020
|
for (n && e.splice(t, n); o < r.length; )
|
4024
4021
|
l = r.slice(o, o + 1e4), l.unshift(t, 0), e.splice(...l), o += 1e4, t += 1e4;
|
4025
4022
|
}
|
4026
|
-
function
|
4023
|
+
function ye(e, t) {
|
4027
4024
|
return e.length > 0 ? (ke(e, e.length, 0, t), e) : t;
|
4028
4025
|
}
|
4029
4026
|
const Kr = {}.hasOwnProperty;
|
@@ -4320,27 +4317,27 @@ function ns(e, t) {
|
|
4320
4317
|
type: s > 1 ? "strong" : "emphasis",
|
4321
4318
|
start: Object.assign({}, l.start),
|
4322
4319
|
end: Object.assign({}, a.end)
|
4323
|
-
}, 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 =
|
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 = ye(u, [
|
4324
4321
|
["enter", e[r][1], t],
|
4325
4322
|
["exit", e[r][1], t]
|
4326
|
-
])), u =
|
4323
|
+
])), u = ye(u, [
|
4327
4324
|
["enter", i, t],
|
4328
4325
|
["enter", l, t],
|
4329
4326
|
["exit", l, t],
|
4330
4327
|
["enter", o, t]
|
4331
|
-
]), u =
|
4328
|
+
]), u = ye(
|
4332
4329
|
u,
|
4333
4330
|
Gn(
|
4334
4331
|
t.parser.constructs.insideSpan.null,
|
4335
4332
|
e.slice(r + 1, n),
|
4336
4333
|
t
|
4337
4334
|
)
|
4338
|
-
), u =
|
4335
|
+
), u = ye(u, [
|
4339
4336
|
["exit", o, t],
|
4340
4337
|
["enter", a, t],
|
4341
4338
|
["exit", a, t],
|
4342
4339
|
["exit", i, t]
|
4343
|
-
]), e[n][1].end.offset - e[n][1].start.offset ? (c = 2, u =
|
4340
|
+
]), e[n][1].end.offset - e[n][1].start.offset ? (c = 2, u = ye(u, [
|
4344
4341
|
["enter", e[n][1], t],
|
4345
4342
|
["exit", e[n][1], t]
|
4346
4343
|
])) : c = 0, ke(e, r - 1, n - r + 3, u), n = r + u.length - c - 2;
|
@@ -5358,19 +5355,19 @@ function Gs(e, t) {
|
|
5358
5355
|
return a = [
|
5359
5356
|
["enter", s, t],
|
5360
5357
|
["enter", u, t]
|
5361
|
-
], a =
|
5358
|
+
], a = ye(a, e.slice(o + 1, o + r + 3)), a = ye(a, [["enter", c, t]]), a = ye(
|
5362
5359
|
a,
|
5363
5360
|
Gn(
|
5364
5361
|
t.parser.constructs.insideSpan.null,
|
5365
5362
|
e.slice(o + r + 4, l - 3),
|
5366
5363
|
t
|
5367
5364
|
)
|
5368
|
-
), a =
|
5365
|
+
), a = ye(a, [
|
5369
5366
|
["exit", c, t],
|
5370
5367
|
e[l - 2],
|
5371
5368
|
e[l - 1],
|
5372
5369
|
["exit", u, t]
|
5373
|
-
]), a =
|
5370
|
+
]), a = ye(a, e.slice(l + 1)), a = ye(a, [["exit", s, t]]), ke(e, o, e.length, a), e;
|
5374
5371
|
}
|
5375
5372
|
function Xs(e, t, n) {
|
5376
5373
|
const r = this;
|
@@ -5881,7 +5878,7 @@ function Dc(e, t, n) {
|
|
5881
5878
|
let c = t.tokenize.call(u, s);
|
5882
5879
|
return t.resolveAll && o.push(t), u;
|
5883
5880
|
function p(E) {
|
5884
|
-
return l =
|
5881
|
+
return l = ye(l, E), S(), l[l.length - 1] !== null ? [] : (U(t, 0), u.events = Gn(o, u.events, u), u.events);
|
5885
5882
|
}
|
5886
5883
|
function m(E, M) {
|
5887
5884
|
return Tc(f(E), M);
|
@@ -9357,7 +9354,7 @@ const Of = pr, tn = ({
|
|
9357
9354
|
}) => {
|
9358
9355
|
var s;
|
9359
9356
|
const a = Fe(null);
|
9360
|
-
return
|
9357
|
+
return Me(() => {
|
9361
9358
|
var u;
|
9362
9359
|
(u = a.current) == null || u.scrollIntoView({
|
9363
9360
|
behavior: "instant",
|
@@ -9700,7 +9697,7 @@ function dr({
|
|
9700
9697
|
},
|
9701
9698
|
[n]
|
9702
9699
|
);
|
9703
|
-
|
9700
|
+
Me(() => {
|
9704
9701
|
const u = document.createElement("script");
|
9705
9702
|
u.type = "text/javascript", u.src = e.liveChatUrl, u.async = !0, u.onload = () => {
|
9706
9703
|
window.Five9ChatPlugin(e.liveChatOptions);
|
@@ -9863,12 +9860,12 @@ function el({ xpertKey: e, submitEventExternal: t, configurations: n }) {
|
|
9863
9860
|
_(!1);
|
9864
9861
|
}
|
9865
9862
|
}, [p, o]);
|
9866
|
-
|
9863
|
+
Me(() => (se(), document.addEventListener("visibilitychange", se), () => {
|
9867
9864
|
document.removeEventListener(
|
9868
9865
|
"visibilitychange",
|
9869
9866
|
se
|
9870
9867
|
);
|
9871
|
-
}), [se]),
|
9868
|
+
}), [se]), Me(() => {
|
9872
9869
|
console.log("Chatbot - mount");
|
9873
9870
|
let L, x;
|
9874
9871
|
return s && (L = setInterval(() => {
|
@@ -9879,7 +9876,7 @@ function el({ xpertKey: e, submitEventExternal: t, configurations: n }) {
|
|
9879
9876
|
}, 6e4)), () => {
|
9880
9877
|
console.log("Chatbot - unmount"), clearInterval(L), clearTimeout(x);
|
9881
9878
|
};
|
9882
|
-
}, [u, s]),
|
9879
|
+
}, [u, s]), Me(() => {
|
9883
9880
|
const L = (I) => {
|
9884
9881
|
var O, $;
|
9885
9882
|
(O = I == null ? void 0 : I.target) != null && O.href && W({
|