@ethora/chat-component 25.5.30 → 25.6.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.
package/dist/main.js CHANGED
@@ -4614,7 +4614,7 @@ const Va = (n) => ({
4614
4614
  setConfig: uv,
4615
4615
  refreshTokens: p1,
4616
4616
  logout: Cs,
4617
- setActiveModal: Re,
4617
+ setActiveModal: Pe,
4618
4618
  setDeleteModal: Ur,
4619
4619
  setSelectedUser: YA,
4620
4620
  updateUser: hv,
@@ -4862,7 +4862,7 @@ const bv = {
4862
4862
  setEditAction: Wn,
4863
4863
  editRoomMessage: xv,
4864
4864
  setComposing: Ev,
4865
- setIsLoading: Qe,
4865
+ setIsLoading: Re,
4866
4866
  setLastViewedTimestamp: hr,
4867
4867
  setRoomNoMessages: tE,
4868
4868
  setCurrentRoom: Ye,
@@ -9566,7 +9566,7 @@ const Xr = (n, e) => {
9566
9566
  } catch (s) {
9567
9567
  console.error(s);
9568
9568
  } finally {
9569
- z.dispatch(Qe({ loading: !1 }));
9569
+ z.dispatch(Re({ loading: !1 }));
9570
9570
  }
9571
9571
  }, oh = Ou(null), kE = ({
9572
9572
  children: n,
@@ -14008,13 +14008,13 @@ function g4(n, e) {
14008
14008
  * See the License for the specific language governing permissions and
14009
14009
  * limitations under the License.
14010
14010
  */
14011
- function Pe() {
14011
+ function Qe() {
14012
14012
  return typeof navigator < "u" && typeof navigator.userAgent == "string" ? navigator.userAgent : "";
14013
14013
  }
14014
14014
  function p4() {
14015
14015
  return typeof window < "u" && // @ts-ignore Setting up an broadly applicable index signature for Window
14016
14016
  // just to deal with this case would probably be a bad idea.
14017
- !!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Pe());
14017
+ !!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Qe());
14018
14018
  }
14019
14019
  function v4() {
14020
14020
  return typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers";
@@ -14027,7 +14027,7 @@ function w4() {
14027
14027
  return typeof navigator == "object" && navigator.product === "ReactNative";
14028
14028
  }
14029
14029
  function y4() {
14030
- const n = Pe();
14030
+ const n = Qe();
14031
14031
  return n.indexOf("MSIE ") >= 0 || n.indexOf("Trident/") >= 0;
14032
14032
  }
14033
14033
  function k4() {
@@ -16592,39 +16592,39 @@ function wl(n) {
16592
16592
  }
16593
16593
  return "Other";
16594
16594
  }
16595
- function vm(n = Pe()) {
16595
+ function vm(n = Qe()) {
16596
16596
  return /firefox\//i.test(n);
16597
16597
  }
16598
- function bm(n = Pe()) {
16598
+ function bm(n = Qe()) {
16599
16599
  const e = n.toLowerCase();
16600
16600
  return e.includes("safari/") && !e.includes("chrome/") && !e.includes("crios/") && !e.includes("android");
16601
16601
  }
16602
- function wm(n = Pe()) {
16602
+ function wm(n = Qe()) {
16603
16603
  return /crios\//i.test(n);
16604
16604
  }
16605
- function ym(n = Pe()) {
16605
+ function ym(n = Qe()) {
16606
16606
  return /iemobile/i.test(n);
16607
16607
  }
16608
- function km(n = Pe()) {
16608
+ function km(n = Qe()) {
16609
16609
  return /android/i.test(n);
16610
16610
  }
16611
- function Cm(n = Pe()) {
16611
+ function Cm(n = Qe()) {
16612
16612
  return /blackberry/i.test(n);
16613
16613
  }
16614
- function xm(n = Pe()) {
16614
+ function xm(n = Qe()) {
16615
16615
  return /webos/i.test(n);
16616
16616
  }
16617
- function bf(n = Pe()) {
16617
+ function bf(n = Qe()) {
16618
16618
  return /iphone|ipad|ipod/i.test(n) || /macintosh/i.test(n) && /mobile/i.test(n);
16619
16619
  }
16620
- function s9(n = Pe()) {
16620
+ function s9(n = Qe()) {
16621
16621
  var e;
16622
16622
  return bf(n) && !!(!((e = window.navigator) === null || e === void 0) && e.standalone);
16623
16623
  }
16624
16624
  function a9() {
16625
16625
  return y4() && document.documentMode === 10;
16626
16626
  }
16627
- function Em(n = Pe()) {
16627
+ function Em(n = Qe()) {
16628
16628
  return bf(n) || km(n) || xm(n) || Cm(n) || /windows phone/i.test(n) || ym(n);
16629
16629
  }
16630
16630
  /**
@@ -16647,10 +16647,10 @@ function Im(n, e = []) {
16647
16647
  let i;
16648
16648
  switch (n) {
16649
16649
  case "Browser":
16650
- i = wl(Pe());
16650
+ i = wl(Qe());
16651
16651
  break;
16652
16652
  case "Worker":
16653
- i = `${wl(Pe())}-${n}`;
16653
+ i = `${wl(Qe())}-${n}`;
16654
16654
  break;
16655
16655
  default:
16656
16656
  i = n;
@@ -19371,7 +19371,7 @@ function CC(n, e, i, t = bC, r = wC) {
19371
19371
  height: r.toString(),
19372
19372
  top: s,
19373
19373
  left: a
19374
- }), f = Pe().toLowerCase();
19374
+ }), f = Qe().toLowerCase();
19375
19375
  i && (A = wm(f) ? yC : i), vm(f) && (e = e || kC, o.scrollbars = "yes");
19376
19376
  const d = Object.entries(o).reduce((c, [h, m]) => `${c}${h}=${m},`, "");
19377
19377
  if (s9(f) && A !== "_self")
@@ -22304,7 +22304,7 @@ const O5 = /* @__PURE__ */ ji(Q5), ng = T.div`
22304
22304
  }, p = async () => {
22305
22305
  d.setRoomImageStanza(c.jid, null, "icon", "none"), f(wn({ jid: c.jid, updates: { icon: null } }));
22306
22306
  }, b = (C) => {
22307
- f(Re(me.PROFILE)), f(
22307
+ f(Pe(me.PROFILE)), f(
22308
22308
  YA({
22309
22309
  id: C._id,
22310
22310
  firstName: C.firstName,
@@ -22319,14 +22319,14 @@ const O5 = /* @__PURE__ */ ji(Q5), ng = T.div`
22319
22319
  label: "Appoint as an admin",
22320
22320
  icon: null,
22321
22321
  onClick: () => {
22322
- f(Re(me.PROFILE)), console.log("Profile clicked");
22322
+ f(Pe(me.PROFILE)), console.log("Profile clicked");
22323
22323
  }
22324
22324
  },
22325
22325
  {
22326
22326
  label: "Unban",
22327
22327
  icon: null,
22328
22328
  onClick: () => {
22329
- f(Re(me.SETTINGS)), console.log("Settings clicked");
22329
+ f(Pe(me.SETTINGS)), console.log("Settings clicked");
22330
22330
  }
22331
22331
  },
22332
22332
  {
@@ -22507,7 +22507,7 @@ const O5 = /* @__PURE__ */ ji(Q5), ng = T.div`
22507
22507
  setIsModalOpen: a
22508
22508
  }
22509
22509
  )
22510
- ] }) : (f(Re()), null);
22510
+ ] }) : (f(Pe()), null);
22511
22511
  }, W5 = T.div`
22512
22512
  margin: 0;
22513
22513
  cursor: pointer;
@@ -22635,7 +22635,7 @@ const Z5 = ({
22635
22635
  mimetype: i
22636
22636
  }) => {
22637
22637
  const t = we(), r = (s) => {
22638
- t(xs({ fileName: n, fileURL: e, mimetype: i })), t(Re(me.FILE_PREVIEW)), s.preventDefault(), s.stopPropagation();
22638
+ t(xs({ fileName: n, fileURL: e, mimetype: i })), t(Pe(me.FILE_PREVIEW)), s.preventDefault(), s.stopPropagation();
22639
22639
  };
22640
22640
  return /* @__PURE__ */ u(J5, { children: /* @__PURE__ */ u(
22641
22641
  K5,
@@ -23404,7 +23404,7 @@ const ru = T.div`
23404
23404
  D
23405
23405
  ), g && (await i.inviteRoomRequestStanza(v, g), await i.getRoomsStanza());
23406
23406
  }
23407
- e(Re());
23407
+ e(Pe());
23408
23408
  }, [a]), x = a ?? s, C = () => {
23409
23409
  if (A)
23410
23410
  return su.find((g) => g.id === A);
@@ -23500,7 +23500,7 @@ const ru = T.div`
23500
23500
  ],
23501
23501
  []
23502
23502
  ), i = we(), t = Z((r) => {
23503
- i(Re(r));
23503
+ i(Pe(r));
23504
23504
  }, []);
23505
23505
  return /* @__PURE__ */ S(un, { children: [
23506
23506
  /* @__PURE__ */ u(
@@ -24090,14 +24090,14 @@ const ru = T.div`
24090
24090
  label: "Profile",
24091
24091
  icon: null,
24092
24092
  onClick: () => {
24093
- d(Re(me.PROFILE)), console.log("Profile clicked");
24093
+ d(Pe(me.PROFILE)), console.log("Profile clicked");
24094
24094
  }
24095
24095
  },
24096
24096
  {
24097
24097
  label: "Settings",
24098
24098
  icon: null,
24099
24099
  onClick: () => {
24100
- d(Re(me.SETTINGS)), console.log("Settings clicked");
24100
+ d(Pe(me.SETTINGS)), console.log("Settings clicked");
24101
24101
  }
24102
24102
  },
24103
24103
  {
@@ -24213,7 +24213,7 @@ const F7 = ({
24213
24213
  }, f = (l) => {
24214
24214
  i(
24215
24215
  wn({ jid: l.jid, updates: { ...l, unreadMessages: 0 } })
24216
- ), i(Ye({ roomJID: l.jid })), i(Qe({ chatJID: l.jid, loading: !0 }));
24216
+ ), i(Ye({ roomJID: l.jid })), i(Re({ chatJID: l.jid, loading: !0 }));
24217
24217
  }, d = Z(() => {
24218
24218
  if (t.leaveTheRoomStanza(s), i(HA({ jid: s })), Object.keys(r).length < 1 || s === Object.keys(r)[0]) {
24219
24219
  const c = `${window.location.pathname}`;
@@ -24243,7 +24243,7 @@ const F7 = ({
24243
24243
  /* @__PURE__ */ S(
24244
24244
  g3,
24245
24245
  {
24246
- onClick: () => i(Re(me.CHAT_PROFILE)),
24246
+ onClick: () => i(Pe(me.CHAT_PROFILE)),
24247
24247
  children: [
24248
24248
  /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u(
24249
24249
  ci,
@@ -24545,7 +24545,7 @@ const F7 = ({
24545
24545
  xmpp: t
24546
24546
  })
24547
24547
  );
24548
- }), e(Qe({ loading: !1, loadingText: void 0 })), e(y1({ rooms: s.items })), s?.items || [];
24548
+ }), e(Re({ loading: !1, loadingText: void 0 })), e(y1({ rooms: s.items })), s?.items || [];
24549
24549
  },
24550
24550
  [e]
24551
24551
  );
@@ -24554,14 +24554,14 @@ const F7 = ({
24554
24554
  fe(() => {
24555
24555
  const A = async () => {
24556
24556
  if (!r) return;
24557
- s(Qe({ loading: !0, chatJID: n }));
24557
+ s(Re({ loading: !0, chatJID: n }));
24558
24558
  const f = await r.getHistoryStanza(n, 30);
24559
- f && au(f) > 0 && (s(Qe({ loading: !1, chatJID: n })), await r.getHistoryStanza(
24559
+ f && au(f) > 0 && (s(Re({ loading: !1, chatJID: n })), await r.getHistoryStanza(
24560
24560
  n,
24561
24561
  20 + au(f),
24562
24562
  Number(f[0].id)
24563
24563
  )), s(
24564
- Qe({
24564
+ Re({
24565
24565
  loading: !1,
24566
24566
  chatJID: n,
24567
24567
  loadingText: void 0
@@ -24570,7 +24570,7 @@ const F7 = ({
24570
24570
  }, o = async () => {
24571
24571
  !e[n] && n && r ? (await r.presenceInRoomStanza(n), i?.newArch ? await a(r, i) : await r.getRoomsStanza(), await A()) : await A();
24572
24572
  };
24573
- if (Object.keys(e)?.length > 0 ? n && !e?.[n] && Object.keys(e).length > 0 ? (s(Qe({ loading: !0, chatJID: n })), o()) : n && t < 1 && !e?.[n].historyComplete ? (s(Qe({ loading: !0, chatJID: n })), A()) : s(Qe({ loading: !1, chatJID: n })) : e?.[n] || o(), r && i?.defaultRooms) {
24573
+ if (Object.keys(e)?.length > 0 ? n && !e?.[n] && Object.keys(e).length > 0 ? (s(Re({ loading: !0, chatJID: n })), o()) : n && t < 1 && !e?.[n].historyComplete ? (s(Re({ loading: !0, chatJID: n })), A()) : s(Re({ loading: !1, chatJID: n })) : e?.[n] || o(), r && i?.defaultRooms) {
24574
24574
  const f = i?.defaultRooms.every(
24575
24575
  (d) => e[d.jid] !== void 0
24576
24576
  );
@@ -24739,7 +24739,7 @@ const F7 = ({
24739
24739
  d - c.length - 3
24740
24740
  )}...${c}`;
24741
24741
  }, o = () => {
24742
- s(xs({ fileName: n, fileURL: e, mimetype: i })), s(Re(me.FILE_PREVIEW));
24742
+ s(xs({ fileName: n, fileURL: e, mimetype: i })), s(Pe(me.FILE_PREVIEW));
24743
24743
  };
24744
24744
  return /* @__PURE__ */ S(_5, { onClick: o, children: [
24745
24745
  /* @__PURE__ */ u(q5, { children: r ? /* @__PURE__ */ u(
@@ -24771,7 +24771,7 @@ const F7 = ({
24771
24771
  locationPreview: t
24772
24772
  }) => {
24773
24773
  const r = we(), s = () => {
24774
- r(xs({ fileName: e, fileURL: n, mimetype: i })), r(Re(me.FILE_PREVIEW));
24774
+ r(xs({ fileName: e, fileURL: n, mimetype: i })), r(Pe(me.FILE_PREVIEW));
24775
24775
  };
24776
24776
  return /* @__PURE__ */ u(W5, { children: n ? /* @__PURE__ */ u(
24777
24777
  "img",
@@ -29382,7 +29382,7 @@ const K8 = T.div`
29382
29382
  }, b = () => {
29383
29383
  m.current && (clearTimeout(m.current), m.current = null);
29384
29384
  }, x = (y) => {
29385
- y?.name !== "Deleted User" && (o(Re(me.PROFILE)), o(YA(y)));
29385
+ y?.name !== "Deleted User" && (o(Pe(me.PROFILE)), o(YA(y)));
29386
29386
  }, C = () => {
29387
29387
  if (o(Wn({ isEdit: !1 })), !i && n.mainMessage) {
29388
29388
  const y = JSON.parse(n.mainMessage);
@@ -29799,7 +29799,7 @@ const K8 = T.div`
29799
29799
  right: 0;
29800
29800
  }
29801
29801
  `, Ex = ({ children: n, modal: e, setOpenModal: i }) => {
29802
- const t = we(), r = () => i(), s = () => t(Re(me.SETTINGS));
29802
+ const t = we(), r = () => i(), s = () => t(Pe(me.SETTINGS));
29803
29803
  return e && /* @__PURE__ */ S(qi, { id: "modal-background", style: { position: "absolute" }, children: [
29804
29804
  (() => {
29805
29805
  const A = w7[e];
@@ -30251,7 +30251,7 @@ function NA(n, e) {
30251
30251
  const i = n.split("@")[0].trim();
30252
30252
  if (Array.isArray(e)) {
30253
30253
  for (const t of e)
30254
- if (console.log("check", i === t.name), t && typeof t.name == "string" && t.name === i)
30254
+ if (t && typeof t.name == "string" && t.name === i)
30255
30255
  return !0;
30256
30256
  } else
30257
30257
  for (const t in e) {
@@ -30293,7 +30293,12 @@ const Gx = ({
30293
30293
  d && b.xmppPassword === "" && (console.log("closing client"), d.close(), c(null));
30294
30294
  }, [b.xmppPassword]);
30295
30295
  const x = async () => {
30296
- if (f(!0), !await Lx(
30296
+ if (f(!0), t(
30297
+ Re({
30298
+ loading: !0,
30299
+ loadingText: i?.enableRoomsRetry?.helperText || "Polling rooms"
30300
+ })
30301
+ ), !await Lx(
30297
30302
  d,
30298
30303
  i,
30299
30304
  h,
@@ -30305,10 +30310,10 @@ const Gx = ({
30305
30310
  f(!1);
30306
30311
  }, C = async (k, w = !1) => {
30307
30312
  !w && t(
30308
- Qe({ loading: !0, loadingText: "Loading rooms..." })
30313
+ Re({ loading: !0, loadingText: "Loading rooms..." })
30309
30314
  );
30310
30315
  const g = await h(k, i);
30311
- return t(Qe({ loading: !1, loadingText: void 0 })), g;
30316
+ return t(Re({ loading: !1, loadingText: void 0 })), g;
30312
30317
  };
30313
30318
  return fe(() => {
30314
30319
  (async () => {
@@ -30333,7 +30338,7 @@ const Gx = ({
30333
30338
  i?.xmppSettings,
30334
30339
  p
30335
30340
  ).then((g) => g);
30336
- if (p && Object.keys(p).length > 0)
30341
+ if (p && Object.keys(p).length > 0 && !i?.disableRooms)
30337
30342
  s(!0), await ah(w, p);
30338
30343
  else if (i?.newArch) {
30339
30344
  const g = await C(w);
@@ -30349,9 +30354,9 @@ const Gx = ({
30349
30354
  }
30350
30355
  ), i?.refreshTokens?.enabled && Zo();
30351
30356
  }
30352
- t(Qe({ loading: !1 }));
30357
+ t(Re({ loading: !1 }));
30353
30358
  } catch (w) {
30354
- A(!0), s(!1), t(Qe({ loading: !1 })), console.log(w);
30359
+ A(!0), s(!1), t(Re({ loading: !1 })), console.log(w);
30355
30360
  }
30356
30361
  })();
30357
30362
  }, [b.xmppPassword, b.defaultWallet?.walletAddress]), {
@@ -30391,7 +30396,7 @@ const Gx = ({
30391
30396
  (O) => O?.activeMessage
30392
30397
  );
30393
30398
  }, [p, b]), y = (O) => {
30394
- b !== O.jid && (c(Qe({ chatJID: O.jid, loading: !0 })), c(Ye({ roomJID: O.jid })), c(Wn({ isEdit: !1 })), m(!0));
30399
+ b !== O.jid && (c(Re({ chatJID: O.jid, loading: !0 })), c(Ye({ roomJID: O.jid })), c(Wn({ isEdit: !1 })), m(!0));
30395
30400
  }, I = () => {
30396
30401
  E.deleteMessageStanza(a.roomJid, a.messageId), c(Ur({ isDeleteModal: !1 }));
30397
30402
  }, D = () => {
@@ -30496,7 +30501,7 @@ const Gx = ({
30496
30501
  Ex,
30497
30502
  {
30498
30503
  modal: s,
30499
- setOpenModal: (O) => c(Re(O))
30504
+ setOpenModal: (O) => c(Pe(O))
30500
30505
  }
30501
30506
  )
30502
30507
  ]