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