tia-gpc-widget 2.1.2 → 3.0.0

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.
@@ -6,7 +6,7 @@ import Fe, { Toaster as Xi } from "react-hot-toast";
6
6
  import Ki from "axios";
7
7
  import kt from "i18next";
8
8
  import $i from "i18next-browser-languagedetector";
9
- const Et = "2.1.2", eo = 30, to = eo * 24 * 60 * 60 * 1e3, Ge = {
9
+ const Et = "3.0.0", eo = 30, to = eo * 24 * 60 * 60 * 1e3, Ge = {
10
10
  VERIFIED: "gpc_captcha_verified",
11
11
  TIMESTAMP: "gpc_captcha_timestamp"
12
12
  }, no = [
@@ -115,7 +115,14 @@ const ro = ({ onClick: e, unreadCount: t = 0, widgetConfig: n }) => {
115
115
  return b && (A.backgroundColor = b), S && (A.color = S), /* @__PURE__ */ R("div", { className: "gpc-chat-header", style: A, children: [
116
116
  /* @__PURE__ */ R("div", { className: "gpc-header-content", children: [
117
117
  v && /* @__PURE__ */ w("div", { className: "gpc-header-logo", children: /* @__PURE__ */ w("img", { src: v, alt: f, className: "gpc-company-logo" }) }),
118
- /* @__PURE__ */ w("div", { className: "gpc-header-text", children: /* @__PURE__ */ w("h2", { className: "gpc-header-title", style: S ? { color: S } : {}, children: x }) })
118
+ /* @__PURE__ */ w("div", { className: "gpc-header-text", children: /* @__PURE__ */ w(
119
+ "h2",
120
+ {
121
+ className: "gpc-header-title",
122
+ style: S ? { color: S } : {},
123
+ children: x
124
+ }
125
+ ) })
119
126
  ] }),
120
127
  /* @__PURE__ */ R("div", { className: "gpc-header-actions", children: [
121
128
  a && /* @__PURE__ */ R(
@@ -4791,15 +4798,15 @@ function ts(e, t) {
4791
4798
  }
4792
4799
  function ns(e, t) {
4793
4800
  const n = t.value ? t.value + `
4794
- ` : "", r = {};
4795
- t.lang && (r.className = ["language-" + t.lang]);
4796
- let i = {
4801
+ ` : "", r = {}, i = t.lang ? t.lang.split(/\s+/) : [];
4802
+ i.length > 0 && (r.className = ["language-" + i[0]]);
4803
+ let a = {
4797
4804
  type: "element",
4798
4805
  tagName: "code",
4799
4806
  properties: r,
4800
4807
  children: [{ type: "text", value: n }]
4801
4808
  };
4802
- return t.meta && (i.data = { meta: t.meta }), e.patch(t, i), i = e.applyData(t, i), i = { type: "element", tagName: "pre", properties: {}, children: [i] }, e.patch(t, i), i;
4809
+ return t.meta && (a.data = { meta: t.meta }), e.patch(t, a), a = e.applyData(t, a), a = { type: "element", tagName: "pre", properties: {}, children: [a] }, e.patch(t, a), a;
4803
4810
  }
4804
4811
  function rs(e, t) {
4805
4812
  const n = {
@@ -9314,7 +9321,11 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9314
9321
  isLoadingMoreConversations: u,
9315
9322
  onLoadMore: h
9316
9323
  }) => {
9317
- const { t: c } = ge(), f = ce(null), [p, m] = q(null), [x, v] = q(""), [b, S] = q({ isOpen: !1, id: null, title: "" });
9324
+ const { t: c } = ge(), f = ce(null), [p, m] = q(null), [x, v] = q(""), [b, S] = q({
9325
+ isOpen: !1,
9326
+ id: null,
9327
+ title: ""
9328
+ });
9318
9329
  ae(() => {
9319
9330
  const y = new IntersectionObserver(
9320
9331
  (E) => {
@@ -9399,7 +9410,10 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9399
9410
  E.key === "Enter" && k(y.conversation_id), E.key === "Escape" && T();
9400
9411
  },
9401
9412
  className: "gpc-conversation-edit-input gpc-focus-visible",
9402
- placeholder: c("conversations.untitled", "Untitled conversation"),
9413
+ placeholder: c(
9414
+ "conversations.untitled",
9415
+ "Untitled conversation"
9416
+ ),
9403
9417
  autoFocus: !0,
9404
9418
  maxLength: 200
9405
9419
  }
@@ -9460,7 +9474,10 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9460
9474
  onClick: (E) => {
9461
9475
  E.preventDefault(), E.stopPropagation(), P(
9462
9476
  y.conversation_id,
9463
- y.title || c("conversations.untitled", "Untitled conversation")
9477
+ y.title || c(
9478
+ "conversations.untitled",
9479
+ "Untitled conversation"
9480
+ )
9464
9481
  );
9465
9482
  },
9466
9483
  className: "gpc-conversation-action-button gpc-conversation-action-delete gpc-focus-visible gpc-transition",
@@ -9940,7 +9957,12 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9940
9957
  else
9941
9958
  throw new Error("Failed to generate challenge");
9942
9959
  } catch (T) {
9943
- c(r("captcha.errorGenerating", "Error generating challenge. Please try again.")), n && n(T);
9960
+ c(
9961
+ r(
9962
+ "captcha.errorGenerating",
9963
+ "Error generating challenge. Please try again."
9964
+ )
9965
+ ), n && n(T);
9944
9966
  } finally {
9945
9967
  x(!1);
9946
9968
  }
@@ -9952,9 +9974,15 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9952
9974
  c(r("captcha.invalidNumber")), p(!1);
9953
9975
  return;
9954
9976
  }
9955
- const P = await e.verifyCaptchaAnswer(o, k);
9977
+ const P = await e.verifyCaptchaAnswer(
9978
+ o,
9979
+ k
9980
+ );
9956
9981
  if (P.success)
9957
- localStorage.setItem(Ge.VERIFIED, "true"), localStorage.setItem(Ge.TIMESTAMP, Date.now().toString()), t && t();
9982
+ localStorage.setItem(Ge.VERIFIED, "true"), localStorage.setItem(
9983
+ Ge.TIMESTAMP,
9984
+ Date.now().toString()
9985
+ ), t && t();
9958
9986
  else {
9959
9987
  const _ = P.attempts_remaining;
9960
9988
  b(_), _ !== void 0 && _ > 0 ? c(
@@ -9968,13 +9996,28 @@ const Si = "https://www.tiagpctest.softiabot.com", Lh = {
9968
9996
  switch (k.error_code) {
9969
9997
  case "CHALLENGE_NOT_FOUND":
9970
9998
  case "CHALLENGE_EXPIRED":
9971
- c(r("captcha.challengeExpired", "Challenge expired. Generating a new one...")), setTimeout(() => S(), 2e3);
9999
+ c(
10000
+ r(
10001
+ "captcha.challengeExpired",
10002
+ "Challenge expired. Generating a new one..."
10003
+ )
10004
+ ), setTimeout(() => S(), 2e3);
9972
10005
  break;
9973
10006
  case "MAX_ATTEMPTS_EXCEEDED":
9974
- c(r("captcha.maxAttemptsExceeded", "Maximum attempts exceeded. Generating a new challenge...")), setTimeout(() => S(), 2e3);
10007
+ c(
10008
+ r(
10009
+ "captcha.maxAttemptsExceeded",
10010
+ "Maximum attempts exceeded. Generating a new challenge..."
10011
+ )
10012
+ ), setTimeout(() => S(), 2e3);
9975
10013
  break;
9976
10014
  case "INVALID_SESSION":
9977
- c(r("captcha.invalidSession", "Invalid session. Please refresh the page."));
10015
+ c(
10016
+ r(
10017
+ "captcha.invalidSession",
10018
+ "Invalid session. Please refresh the page."
10019
+ )
10020
+ );
9978
10021
  break;
9979
10022
  default:
9980
10023
  c(r("captcha.error"));