@2uinc/frontend-component-xpert-chatbot 1.40.28 → 1.40.29-alpha.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.
Files changed (2) hide show
  1. package/dist/lib/index.min.js +150 -142
  2. package/package.json +1 -1
@@ -33604,13 +33604,21 @@ const VE = (e) => ({
33604
33604
  }
33605
33605
  if (typeof e == "string") return e.trim() || void 0;
33606
33606
  }, WE = (e) => {
33607
- const n = new DOMParser().parseFromString(e, "text/html");
33608
- let r = 1;
33609
- const a = (i) => {
33610
- i.tagName === "DOCUMENT-SOURCE" && i.setAttribute("data-index", r++), Array.from(i.children).forEach(a);
33607
+ if (typeof e != "string")
33608
+ return "";
33609
+ const t = e.replace(/<!doctype[^>]*>/gi, "").replace(/<\/?(html|head|body)\b[^>]*>/gi, "").replace(/<\/?(script|style|noscript)\b[^>]*>/gi, ""), n = new DOMParser();
33610
+ let r;
33611
+ try {
33612
+ r = n.parseFromString(t, "text/html");
33613
+ } catch {
33614
+ return t;
33615
+ }
33616
+ let a = 1;
33617
+ const i = (s) => {
33618
+ s.tagName === "DOCUMENT-SOURCE" && s.setAttribute("data-index", a++), Array.from(s.children).forEach(i);
33611
33619
  };
33612
- return Array.from(n.body.children).forEach(a), n.body.innerHTML;
33613
- }, XE = "Sure, I can get you to someone who can help.", KE = (e, t) => ({
33620
+ return Array.from(r.body.children).forEach(i), r.body.innerHTML;
33621
+ }, XE = (e = "") => typeof e != "string" ? !1 : /<!doctype|<\/?(?:html|head|body)\b/i.test(e), KE = "Sure, I can get you to someone who can help.", QE = (e, t) => ({
33614
33622
  agent: {
33615
33623
  bubbleClassName: "xpert-chatbot-popup__bubble--assistant",
33616
33624
  bubbleStyle: {},
@@ -33638,7 +33646,7 @@ const VE = (e) => ({
33638
33646
  innerStyle: { justifyContent: "flex-end" },
33639
33647
  sectionAriaLabel: "The user said"
33640
33648
  }
33641
- }), QE = (e, t) => {
33649
+ }), ZE = (e, t) => {
33642
33650
  if (!e) return e;
33643
33651
  try {
33644
33652
  const n = new URL(e, window.location.origin);
@@ -33646,10 +33654,10 @@ const VE = (e) => ({
33646
33654
  } catch {
33647
33655
  return e;
33648
33656
  }
33649
- }, Bu = (e) => Array.isArray(e) ? e.some(Bu) : Uo(e) ? e.type === "img" || e.type === Pl ? !0 : Bu(e.props?.children) : !1, np = (e) => e ? e.tagName === "img" ? !0 : (e.children ?? []).some(np) : !1, ZE = (e, t, n, r) => ({
33657
+ }, Bu = (e) => Array.isArray(e) ? e.some(Bu) : Uo(e) ? e.type === "img" || e.type === Pl ? !0 : Bu(e.props?.children) : !1, np = (e) => e ? e.tagName === "img" ? !0 : (e.children ?? []).some(np) : !1, JE = (e, t, n, r) => ({
33650
33658
  img: ({ src: a, alt: i }) => /* @__PURE__ */ S.jsx(O2, { fallback: /* @__PURE__ */ S.jsx("div", { children: "Loading image..." }), children: /* @__PURE__ */ S.jsx(Pl, { src: a, alt: i }) }),
33651
33659
  a: ({ children: a, href: i, ...s }) => {
33652
- const o = r ? QE(i, n) : i, u = (l) => {
33660
+ const o = r ? ZE(i, n) : i, u = (l) => {
33653
33661
  const c = l?.type === "keydown", h = typeof l?.button != "number" || l.button === 0;
33654
33662
  if (!(!c && !h) && (l?.preventDefault?.(), l?.currentTarget?.dataset && (l.currentTarget.dataset.xpertLinkOpened = "1"), e?.(l, o), o))
33655
33663
  try {
@@ -33720,7 +33728,7 @@ const VE = (e) => ({
33720
33728
  role: E = Ne.ASSISTANT,
33721
33729
  timestamp: v
33722
33730
  } = t ?? {}, I = Je(null), [B, Y] = Ee(!1), F = E === Ne.TOOL ? Ne.ASSISTANT : E, A = b || u === y1.ESCALATE_TO_AN_AGENT, z = !A && !!m, K = r && z && [Ne.AGENT, Ne.ASSISTANT].includes(F), J = r && z && F === Ne.USER, ne = Gt(
33723
- () => KE(
33731
+ () => QE(
33724
33732
  l,
33725
33733
  c?.userMessageBubble?.style
33726
33734
  ),
@@ -33751,20 +33759,20 @@ const VE = (e) => ({
33751
33759
  if (!z) return null;
33752
33760
  if (F === Ne.USER)
33753
33761
  return q;
33754
- const te = WE(q), N = F === Ne.AGENT || F === Ne.ASSISTANT;
33762
+ const te = WE(q), N = !XE(q), O = F === Ne.AGENT || F === Ne.ASSISTANT;
33755
33763
  return /* @__PURE__ */ S.jsx(
33756
33764
  rl,
33757
33765
  {
33758
- components: ZE(
33766
+ components: JE(
33759
33767
  i,
33760
33768
  ne[F].bubbleStyle,
33761
33769
  h,
33762
- N
33770
+ O
33763
33771
  ),
33764
33772
  linkTarget: "_blank",
33765
33773
  remarkPlugins: [[_E, {}]],
33766
33774
  rehypePlugins: [
33767
- Uv,
33775
+ ...N ? [Uv] : [],
33768
33776
  [
33769
33777
  hE,
33770
33778
  {
@@ -33830,7 +33838,7 @@ const VE = (e) => ({
33830
33838
  children: [
33831
33839
  /* @__PURE__ */ S.jsx("div", { ref: I, children: Q }),
33832
33840
  A && /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
33833
- /* @__PURE__ */ S.jsx("div", { children: XE }),
33841
+ /* @__PURE__ */ S.jsx("div", { children: KE }),
33834
33842
  /* @__PURE__ */ S.jsx(
33835
33843
  Dl,
33836
33844
  {
@@ -34133,12 +34141,12 @@ si.defaultProps = {
34133
34141
  loadingHistory: !1
34134
34142
  };
34135
34143
  si.displayName = "ConversationMessages";
34136
- const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect-form-plugin.2u.com/cask-latest/lead.form.plugin.js?ver=1.0", tx = "https://onlinelaw.wcl.american.edu/wp-content/themes/twoyou/dist/static/scripts/taxi.js?m=1776347786j", nx = "https://tmq.prod.2u.com/v1/tmq", rx = "mls_base_page", ax = "Get Admissions and Tuition Information", ix = "#005099", sx = "Answer a few quick questions to determine if program is a good fit for you.", ox = "No GRE or LSAT Scores Required.", ux = "Taxi form configuration is missing required values", lx = {
34144
+ const ex = "https://code.jquery.com/jquery-3.7.1.min.js", tx = "https://prospect-form-plugin.2u.com/cask-latest/lead.form.plugin.js?ver=1.0", nx = "https://onlinelaw.wcl.american.edu/wp-content/themes/twoyou/dist/static/scripts/taxi.js?m=1776347786j", rx = "https://tmq.prod.2u.com/v1/tmq", ax = "mls_base_page", ix = "Get Admissions and Tuition Information", sx = "#005099", ox = "Answer a few quick questions to determine if program is a good fit for you.", ux = "No GRE or LSAT Scores Required.", lx = "Taxi form configuration is missing required values", cx = {
34137
34145
  loading: "Loading..."
34138
- }, cx = [
34146
+ }, dx = [
34139
34147
  "https://whitelabel.2u.com/cdn/v1/d52ded4d-f92c-43a8-985b-4b0724be74b2/marketing/whitelabel.fonts.min.css?ver=1.0",
34140
34148
  "https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap"
34141
- ], dx = {
34149
+ ], hx = {
34142
34150
  "--var-color-theme-dark": "#0f2846",
34143
34151
  "--var-color-theme-light": "#c4122e",
34144
34152
  "--var-color-theme-cta": "#005099",
@@ -34154,7 +34162,7 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34154
34162
  "--var-paragraph-font-family": "Source Serif Pro",
34155
34163
  "--var-h3-font-size": "28px",
34156
34164
  "--var-h3-font-family": "GT Walsheim"
34157
- }, hx = (e) => {
34165
+ }, fx = (e) => {
34158
34166
  if (typeof document > "u" || document.querySelector(`link[href="${e}"]`)) return;
34159
34167
  const t = document.createElement("link");
34160
34168
  t.rel = "stylesheet", t.href = e, t.dataset.xpertTaxiAsset = "true", document.head.appendChild(t);
@@ -34171,10 +34179,10 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34171
34179
  a.dataset.loaded = "true", n(a);
34172
34180
  }), a.addEventListener("error", r, { once: !0 }), document.body.appendChild(a);
34173
34181
  });
34174
- }, zd = (e) => e instanceof Error ? e.message : "Unknown Taxi form error", fx = (e) => !e || typeof e != "object" ? null : e, mx = (e) => `${e}-taxi-lead-form-template`, px = ({ formId: e, prospectFormGrouping: t }) => `${t}-${e}`, gx = ({ formId: e, prospectFormGrouping: t }) => `https://prospect-form-packages.2u.com/${t}/${e}-multi.json`, bx = ({ clientId: e, taxiPackageKey: t }) => ({
34182
+ }, zd = (e) => e instanceof Error ? e.message : "Unknown Taxi form error", mx = (e) => !e || typeof e != "object" ? null : e, px = (e) => `${e}-taxi-lead-form-template`, gx = ({ formId: e, prospectFormGrouping: t }) => `${t}-${e}`, bx = ({ formId: e, prospectFormGrouping: t }) => `https://prospect-form-packages.2u.com/${t}/${e}-multi.json`, yx = ({ clientId: e, taxiPackageKey: t }) => ({
34175
34183
  short: `${t}-hp-taxi-lead-form-package-${e}`,
34176
34184
  full: `${t}-full-taxi-lead-form-package-${e}`
34177
- }), yx = ({ clientId: e, taxiPackageKey: t }) => `${window.mkTaxiPackageId(!1, t)}-${e}`, vx = ({ formId: e, prospectFormGrouping: t }) => ({
34185
+ }), vx = ({ clientId: e, taxiPackageKey: t }) => `${window.mkTaxiPackageId(!1, t)}-${e}`, Tx = ({ formId: e, prospectFormGrouping: t }) => ({
34178
34186
  formId: `form-id-${e}`,
34179
34187
  prospectFormGrouping: t,
34180
34188
  thankYouURL: {
@@ -34183,10 +34191,10 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34183
34191
  },
34184
34192
  splashCreative: {
34185
34193
  valid: !0,
34186
- value: rx
34194
+ value: ax
34187
34195
  },
34188
34196
  env: "prod"
34189
- }), Tx = ({
34197
+ }), Ex = ({
34190
34198
  clientId: e,
34191
34199
  resolvedMountPointId: t,
34192
34200
  taxiPackageKey: n,
@@ -34195,13 +34203,13 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34195
34203
  idPrefix: e,
34196
34204
  mountPoint: t,
34197
34205
  template: r,
34198
- packageFrom: yx({ clientId: e, taxiPackageKey: n })
34199
- }), Ex = async (e) => {
34200
- await Lo(JE);
34206
+ packageFrom: vx({ clientId: e, taxiPackageKey: n })
34207
+ }), xx = async (e) => {
34208
+ await Lo(ex);
34201
34209
  const [t] = await Promise.all([
34202
34210
  fetch(e),
34203
- Lo(ex),
34204
- Lo(tx)
34211
+ Lo(tx),
34212
+ Lo(nx)
34205
34213
  ]);
34206
34214
  if (!t.ok)
34207
34215
  throw new Error(`Taxi package request failed with ${t.status}`);
@@ -34210,7 +34218,7 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34210
34218
  short: n[0],
34211
34219
  full: n[1]
34212
34220
  };
34213
- }, xx = (e, t) => e === "error" ? `Taxi form failed to load: ${t}` : lx[e] ?? null, jd = (e) => typeof e != "string" ? !1 : e.includes(nx), qd = (e) => {
34221
+ }, Sx = (e, t) => e === "error" ? `Taxi form failed to load: ${t}` : cx[e] ?? null, jd = (e) => typeof e != "string" ? !1 : e.includes(rx), qd = (e) => {
34214
34222
  if (typeof e == "string") return e;
34215
34223
  if (e == null) return "";
34216
34224
  try {
@@ -34251,11 +34259,11 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34251
34259
  {
34252
34260
  id: `${e}-title`,
34253
34261
  className: "h3",
34254
- style: { color: ix },
34255
- children: ax
34262
+ style: { color: sx },
34263
+ children: ix
34256
34264
  }
34257
34265
  ),
34258
- /* @__PURE__ */ S.jsx("p", { id: `${e}-intro_text`, className: "u--margin-bottom-2", children: sx })
34266
+ /* @__PURE__ */ S.jsx("p", { id: `${e}-intro_text`, className: "u--margin-bottom-2", children: ox })
34259
34267
  ] }),
34260
34268
  /* @__PURE__ */ S.jsx("div", { id: `${e}-lead-form-progress-bar-mount-point` })
34261
34269
  ] }),
@@ -34273,7 +34281,7 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34273
34281
  ),
34274
34282
  /* @__PURE__ */ S.jsx("div", { id: `${e}-lead-form-footer-mount-point` })
34275
34283
  ] }),
34276
- /* @__PURE__ */ S.jsx("p", { className: "taxi-form---footer-text", children: ox })
34284
+ /* @__PURE__ */ S.jsx("p", { className: "taxi-form---footer-text", children: ux })
34277
34285
  ]
34278
34286
  }
34279
34287
  )
@@ -34285,26 +34293,26 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34285
34293
  onSubmitted: r = null,
34286
34294
  taxiForm: a = null
34287
34295
  }) => {
34288
- const i = fx(a), s = i?.clientId ?? null, o = i?.prospectFormGrouping ?? null, u = i?.formId ?? null, l = !!(s && o && u), c = s ?? "unconfigured-client", h = l ? px({ formId: u, prospectFormGrouping: o }) : null, p = l ? gx({ formId: u, prospectFormGrouping: o }) : null, [m, y] = Ee("idle"), [b, E] = Ee(null), [v, I] = Ee(null), B = Je(null), Y = Je(!1), F = e ?? `form-id-${c}`, A = h ? bx({ clientId: c, taxiPackageKey: h }) : {
34296
+ const i = mx(a), s = i?.clientId ?? null, o = i?.prospectFormGrouping ?? null, u = i?.formId ?? null, l = !!(s && o && u), c = s ?? "unconfigured-client", h = l ? gx({ formId: u, prospectFormGrouping: o }) : null, p = l ? bx({ formId: u, prospectFormGrouping: o }) : null, [m, y] = Ee("idle"), [b, E] = Ee(null), [v, I] = Ee(null), B = Je(null), Y = Je(!1), F = e ?? `form-id-${c}`, A = h ? yx({ clientId: c, taxiPackageKey: h }) : {
34289
34297
  short: `taxi-form-missing-short-package-${c}`,
34290
34298
  full: `taxi-form-missing-full-package-${c}`
34291
- }, z = mx(c), K = xx(m, b), J = Je(!1), ne = Je(!1), q = Wt(() => {
34299
+ }, z = px(c), K = Sx(m, b), J = Je(!1), ne = Je(!1), q = Wt(() => {
34292
34300
  ne.current || J.current || (J.current = !0, n?.());
34293
34301
  }, [n]), Q = Wt(() => {
34294
34302
  ne.current || (ne.current = !0, J.current = !1, r?.());
34295
34303
  }, [r]);
34296
34304
  return _e(() => {
34297
- cx.forEach(hx);
34305
+ dx.forEach(fx);
34298
34306
  }, []), _e(() => {
34299
34307
  let N = !1;
34300
34308
  return (async () => {
34301
34309
  if (!l || !p) {
34302
- E(ux), y("error");
34310
+ E(lx), y("error");
34303
34311
  return;
34304
34312
  }
34305
34313
  try {
34306
34314
  y("loading"), E(null);
34307
- const H = await Ex(p);
34315
+ const H = await xx(p);
34308
34316
  if (N) return;
34309
34317
  I(H);
34310
34318
  } catch (H) {
@@ -34359,8 +34367,8 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34359
34367
  childList: !0,
34360
34368
  subtree: !0
34361
34369
  }), Y.current = !0, window.setupTaxiForm(
34362
- vx({ formId: u, prospectFormGrouping: o }),
34363
- Tx({
34370
+ Tx({ formId: u, prospectFormGrouping: o }),
34371
+ Ex({
34364
34372
  clientId: c,
34365
34373
  resolvedMountPointId: F,
34366
34374
  taxiPackageKey: h,
@@ -34404,7 +34412,7 @@ const JE = "https://code.jquery.com/jquery-3.7.1.min.js", ex = "https://prospect
34404
34412
  "div",
34405
34413
  {
34406
34414
  className: "xpert-taxi-form__canvas hero-plp-form",
34407
- style: dx,
34415
+ style: hx,
34408
34416
  children: /* @__PURE__ */ S.jsx("div", { className: "container leadFormWrapper leadFormWrapper--plp", children: /* @__PURE__ */ S.jsx("div", { className: "leadform", children: /* @__PURE__ */ S.jsxs(
34409
34417
  "div",
34410
34418
  {
@@ -34564,37 +34572,37 @@ up.propTypes = {
34564
34572
  color: T.string
34565
34573
  }).isRequired
34566
34574
  };
34567
- const lp = "xpert_lead_capture_state", Sx = 3600 * 24 * 30, Cx = (e) => {
34575
+ const lp = "xpert_lead_capture_state", Cx = 3600 * 24 * 30, wx = (e) => {
34568
34576
  if (typeof document > "u") return null;
34569
34577
  const t = document.cookie ? document.cookie.split("; ") : [], n = `${e}=`, r = t.find((a) => a.startsWith(n));
34570
34578
  return r ? r.slice(n.length) : null;
34571
- }, wx = () => {
34572
- const e = Cx(lp);
34579
+ }, Ax = () => {
34580
+ const e = wx(lp);
34573
34581
  if (!e) return null;
34574
34582
  try {
34575
34583
  return JSON.parse(decodeURIComponent(e));
34576
34584
  } catch {
34577
34585
  return null;
34578
34586
  }
34579
- }, Ax = (e) => {
34587
+ }, _x = (e) => {
34580
34588
  typeof document > "u" || (document.cookie = `${lp}=${encodeURIComponent(
34581
34589
  JSON.stringify(e)
34582
- )}; path=/; max-age=${Sx}; SameSite=Lax`);
34583
- }, _x = ({
34590
+ )}; path=/; max-age=${Cx}; SameSite=Lax`);
34591
+ }, kx = ({
34584
34592
  clientId: e,
34585
34593
  started: t,
34586
34594
  submitted: n,
34587
34595
  insertIndex: r = null
34588
34596
  }) => {
34589
- Ax({
34597
+ _x({
34590
34598
  clientId: e,
34591
34599
  started: t,
34592
34600
  submitted: n,
34593
34601
  insertIndex: r,
34594
34602
  updatedAt: Date.now()
34595
34603
  });
34596
- }, kx = ({ clientId: e, messageCount: t }) => {
34597
- const n = wx();
34604
+ }, Ix = ({ clientId: e, messageCount: t }) => {
34605
+ const n = Ax();
34598
34606
  if (!n)
34599
34607
  return { shouldRestore: !1, insertIndex: t };
34600
34608
  if (!((!n.clientId || n.clientId === e) && n.started && !n.submitted))
@@ -34610,7 +34618,7 @@ const lp = "xpert_lead_capture_state", Sx = 3600 * 24 * 30, Cx = (e) => {
34610
34618
  nextStepButtonBackgroundColor: "#000000",
34611
34619
  tooltipBackgroundColor: "#F5F5F5",
34612
34620
  tooltipTextColor: "#374151"
34613
- }, Ix = ({
34621
+ }, Nx = ({
34614
34622
  clientId: e,
34615
34623
  conversationScreen: t,
34616
34624
  isSurveyOverlayActive: n,
@@ -34643,7 +34651,7 @@ const lp = "xpert_lead_capture_state", Sx = 3600 * 24 * 30, Cx = (e) => {
34643
34651
  submitted: q,
34644
34652
  insertIndex: Q = null
34645
34653
  }) => {
34646
- _x({
34654
+ kx({
34647
34655
  clientId: e,
34648
34656
  started: ne,
34649
34657
  submitted: q,
@@ -34693,7 +34701,7 @@ const lp = "xpert_lead_capture_state", Sx = 3600 * 24 * 30, Cx = (e) => {
34693
34701
  };
34694
34702
  }, [y, h?.tooltipText]), _e(() => {
34695
34703
  if (!m || !y) return;
34696
- const { shouldRestore: ne, insertIndex: q } = kx({
34704
+ const { shouldRestore: ne, insertIndex: q } = Ix({
34697
34705
  clientId: e,
34698
34706
  messageCount: r
34699
34707
  });
@@ -34840,8 +34848,8 @@ dp.propTypes = {
34840
34848
  }).isRequired,
34841
34849
  messages: T.array.isRequired
34842
34850
  };
34843
- const Nx = 100, Vd = { id: "skip", label: "Skip" };
34844
- function Ox(e) {
34851
+ const Ox = 100, Vd = { id: "skip", label: "Skip" };
34852
+ function Lx(e) {
34845
34853
  const t = e.match(/\S+\s*/g);
34846
34854
  return t?.length ? t : [e];
34847
34855
  }
@@ -34863,7 +34871,7 @@ function ks({
34863
34871
  onSelect: y
34864
34872
  }) {
34865
34873
  const b = m === "text", E = m === "ranking", v = !!h?.trim(), I = v ? `${c} - ${h}` : c, B = Gt(
34866
- () => Ox(I),
34874
+ () => Lx(I),
34867
34875
  [I]
34868
34876
  ), [Y, F] = Ee({
34869
34877
  prompt: I,
@@ -34878,7 +34886,7 @@ function ks({
34878
34886
  prompt: I,
34879
34887
  visibleTokenCount: W
34880
34888
  }), W >= B.length && window.clearInterval(w);
34881
- }, Nx);
34889
+ }, Ox);
34882
34890
  return () => {
34883
34891
  window.clearInterval(w);
34884
34892
  };
@@ -35092,8 +35100,8 @@ ks.defaultProps = {
35092
35100
  type: void 0
35093
35101
  };
35094
35102
  ks.displayName = "SurveyQuestionCard";
35095
- const Lx = 100, Rx = "You have selected the End-of-Term Survey. This is a brief, voluntary survey to help us improve Xpert.";
35096
- function Dx(e) {
35103
+ const Rx = 100, Dx = "You have selected the End-of-Term Survey. This is a brief, voluntary survey to help us improve Xpert.";
35104
+ function Mx(e) {
35097
35105
  const t = e ?? "", n = t.match(/\S+\s*/g);
35098
35106
  return n?.length ? n : [t];
35099
35107
  }
@@ -35120,8 +35128,8 @@ function Ul({
35120
35128
  surveyStepIndex: B,
35121
35129
  triggerSurveyPrompt: Y
35122
35130
  }) {
35123
- const F = h ?? Rx, A = Gt(
35124
- () => Dx(F),
35131
+ const F = h ?? Dx, A = Gt(
35132
+ () => Mx(F),
35125
35133
  [F]
35126
35134
  ), [z, K] = Ee({
35127
35135
  streamKey: null,
@@ -35136,7 +35144,7 @@ function Ul({
35136
35144
  streamKey: N,
35137
35145
  visibleTokenCount: te
35138
35146
  }), te >= A.length && window.clearInterval(O);
35139
- }, Lx);
35147
+ }, Rx);
35140
35148
  return () => {
35141
35149
  window.clearInterval(O);
35142
35150
  };
@@ -35417,7 +35425,7 @@ Is.defaultProps = {
35417
35425
  totalSteps: 1
35418
35426
  };
35419
35427
  Is.displayName = "SurveyModeBanner";
35420
- function Mx({
35428
+ function Px({
35421
35429
  chatContentRef: e,
35422
35430
  isSurveyMode: t,
35423
35431
  messageCount: n,
@@ -35448,7 +35456,7 @@ function hp(e, t, n = 0) {
35448
35456
  function Ns(e) {
35449
35457
  return typeof e != "string" ? null : e.trim() || null;
35450
35458
  }
35451
- function Px(e) {
35459
+ function Bx(e) {
35452
35460
  if (!e || typeof e != "object")
35453
35461
  return null;
35454
35462
  const t = Ns(e.id), n = `${e.label ?? ""}`.trim();
@@ -35458,7 +35466,7 @@ function Px(e) {
35458
35466
  label: n
35459
35467
  };
35460
35468
  }
35461
- function Bx(e) {
35469
+ function Fx(e) {
35462
35470
  if (!e || typeof e != "object")
35463
35471
  return null;
35464
35472
  const t = Ns(e.id), n = `${e.label ?? ""}`.trim();
@@ -35467,7 +35475,7 @@ function Bx(e) {
35467
35475
  label: n
35468
35476
  };
35469
35477
  }
35470
- function Fx(e, t) {
35478
+ function Hx(e, t) {
35471
35479
  if (!e || typeof e != "object")
35472
35480
  return [];
35473
35481
  const n = Ns(e.id), a = `${e.label ?? ""}`.trim() || (n ? `Question ${n}` : "");
@@ -35477,9 +35485,9 @@ function Fx(e, t) {
35477
35485
  e.id ?? a,
35478
35486
  "question",
35479
35487
  t
35480
- ), o = (e.options ?? []).map(Px).filter(Boolean);
35488
+ ), o = (e.options ?? []).map(Bx).filter(Boolean);
35481
35489
  if (i === "matrix")
35482
- return (Array.isArray(e.rows) ? e.rows.map((l) => Bx(l)).filter(Boolean) : []).map((l) => ({
35490
+ return (Array.isArray(e.rows) ? e.rows.map((l) => Fx(l)).filter(Boolean) : []).map((l) => ({
35483
35491
  id: l.id,
35484
35492
  label: a,
35485
35493
  type: "singleSelect",
@@ -35526,7 +35534,7 @@ function zu(e) {
35526
35534
  if (!e || typeof e != "object")
35527
35535
  return null;
35528
35536
  const t = (e.questions ?? []).flatMap(
35529
- (r, a) => Fx(r, a)
35537
+ (r, a) => Hx(r, a)
35530
35538
  ).filter(Boolean);
35531
35539
  if (t.length === 0)
35532
35540
  return null;
@@ -35553,7 +35561,7 @@ function Gd(e, t) {
35553
35561
  label: e?.options?.find((a) => a.id === n)?.label ?? n
35554
35562
  })).sort((n, r) => n.rank - r.rank).slice(0, ju(e));
35555
35563
  }
35556
- function Hx({
35564
+ function Ux({
35557
35565
  chatApi: e = null,
35558
35566
  chatApiEndpoint: t = null
35559
35567
  } = {}) {
@@ -35568,10 +35576,10 @@ function Hx({
35568
35576
  }
35569
35577
  return null;
35570
35578
  }
35571
- function Ux(e) {
35579
+ function zx(e) {
35572
35580
  return Array.isArray(e) ? e.filter(Boolean) : e && typeof e == "object" ? [e] : [];
35573
35581
  }
35574
- function zx(e, t = /* @__PURE__ */ new Date()) {
35582
+ function jx(e, t = /* @__PURE__ */ new Date()) {
35575
35583
  const { startDate: n, endDate: r } = e ?? {};
35576
35584
  if (n) {
35577
35585
  const a = new Date(n);
@@ -35587,24 +35595,24 @@ function zx(e, t = /* @__PURE__ */ new Date()) {
35587
35595
  }
35588
35596
  function fp(e, t = {}) {
35589
35597
  const { now: n = /* @__PURE__ */ new Date() } = t;
35590
- return Ux(e).find(
35591
- (r) => zx(r, n)
35598
+ return zx(e).find(
35599
+ (r) => jx(r, n)
35592
35600
  ) ?? null;
35593
35601
  }
35594
- function jx(e) {
35602
+ function qx(e) {
35595
35603
  if (e?.questions?.length)
35596
35604
  return zu(e);
35597
35605
  const t = e?.conversationScreen?.surveys ?? e?.conversationScreen?.survey, n = fp(t);
35598
35606
  return n?.questions?.length ? zu(n) : null;
35599
35607
  }
35600
- function qx() {
35608
+ function $x() {
35601
35609
  try {
35602
35610
  return window?.analytics?.user?.()?.id?.() ?? null;
35603
35611
  } catch {
35604
35612
  return null;
35605
35613
  }
35606
35614
  }
35607
- function $x(e, t) {
35615
+ function Yx(e, t) {
35608
35616
  if (!t || t <= 0) return 0;
35609
35617
  const n = e / t;
35610
35618
  return Number.isNaN(n) || !Number.isFinite(n) ? 0 : Math.max(0, Math.min(100, Math.round(n * 100)));
@@ -35628,7 +35636,7 @@ function _i({
35628
35636
  last_answered_at: a ?? null,
35629
35637
  completed_at: i ?? null,
35630
35638
  current_question_id: s ?? null,
35631
- progress_percent: $x(
35639
+ progress_percent: Yx(
35632
35640
  u ?? 0,
35633
35641
  o ?? 0
35634
35642
  ),
@@ -35636,7 +35644,7 @@ function _i({
35636
35644
  answered_questions: u ?? 0
35637
35645
  };
35638
35646
  }
35639
- function Yx({
35647
+ function Vx({
35640
35648
  questionId: e,
35641
35649
  rowId: t,
35642
35650
  answerType: n,
@@ -35653,7 +35661,7 @@ function Yx({
35653
35661
  answered_at: i ?? null
35654
35662
  };
35655
35663
  }
35656
- function Vx(e, t) {
35664
+ function Gx(e, t) {
35657
35665
  return !e || typeof e != "object" || !t ? e : {
35658
35666
  ...e,
35659
35667
  answer: t
@@ -35671,7 +35679,7 @@ async function ki({
35671
35679
  try {
35672
35680
  const o = n?.endpoint ?? r;
35673
35681
  if (!o) return;
35674
- const u = n?.messagesKey ?? "messages", l = n?.payloadParams ?? {}, c = qx(), h = a && i ? gn(a) : null, p = e && typeof e == "object" ? (({ conversation_id: y, ...b }) => b)(
35682
+ const u = n?.messagesKey ?? "messages", l = n?.payloadParams ?? {}, c = $x(), h = a && i ? gn(a) : null, p = e && typeof e == "object" ? (({ conversation_id: y, ...b }) => b)(
35675
35683
  e
35676
35684
  ) : e, m = {
35677
35685
  [u]: Array.isArray(t) ? t : [],
@@ -35703,7 +35711,7 @@ async function ki({
35703
35711
  } catch {
35704
35712
  }
35705
35713
  }
35706
- async function Gx(e) {
35714
+ async function Wx(e) {
35707
35715
  if (!e?.ok)
35708
35716
  throw new Error("Failed to load survey");
35709
35717
  if (!e.body)
@@ -35717,7 +35725,7 @@ async function Gx(e) {
35717
35725
  }
35718
35726
  return JSON.parse(r);
35719
35727
  }
35720
- function Wx({
35728
+ function Xx({
35721
35729
  chatApi: e = null,
35722
35730
  chatApiEndpoint: t,
35723
35731
  clientId: n,
@@ -35847,7 +35855,7 @@ function Wx({
35847
35855
  }
35848
35856
  if (!n)
35849
35857
  throw new Error("Survey client id is required to load survey config");
35850
- const We = Hx({
35858
+ const We = Ux({
35851
35859
  chatApi: e,
35852
35860
  chatApiEndpoint: t
35853
35861
  });
@@ -35859,7 +35867,7 @@ function Wx({
35859
35867
  method: "GET",
35860
35868
  headers: { "Content-Type": "application/json" }
35861
35869
  }
35862
- ), Se = await Gx(rt), we = jx(Se);
35870
+ ), Se = await Wx(rt), we = qx(Se);
35863
35871
  if (!we)
35864
35872
  throw new Error(
35865
35873
  "Survey definition missing in conversationScreen.surveys array"
@@ -35916,14 +35924,14 @@ function Wx({
35916
35924
  currentQuestionId: be.id,
35917
35925
  totalQuestions: Be,
35918
35926
  answeredQuestions: re ? Be : je
35919
- }), $e = Yx({
35927
+ }), $e = Vx({
35920
35928
  questionId: (rt ?? be?.answerType ?? be?.type ?? null) === "matrix" ? be.parentQuestionId ?? be.id : be.id,
35921
35929
  rowId: (rt ?? be?.answerType ?? be?.type ?? null) === "matrix" ? be.id : null,
35922
35930
  answerType: rt ?? be?.answerType ?? be?.type ?? null,
35923
35931
  selectedOptionId: We,
35924
35932
  text: Se,
35925
35933
  answeredAt: we
35926
- }), xt = Vx(
35934
+ }), xt = Gx(
35927
35935
  Ae,
35928
35936
  $e
35929
35937
  );
@@ -36085,7 +36093,7 @@ function mp({
36085
36093
  setSurveyLoadError: ln,
36086
36094
  setSurveyLoading: In,
36087
36095
  setSurveyPromptSelected: Nn
36088
- } = Wx({
36096
+ } = Xx({
36089
36097
  chatApi: i,
36090
36098
  chatApiEndpoint: i?.endpoint,
36091
36099
  clientId: u,
@@ -36098,7 +36106,7 @@ function mp({
36098
36106
  }), On = (Xe) => {
36099
36107
  s.liveChat.useOwnChat ? E(Cn.LIVECHAT) : r(Xe);
36100
36108
  };
36101
- Mx({
36109
+ Px({
36102
36110
  chatContentRef: F,
36103
36111
  isSurveyMode: ae,
36104
36112
  messageCount: y,
@@ -36117,7 +36125,7 @@ function mp({
36117
36125
  resolvedLeadCaptureStyle: ye,
36118
36126
  shouldShowLeadCaptureForm: Ae,
36119
36127
  showLeadCaptureTooltip: $e
36120
- } = Ix({
36128
+ } = Nx({
36121
36129
  clientId: u,
36122
36130
  conversationScreen: s,
36123
36131
  isSurveyOverlayActive: be,
@@ -36641,7 +36649,7 @@ function $l() {
36641
36649
  return Oa;
36642
36650
  }
36643
36651
  var e1;
36644
- function Xx() {
36652
+ function Kx() {
36645
36653
  if (e1) return Ar;
36646
36654
  e1 = 1;
36647
36655
  var e = Ar && Ar.__assign || function() {
@@ -36711,7 +36719,7 @@ function Xx() {
36711
36719
  return Ar.attachListeners = l, Ar;
36712
36720
  }
36713
36721
  var _r = {}, t1;
36714
- function Kx() {
36722
+ function Qx() {
36715
36723
  if (t1) return _r;
36716
36724
  t1 = 1;
36717
36725
  var e = _r && _r.__assign || function() {
@@ -36773,10 +36781,10 @@ function Kx() {
36773
36781
  return _r.attachSharedListeners = c, _r;
36774
36782
  }
36775
36783
  var n1;
36776
- function Qx() {
36784
+ function Zx() {
36777
36785
  if (n1) return Na;
36778
36786
  n1 = 1, Object.defineProperty(Na, "__esModule", { value: !0 }), Na.createOrJoinSocket = void 0;
36779
- var e = zl(), t = Vn(), n = Xx(), r = Kx(), a = ql(), i = function(o, u, l, c, h) {
36787
+ var e = zl(), t = Vn(), n = Kx(), r = Qx(), a = ql(), i = function(o, u, l, c, h) {
36780
36788
  return function() {
36781
36789
  if ((0, a.removeSubscriber)(o, u), !(0, a.hasSubscribers)(o)) {
36782
36790
  try {
@@ -36816,7 +36824,7 @@ function Qx() {
36816
36824
  return Na.createOrJoinSocket = s, Na;
36817
36825
  }
36818
36826
  var Kn = {}, r1;
36819
- function Zx() {
36827
+ function Jx() {
36820
36828
  return r1 || (r1 = 1, (function(e) {
36821
36829
  var t = Kn && Kn.__awaiter || function(u, l, c, h) {
36822
36830
  function p(m) {
@@ -36953,7 +36961,7 @@ function Zx() {
36953
36961
  })(Kn)), Kn;
36954
36962
  }
36955
36963
  var Bo = {}, a1;
36956
- function Jx() {
36964
+ function eS() {
36957
36965
  return a1 || (a1 = 1, (function(e) {
36958
36966
  Object.defineProperty(e, "__esModule", { value: !0 }), e.websocketWrapper = void 0;
36959
36967
  var t = function(n, r) {
@@ -37072,7 +37080,7 @@ function Yl() {
37072
37080
  return p && p.__esModule ? p : { default: p };
37073
37081
  };
37074
37082
  Object.defineProperty(dn, "__esModule", { value: !0 }), dn.useWebSocket = void 0;
37075
- var a = nr, i = D2, s = Vn(), o = Qx(), u = Zx(), l = r(Jx()), c = $l(), h = function(p, m, y) {
37083
+ var a = nr, i = D2, s = Vn(), o = Zx(), u = Jx(), l = r(eS()), c = $l(), h = function(p, m, y) {
37076
37084
  m === void 0 && (m = s.DEFAULT_OPTIONS), y === void 0 && (y = !0);
37077
37085
  var b = (0, a.useState)(null), E = b[0], v = b[1], I = (0, a.useState)({}), B = I[0], Y = I[1], F = (0, a.useMemo)(function() {
37078
37086
  if (!m.disableJson && E)
@@ -37158,7 +37166,7 @@ function Yl() {
37158
37166
  return dn.useWebSocket = h, dn;
37159
37167
  }
37160
37168
  var kr = {}, s1;
37161
- function eS() {
37169
+ function tS() {
37162
37170
  if (s1) return kr;
37163
37171
  s1 = 1;
37164
37172
  var e = kr && kr.__assign || function() {
@@ -37204,7 +37212,7 @@ function eS() {
37204
37212
  return kr.useSocketIO = s, kr;
37205
37213
  }
37206
37214
  var Qn = {}, o1;
37207
- function tS() {
37215
+ function nS() {
37208
37216
  if (o1) return Qn;
37209
37217
  o1 = 1;
37210
37218
  var e = Qn && Qn.__assign || function() {
@@ -37247,14 +37255,14 @@ function tS() {
37247
37255
  return Qn.useEventSource = i, Qn;
37248
37256
  }
37249
37257
  var u1;
37250
- function nS() {
37258
+ function rS() {
37251
37259
  return u1 || (u1 = 1, (function(e) {
37252
37260
  Object.defineProperty(e, "__esModule", { value: !0 }), e.resetGlobalState = e.useEventSource = e.ReadyState = e.useSocketIO = e.default = void 0;
37253
37261
  var t = Yl();
37254
37262
  Object.defineProperty(e, "default", { enumerable: !0, get: function() {
37255
37263
  return t.useWebSocket;
37256
37264
  } });
37257
- var n = eS();
37265
+ var n = tS();
37258
37266
  Object.defineProperty(e, "useSocketIO", { enumerable: !0, get: function() {
37259
37267
  return n.useSocketIO;
37260
37268
  } });
@@ -37262,7 +37270,7 @@ function nS() {
37262
37270
  Object.defineProperty(e, "ReadyState", { enumerable: !0, get: function() {
37263
37271
  return r.ReadyState;
37264
37272
  } });
37265
- var a = tS();
37273
+ var a = nS();
37266
37274
  Object.defineProperty(e, "useEventSource", { enumerable: !0, get: function() {
37267
37275
  return a.useEventSource;
37268
37276
  } });
@@ -37272,9 +37280,9 @@ function nS() {
37272
37280
  } });
37273
37281
  })(Ro)), Ro;
37274
37282
  }
37275
- var rS = nS();
37276
- const aS = /* @__PURE__ */ ir(rS);
37277
- async function iS(e) {
37283
+ var aS = rS();
37284
+ const iS = /* @__PURE__ */ ir(aS);
37285
+ async function sS(e) {
37278
37286
  const t = await new Blob([e], { type: "application/json" });
37279
37287
  return new Promise((n, r) => {
37280
37288
  const a = new FileReader();
@@ -37288,13 +37296,13 @@ async function iS(e) {
37288
37296
  }, a.readAsText(t);
37289
37297
  });
37290
37298
  }
37291
- const sS = "This conversation with a live agent has ended. Please note that a transcript of this chat will be emailed to you. Feel free to continue chatting with Xpert.", tr = {
37299
+ const oS = "This conversation with a live agent has ended. Please note that a transcript of this chat will be emailed to you. Feel free to continue chatting with Xpert.", tr = {
37292
37300
  CONNECTING: "CONNECTING",
37293
37301
  CONVERSATION: "CONVERSATION",
37294
37302
  FORM: "FORM"
37295
37303
  }, Yr = ns({}), gp = ({ children: e, liveChatPayload: t }) => {
37296
37304
  const { conversationScreen: n } = Ie(At), { pushXpertMessage: r } = Ie(Tr), { setHasError: a, setMode: i } = Ie(jt), [s, o] = Ee(""), [u, l] = Ee(!1), [, c] = Ee(""), [h, p] = Ee([]), [m, y] = Ee(null), [b, E] = Ee(tr.FORM), [v, I] = Ee(null), B = ($) => p((W) => [...W, $]), Y = async ($) => {
37297
- const W = await iS($.data), { conversation_id: w, event_type: ae, body: ge } = W;
37305
+ const W = await sS($.data), { conversation_id: w, event_type: ae, body: ge } = W;
37298
37306
  switch (ae) {
37299
37307
  case "AGENT_TYPING":
37300
37308
  return ne();
@@ -37319,7 +37327,7 @@ const sS = "This conversation with a live agent has ended. Please note that a tr
37319
37327
  default:
37320
37328
  return;
37321
37329
  }
37322
- }, { sendJsonMessage: F } = aS(m, {
37330
+ }, { sendJsonMessage: F } = iS(m, {
37323
37331
  onMessage: Y
37324
37332
  }), A = () => {
37325
37333
  E(tr.FORM);
@@ -37332,7 +37340,7 @@ const sS = "This conversation with a live agent has ended. Please note that a tr
37332
37340
  });
37333
37341
  }, K = () => {
37334
37342
  r({
37335
- content: sS,
37343
+ content: oS,
37336
37344
  role: Ne.INFO
37337
37345
  }), J();
37338
37346
  }, J = () => {
@@ -37418,7 +37426,7 @@ gp.propTypes = {
37418
37426
  children: T.element.isRequired,
37419
37427
  liveChatPayload: T.object
37420
37428
  };
37421
- const oS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23ffffff'%20height='48'%20viewBox='0%20-960%20960%20960'%20width='48'%3e%3cpath%20d='M120-120v-300h60v198l558-558H540v-60h300v300h-60v-198L222-180h198v60H120Z'/%3e%3c/svg%3e", uS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23ffffff'%20height='48'%20viewBox='0%20-960%20960%20960'%20width='48'%3e%3cpath%20d='M370-287h360v-90H370v90ZM180-120q-24%200-42-18t-18-42v-600q0-24%2018-42t42-18h600q24%200%2042%2018t18%2042v600q0%2024-18%2042t-42%2018H180Zm0-60h600v-600H180v600Zm0-600v600-600Z'/%3e%3c/svg%3e";
37429
+ const uS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23ffffff'%20height='48'%20viewBox='0%20-960%20960%20960'%20width='48'%3e%3cpath%20d='M120-120v-300h60v198l558-558H540v-60h300v300h-60v-198L222-180h198v60H120Z'/%3e%3c/svg%3e", lS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23ffffff'%20height='48'%20viewBox='0%20-960%20960%20960'%20width='48'%3e%3cpath%20d='M370-287h360v-90H370v90ZM180-120q-24%200-42-18t-18-42v-600q0-24%2018-42t42-18h600q24%200%2042%2018t18%2042v600q0%2024-18%2042t-42%2018H180Zm0-60h600v-600H180v600Zm0-600v600-600Z'/%3e%3c/svg%3e";
37422
37430
  function bp({ handleResizeButtonClick: e, setIsMounted: t }) {
37423
37431
  const { isMobile: n, isNormalSize: r, leadCaptureFormActive: a } = Ie(jt);
37424
37432
  if (n || a)
@@ -37441,7 +37449,7 @@ function bp({ handleResizeButtonClick: e, setIsMounted: t }) {
37441
37449
  alt: i,
37442
37450
  "aria-hidden": !0,
37443
37451
  height: "24px",
37444
- src: r ? oS : uS,
37452
+ src: r ? uS : lS,
37445
37453
  width: "24px"
37446
37454
  }
37447
37455
  )
@@ -37637,7 +37645,7 @@ Tp.propTypes = {
37637
37645
  setIsMounted: T.func.isRequired,
37638
37646
  onClose: T.func.isRequired
37639
37647
  };
37640
- function lS() {
37648
+ function cS() {
37641
37649
  const {
37642
37650
  deleteConversationModal: e,
37643
37651
  deleteConversationHistory: t,
@@ -37691,7 +37699,7 @@ function lS() {
37691
37699
  }
37692
37700
  ) : null;
37693
37701
  }
37694
- const cS = () => {
37702
+ const dS = () => {
37695
37703
  const { isMobile: e } = Ie(jt), { launchButton: t } = Ie(At);
37696
37704
  return t?.message?.enabled ? /* @__PURE__ */ S.jsx(
37697
37705
  "div",
@@ -37705,13 +37713,13 @@ const cS = () => {
37705
37713
  }
37706
37714
  ) : null;
37707
37715
  };
37708
- function dS() {
37716
+ function hS() {
37709
37717
  return /* @__PURE__ */ S.jsx("div", { className: "spinner" });
37710
37718
  }
37711
37719
  function Ep() {
37712
37720
  const { conversationScreen: e, primaryColor: t, widgetMode: n } = Ie(At), { cancelLiveChatConnection: r } = Ie(Yr), a = e?.liveChat?.queueMessages ?? [], i = n ? t : "#FFFFFF", s = n ? "#FFFFFF" : t;
37713
37721
  return /* @__PURE__ */ S.jsxs("div", { className: "live-chat-connecting", style: { backgroundColor: i }, children: [
37714
- /* @__PURE__ */ S.jsx(dS, {}),
37722
+ /* @__PURE__ */ S.jsx(hS, {}),
37715
37723
  /* @__PURE__ */ S.jsx("div", { className: "live-chat-connecting-messages", style: { color: s }, children: a.length === 0 ? /* @__PURE__ */ S.jsx("p", { children: "Connecting to live agent" }) : a.map((o, u) => /* @__PURE__ */ S.jsx("p", { children: o }, `queue-message-${u}`)) }),
37716
37724
  /* @__PURE__ */ S.jsx(
37717
37725
  "button",
@@ -37724,7 +37732,7 @@ function Ep() {
37724
37732
  ] });
37725
37733
  }
37726
37734
  Ep.propTypes = {};
37727
- const l1 = 500, hS = [
37735
+ const l1 = 500, fS = [
37728
37736
  {
37729
37737
  key: "great",
37730
37738
  icon: "😀",
@@ -37762,7 +37770,7 @@ function xp({ onDismiss: e }) {
37762
37770
  ] }),
37763
37771
  r && /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
37764
37772
  /* @__PURE__ */ S.jsx("p", { children: "Before you go, let me know how I did:" }),
37765
- /* @__PURE__ */ S.jsx("div", { className: "livechat-end-confirmation-container__icon-button-container", children: hS.map(({ key: y, icon: b, text: E }) => {
37773
+ /* @__PURE__ */ S.jsx("div", { className: "livechat-end-confirmation-container__icon-button-container", children: fS.map(({ key: y, icon: b, text: E }) => {
37766
37774
  const v = y === i, I = v ? { backgroundColor: "#E7E4DB", borderColor: "#767676" } : {};
37767
37775
  return /* @__PURE__ */ S.jsxs(
37768
37776
  "button",
@@ -37813,7 +37821,7 @@ function xp({ onDismiss: e }) {
37813
37821
  xp.propTypes = {
37814
37822
  onDismiss: T.func
37815
37823
  };
37816
- function fS(e, t) {
37824
+ function mS(e, t) {
37817
37825
  const [n, r] = Ee(!1), a = Je(), i = Wt(
37818
37826
  (...s) => {
37819
37827
  n || (e(...s), r(!0), clearTimeout(a.current), a.current = setTimeout(() => {
@@ -37833,7 +37841,7 @@ function Sp() {
37833
37841
  liveChatMessages: n,
37834
37842
  sendMessage: r,
37835
37843
  sendTypingEvent: a
37836
- } = Ie(Yr), i = Je(null), [s, o] = Ee(!1), u = fS(a, 5e3), l = () => {
37844
+ } = Ie(Yr), i = Je(null), [s, o] = Ee(!1), u = mS(a, 5e3), l = () => {
37837
37845
  u();
37838
37846
  }, c = (h) => {
37839
37847
  h.trim() !== "" && r(h);
@@ -37895,7 +37903,7 @@ function Sp() {
37895
37903
  ] });
37896
37904
  }
37897
37905
  Sp.propTypes = {};
37898
- function mS(e) {
37906
+ function pS(e) {
37899
37907
  const t = /^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
37900
37908
  if (!e || e.length > 254 || !t.test(e)) return !1;
37901
37909
  var r = e.split("@");
@@ -37903,7 +37911,7 @@ function mS(e) {
37903
37911
  return i.length > 63;
37904
37912
  }));
37905
37913
  }
37906
- const pS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20role='img'%20focusable='false'%20aria-hidden='true'%3e%3cpath%20d='M19%2019H5V5h7V3H3v18h18v-9h-2v7zM14%203v2h3.59l-9.83%209.83%201.41%201.41L19%206.41V10h2V3h-7z'%20fill='currentColor'%3e%3c/path%3e%3c/svg%3e", gS = () => {
37914
+ const gS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20role='img'%20focusable='false'%20aria-hidden='true'%3e%3cpath%20d='M19%2019H5V5h7V3H3v18h18v-9h-2v7zM14%203v2h3.59l-9.83%209.83%201.41%201.41L19%206.41V10h2V3h-7z'%20fill='currentColor'%3e%3c/path%3e%3c/svg%3e", bS = () => {
37907
37915
  const [e, t] = Ee({});
37908
37916
  return {
37909
37917
  clearError: (i) => {
@@ -37919,7 +37927,7 @@ const pS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
37919
37927
  },
37920
37928
  setErrors: t
37921
37929
  };
37922
- }, bS = (e) => {
37930
+ }, yS = (e) => {
37923
37931
  const [t, n] = Ee(e);
37924
37932
  return [t, n, (i, s) => {
37925
37933
  n((o) => ({ ...o, [i]: s }));
@@ -37928,7 +37936,7 @@ const pS = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
37928
37936
  }];
37929
37937
  }, Fo = "privacy policy";
37930
37938
  function Cp() {
37931
- const { conversationScreen: e, primaryColor: t } = Ie(At), { startLiveChat: n } = Ie(Yr), { setMode: r } = Ie(jt), { form: a, formHeader: i, privacyPolicyLink: s, privacyPolicyText: o } = e.liveChat, [u, , l] = bS({}), [c, h] = Ee(!1), { clearError: p, errors: m, setErrors: y } = gS(), b = Gt(
37939
+ const { conversationScreen: e, primaryColor: t } = Ie(At), { startLiveChat: n } = Ie(Yr), { setMode: r } = Ie(jt), { form: a, formHeader: i, privacyPolicyLink: s, privacyPolicyText: o } = e.liveChat, [u, , l] = yS({}), [c, h] = Ee(!1), { clearError: p, errors: m, setErrors: y } = bS(), b = Gt(
37932
37940
  () => (o ?? "").split(Fo, 2),
37933
37941
  [o]
37934
37942
  ), E = () => {
@@ -37952,7 +37960,7 @@ function Cp() {
37952
37960
  for (const q of J)
37953
37961
  switch (q) {
37954
37962
  case "email": {
37955
- if (!mS(ne))
37963
+ if (!pS(ne))
37956
37964
  return { ...A, [K]: "Should be email" };
37957
37965
  break;
37958
37966
  }
@@ -37997,7 +38005,7 @@ function Cp() {
37997
38005
  {
37998
38006
  alt: "open in new",
37999
38007
  "aria-hidden": "true",
38000
- src: pS
38008
+ src: gS
38001
38009
  }
38002
38010
  )
38003
38011
  ]
@@ -38131,7 +38139,7 @@ Ap.propTypes = {
38131
38139
  showMessage: T.bool,
38132
38140
  style: T.shape()
38133
38141
  };
38134
- function yS(e, t, n) {
38142
+ function vS(e, t, n) {
38135
38143
  const r = Wt(
38136
38144
  (a) => {
38137
38145
  const { data: i } = a || {}, { chatState: s, show: o, type: u } = i || {};
@@ -38161,7 +38169,7 @@ function yS(e, t, n) {
38161
38169
  };
38162
38170
  }, [e, t]);
38163
38171
  }
38164
- function vS(e) {
38172
+ function TS(e) {
38165
38173
  const [t, n] = Ee(null);
38166
38174
  return _e(() => {
38167
38175
  try {
@@ -38180,7 +38188,7 @@ function vS(e) {
38180
38188
  };
38181
38189
  }, [e]), t;
38182
38190
  }
38183
- function TS(e) {
38191
+ function ES(e) {
38184
38192
  _e(() => {
38185
38193
  const t = () => document.visibilityState === "visible" && e();
38186
38194
  return document.addEventListener("visibilitychange", t), () => {
@@ -38188,7 +38196,7 @@ function TS(e) {
38188
38196
  };
38189
38197
  }, [e]);
38190
38198
  }
38191
- function ES({
38199
+ function xS({
38192
38200
  abortControllerRef: e,
38193
38201
  buildChatRequestBody: t,
38194
38202
  chatApi: n,
@@ -38263,7 +38271,7 @@ function ES({
38263
38271
  B();
38264
38272
  }, [B]);
38265
38273
  }
38266
- function xS({
38274
+ function SS({
38267
38275
  configurationLoaded: e,
38268
38276
  userTracking: t,
38269
38277
  widgetMode: n,
@@ -38303,12 +38311,12 @@ function c1(e, t) {
38303
38311
  );
38304
38312
  return (t.getTime() - e.getTime()) / 1e3;
38305
38313
  }
38306
- function SS(e) {
38314
+ function CS(e) {
38307
38315
  if (!e) return 0;
38308
38316
  const t = /\[(.+)\]\(([^ ]+)( "(.+)")?\)/gm;
38309
38317
  return e.match(t)?.length || 0;
38310
38318
  }
38311
- const CS = 100, wS = (e = CS) => new Promise((t) => setTimeout(t, e));
38319
+ const wS = 100, AS = (e = wS) => new Promise((t) => setTimeout(t, e));
38312
38320
  function _p({ submitEventExternal: e = null }) {
38313
38321
  const {
38314
38322
  chatApi: t,
@@ -38372,11 +38380,11 @@ function _p({ submitEventExternal: e = null }) {
38372
38380
  }
38373
38381
  }, [p]), _e(() => {
38374
38382
  B === Cn.XPERT && ae && ge.current && ge.current.focus();
38375
- }, [B, ae]), yS(
38383
+ }, [B, ae]), vS(
38376
38384
  a?.liveChat?.enabled,
38377
38385
  O,
38378
38386
  H
38379
- ), xS({
38387
+ ), SS({
38380
38388
  configurationLoaded: n,
38381
38389
  userTracking: u,
38382
38390
  widgetMode: c,
@@ -38408,7 +38416,7 @@ function _p({ submitEventExternal: e = null }) {
38408
38416
  payload: {
38409
38417
  category: "2u",
38410
38418
  label: "xpert-chatbot",
38411
- linkCount: SS(Se),
38419
+ linkCount: CS(Se),
38412
38420
  apiResponseMessage: Se,
38413
38421
  isTestUser: ve,
38414
38422
  conversationHistoryId: we,
@@ -38504,7 +38512,7 @@ function _p({ submitEventExternal: e = null }) {
38504
38512
  J(!1), w(!0);
38505
38513
  }
38506
38514
  }, pt = a?.conversationHistory?.enabled && ae && !O;
38507
- if (TS(
38515
+ if (ES(
38508
38516
  () => pt && et()
38509
38517
  ), _e(() => {
38510
38518
  const Se = !!Jt.get(`${i}-conversation-history-id`);
@@ -38536,7 +38544,7 @@ function _p({ submitEventExternal: e = null }) {
38536
38544
  n,
38537
38545
  l?.enabled,
38538
38546
  l?.experimentName
38539
- ]), vS(l?.experimentName), ES({
38547
+ ]), TS(l?.experimentName), xS({
38540
38548
  abortControllerRef: p,
38541
38549
  buildChatRequestBody: Le,
38542
38550
  chatApi: t,
@@ -38592,7 +38600,7 @@ function _p({ submitEventExternal: e = null }) {
38592
38600
  }), V++;
38593
38601
  ye = c1(De, /* @__PURE__ */ new Date());
38594
38602
  }
38595
- if (Ae || (await wS(), Ae)) break;
38603
+ if (Ae || (await AS(), Ae)) break;
38596
38604
  b((Lt) => {
38597
38605
  const St = [...Lt];
38598
38606
  return St.splice(
@@ -38772,7 +38780,7 @@ function _p({ submitEventExternal: e = null }) {
38772
38780
  handleFloatingActionButtonClick: In
38773
38781
  }
38774
38782
  ),
38775
- c && /* @__PURE__ */ S.jsx(cS, {}),
38783
+ c && /* @__PURE__ */ S.jsx(dS, {}),
38776
38784
  ae && !O && /* @__PURE__ */ S.jsx(D1, { isMounted: X, children: /* @__PURE__ */ S.jsx(
38777
38785
  "div",
38778
38786
  {
@@ -38788,7 +38796,7 @@ function _p({ submitEventExternal: e = null }) {
38788
38796
  setIsMounted: $
38789
38797
  }
38790
38798
  ),
38791
- /* @__PURE__ */ S.jsx(lS, {}),
38799
+ /* @__PURE__ */ S.jsx(cS, {}),
38792
38800
  B === Cn.XPERT && /* @__PURE__ */ S.jsx(
38793
38801
  mp,
38794
38802
  {
@@ -38920,7 +38928,7 @@ Ip.propTypes = {
38920
38928
  xpertKey: T.string,
38921
38929
  widgetMode: T.bool
38922
38930
  };
38923
- function AS() {
38931
+ function _S() {
38924
38932
  let e = document.getElementById("xpert-chatbot-container");
38925
38933
  e || (e = document.createElement("div"), e.setAttribute("id", "xpert-chatbot-container"), document.body.appendChild(e), M2(
38926
38934
  /* @__PURE__ */ S.jsx(R2, { children: /* @__PURE__ */ S.jsx(
@@ -38936,7 +38944,7 @@ function AS() {
38936
38944
  ));
38937
38945
  }
38938
38946
  window.XpertChatbotFrontend = window.XpertChatbotFrontend || {};
38939
- window.XpertChatbotFrontend.mount = AS;
38947
+ window.XpertChatbotFrontend.mount = _S;
38940
38948
  window.process = window.process || {};
38941
38949
  window.process.env = { ...window.process.env, NODE_ENV: "production" };
38942
38950
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2uinc/frontend-component-xpert-chatbot",
3
- "version": "1.40.28",
3
+ "version": "1.40.29-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/2uinc/frontend-component-xpert-chatbot.git"