@ethora/chat-component 24.11.11 → 24.11.13

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
@@ -5134,24 +5134,27 @@ const Iu = async (t, e, n, r) => {
5134
5134
  }
5135
5135
  }, aw = (t, e) => {
5136
5136
  var n, r;
5137
- t.attrs.id === "getUserRooms" && ((n = t.getChild("query")) != null && n.children) && ((r = t.getChild("query")) == null || r.children.forEach((s) => {
5138
- var a, c;
5139
- const o = le.getState().rooms.rooms, i = Object.values(o).filter(
5140
- (u) => u.jid === (s == null ? void 0 : s.attrs.jid)
5141
- );
5142
- if (i.length === 0 || i[0]) {
5143
- const u = {
5144
- jid: (a = s == null ? void 0 : s.attrs) == null ? void 0 : a.jid,
5137
+ t.attrs.id === "getUserRooms" && Array.isArray((n = t.getChild("query")) == null ? void 0 : n.children) && ((r = t.getChild("query")) == null || r.children.forEach((s) => {
5138
+ var a, c, u, l, d, f, p, h;
5139
+ const o = le.getState().rooms.rooms;
5140
+ if (!Object.values(o).some(
5141
+ (y) => {
5142
+ var v;
5143
+ return y.jid === ((v = s == null ? void 0 : s.attrs) == null ? void 0 : v.jid);
5144
+ }
5145
+ )) {
5146
+ const y = {
5147
+ jid: ((a = s == null ? void 0 : s.attrs) == null ? void 0 : a.jid) || "",
5145
5148
  name: ((c = s == null ? void 0 : s.attrs) == null ? void 0 : c.name) || "",
5146
5149
  id: "",
5147
- title: s == null ? void 0 : s.attrs.name,
5148
- usersCnt: Number(s == null ? void 0 : s.attrs.users_cnt),
5150
+ title: ((u = s == null ? void 0 : s.attrs) == null ? void 0 : u.name) || "",
5151
+ usersCnt: Number(((l = s == null ? void 0 : s.attrs) == null ? void 0 : l.users_cnt) || 0),
5149
5152
  messages: [],
5150
5153
  isLoading: !1,
5151
- roomBg: (s == null ? void 0 : s.attrs.room_background) !== "none" ? s == null ? void 0 : s.attrs.room_background : null,
5152
- icon: (s == null ? void 0 : s.attrs.room_thumbnail) !== "none" ? s == null ? void 0 : s.attrs.room_thumbnail : null
5154
+ roomBg: ((d = s == null ? void 0 : s.attrs) == null ? void 0 : d.room_background) !== "none" ? (f = s == null ? void 0 : s.attrs) == null ? void 0 : f.room_background : null,
5155
+ icon: ((p = s == null ? void 0 : s.attrs) == null ? void 0 : p.room_thumbnail) !== "none" ? (h = s == null ? void 0 : s.attrs) == null ? void 0 : h.room_thumbnail : null
5153
5156
  };
5154
- le.dispatch(_g({ roomData: u })), le.getState().rooms.activeRoomJID || le.dispatch(Ar({ roomJID: u == null ? void 0 : u.jid })), e.presenceInRoomStanza(s.attrs.jid);
5157
+ le.dispatch(_g({ roomData: y })), le.getState().rooms.activeRoomJID || le.dispatch(Ar({ roomJID: y.jid })), y.jid && e.presenceInRoomStanza(y.jid);
5155
5158
  }
5156
5159
  }));
5157
5160
  };
@@ -15865,7 +15868,7 @@ const Xc = ["#f44336", "#2196f3", "#4caf50", "#ff9800"], V4 = k.div`
15865
15868
  V4,
15866
15869
  {
15867
15870
  bgColor: r,
15868
- color: ((o) => ["#4caf50", "#ff9800"].includes(o) ? "#000" : "#fff")(r),
15871
+ color: ((o) => (["#4caf50", "#ff9800"].includes(o), "#fff"))(r),
15869
15872
  size: e,
15870
15873
  children: n()
15871
15874
  }
@@ -16273,11 +16276,15 @@ const Xc = ["#f44336", "#2196f3", "#4caf50", "#ff9800"], V4 = k.div`
16273
16276
  );
16274
16277
  ve(() => {
16275
16278
  if (l != null && l.setRoomJidInPath && c) {
16276
- const A = c.split("@")[0], S = `${window.location.origin}/${A}`;
16277
- window.history.pushState(null, "", S);
16279
+ const A = c.split("@")[0], D = `${window.location.pathname.split("/").slice(0, -1).join("/")}/${A}`;
16280
+ window.history.pushState(null, "", D);
16278
16281
  }
16279
16282
  return () => {
16280
- window.history.pushState(null, "", window.location.origin);
16283
+ window.history.pushState(
16284
+ null,
16285
+ "",
16286
+ window.location.pathname.split("/").slice(0, -1).join("/")
16287
+ );
16281
16288
  };
16282
16289
  }, [c]);
16283
16290
  const f = W(
@@ -16361,7 +16368,7 @@ const Xc = ["#f44336", "#2196f3", "#4caf50", "#ff9800"], V4 = k.div`
16361
16368
  });
16362
16369
  };
16363
16370
  n(nt({ loading: !0, chatJID: c })), ((D = Object.keys(o)) == null ? void 0 : D.length) > 0 && (!(o != null && o[c]) && Object.keys(o).length > 0 ? S() : d.length < 1 ? A() : n(nt({ loading: !1, chatJID: c })));
16364
- }, [c, Object.keys(o).length]), !c || ((m = Object.keys(o)) == null ? void 0 : m.length) < 1 || !(o != null && o[c]) ? (console.log({ activeRoomJID: c, roomsList: o }), /* @__PURE__ */ g(
16371
+ }, [c, Object.keys(o).length]), !c || ((m = Object.keys(o)) == null ? void 0 : m.length) < 1 || !(o != null && o[c]) ? /* @__PURE__ */ g(
16365
16372
  "div",
16366
16373
  {
16367
16374
  style: {
@@ -16372,7 +16379,7 @@ const Xc = ["#f44336", "#2196f3", "#4caf50", "#ff9800"], V4 = k.div`
16372
16379
  },
16373
16380
  children: /* @__PURE__ */ g(Sn, { color: (C = l == null ? void 0 : l.colors) == null ? void 0 : C.primary })
16374
16381
  }
16375
- )) : /* @__PURE__ */ P(
16382
+ ) : /* @__PURE__ */ P(
16376
16383
  Av,
16377
16384
  {
16378
16385
  style: {
@@ -18335,9 +18342,7 @@ const Nx = ({ src: t }) => {
18335
18342
  s && u(Ar({ roomJID: s })), u(qg(r)), u(nt({ loading: !0 })), (async () => {
18336
18343
  var b;
18337
18344
  try {
18338
- !l.defaultWallet || (l == null ? void 0 : l.defaultWallet.walletAddress) === "" ? (c(!0), console.log("Error, no user")) : y ? (y.getRooms().finally(() => {
18339
- i(!0);
18340
- }), Vo()) : (c(!1), console.log("No client, so initing one"), await v(
18345
+ !l.defaultWallet || (l == null ? void 0 : l.defaultWallet.walletAddress) === "" ? (c(!0), console.log("Error, no user")) : y ? (p || y.getRooms(), i(!0), Vo()) : (c(!1), console.log("No client, so initing one"), await v(
18341
18346
  (b = l.defaultWallet) == null ? void 0 : b.walletAddress,
18342
18347
  l.xmppPassword
18343
18348
  ).then((x) => {