@codingfactory/messenger-client 0.2.27 → 0.2.28

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as be, getCurrentInstance as qt, computed as se, watch as ot, onUnmounted as qe, toValue as ss, onMounted as zt } from "vue";
1
+ import { ref as be, getCurrentInstance as qt, computed as se, watch as at, onUnmounted as qe, toValue as ss, onMounted as zt } from "vue";
2
2
  import { defineStore as Oi, storeToRefs as Fi } from "pinia";
3
3
  import jt, { isAxiosError as Di, AxiosHeaders as Tn } from "axios";
4
4
  import { isAxiosError as vc } from "axios";
@@ -29,7 +29,7 @@ const rs = () => () => {
29
29
  unsubscribeFromConversation: us,
30
30
  subscribeToTyping: hs,
31
31
  unsubscribeFromTyping: ls
32
- }, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ps = async () => H.waitForEcho(), gs = () => H.getConnectionStatus(), En = () => gs(), Ut = () => H.getAccessState(), dt = (e) => H.onConnectionStatusChange(e), qi = (e) => H.onAccessStateChange(e), zi = async () => {
32
+ }, Ke = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ps = async () => H.waitForEcho(), gs = () => H.getConnectionStatus(), En = () => gs(), Ut = () => H.getAccessState(), dt = (e) => H.onConnectionStatusChange(e), qi = (e) => H.onAccessStateChange(e), zi = async () => {
33
33
  await H.reconnect();
34
34
  }, ji = (e) => H.subscribeToPresenceStatus(e), $i = () => H.unsubscribeFromPresenceStatus(), Hi = (e, n) => H.subscribeToConversation(e, n), Bi = (e) => H.unsubscribeFromConversation(e), Vi = (e, n) => H.subscribeToTyping(e, n), Xi = (e) => H.unsubscribeFromTyping(e);
35
35
  function Wi(e) {
@@ -131,7 +131,7 @@ function _s(e) {
131
131
  function He(e) {
132
132
  return !_s(e) || !("data" in e) ? e : e.data;
133
133
  }
134
- function nt(e, n) {
134
+ function st(e, n) {
135
135
  const r = e[n];
136
136
  if (typeof r != "string")
137
137
  throw new Error(`Invalid messaging folder payload: missing string ${n}`);
@@ -160,15 +160,15 @@ function Ot(e) {
160
160
  if (!_s(e))
161
161
  throw new Error("Invalid messaging folder payload: expected object");
162
162
  return {
163
- id: nt(e, "id"),
164
- name: nt(e, "name"),
163
+ id: st(e, "id"),
164
+ name: st(e, "name"),
165
165
  color: An(e, "color"),
166
166
  icon: An(e, "icon"),
167
167
  sort_order: At(e, "sort_order"),
168
168
  conversation_count: At(e, "conversation_count"),
169
169
  unread_count: At(e, "unread_count"),
170
- created_at: nt(e, "created_at"),
171
- updated_at: nt(e, "updated_at")
170
+ created_at: st(e, "created_at"),
171
+ updated_at: st(e, "updated_at")
172
172
  };
173
173
  }
174
174
  function ho(e) {
@@ -351,7 +351,7 @@ function Po(e) {
351
351
  ...r ? { handle: r } : {}
352
352
  };
353
353
  }
354
- function at(e) {
354
+ function ct(e) {
355
355
  const n = e.shared_post, r = e.author, o = n && typeof n == "object" ? {
356
356
  id: n.id ?? "",
357
357
  title: n.title ?? "",
@@ -449,7 +449,7 @@ function Lo(e, n) {
449
449
  return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
450
450
  }
451
451
  function Be(e, n) {
452
- const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, R = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
452
+ const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? ct(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, R = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
453
453
  if (!n || n.unread_count !== 0 || d <= 0)
454
454
  return !1;
455
455
  const E = n.last_message?.id, b = e.last_message?.id;
@@ -517,7 +517,7 @@ function Oo(e, n) {
517
517
  if (!(typeof o != "string" || o.length === 0))
518
518
  return o;
519
519
  }
520
- function st(e, n) {
520
+ function rt(e, n) {
521
521
  const r = ue(e) ? e : {}, o = r.data ?? e;
522
522
  let c = [];
523
523
  return Array.isArray(o) ? c = o : ue(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
@@ -629,13 +629,13 @@ async function zn(e) {
629
629
  } : c;
630
630
  });
631
631
  }
632
- function ct(e, n) {
632
+ function We(e, n) {
633
633
  if (e.is_pinned !== n.is_pinned)
634
634
  return e.is_pinned ? -1 : 1;
635
635
  const r = e.last_message_at ?? e.created_at, c = (n.last_message_at ?? n.created_at).localeCompare(r);
636
636
  return c !== 0 ? c : e.id.localeCompare(n.id);
637
637
  }
638
- function rt(e, n) {
638
+ function it(e, n) {
639
639
  return [n, ...e.filter((r) => r.id !== n.id)];
640
640
  }
641
641
  function Ve(e) {
@@ -680,7 +680,7 @@ function Mt(e) {
680
680
  r.is_request === !0 && n.set(r.id, r);
681
681
  for (const r of e.conversations)
682
682
  r.is_request === !0 && n.set(r.id, r);
683
- return Array.from(n.values()).sort(ct);
683
+ return Array.from(n.values()).sort(We);
684
684
  }
685
685
  const Kt = Oi("messaging", {
686
686
  state: () => ({
@@ -703,7 +703,8 @@ const Kt = Oi("messaging", {
703
703
  backgroundPollTransientFailureCount: 0,
704
704
  _pendingSendIds: /* @__PURE__ */ new Set(),
705
705
  _activeDetailSubscriptions: /* @__PURE__ */ new Set(),
706
- _activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set()
706
+ _activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set(),
707
+ activeListFilter: void 0
707
708
  }),
708
709
  getters: {
709
710
  getConversationById: (e) => (n) => {
@@ -821,7 +822,7 @@ const Kt = Oi("messaging", {
821
822
  return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), xn();
822
823
  const c = o?.includePresence ?? !0, u = {};
823
824
  c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
824
- const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
825
+ const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = rt(
825
826
  d.data,
826
827
  "conversations"
827
828
  ), R = f.map((E) => {
@@ -846,7 +847,7 @@ const Kt = Oi("messaging", {
846
847
  if (Date.now() < this.backgroundPollRetryAfterUntil)
847
848
  return !1;
848
849
  try {
849
- return await this.fetchConversations(void 0, void 0, void 0, {
850
+ return await this.fetchConversations(void 0, this.activeListFilter, void 0, {
850
851
  background: !0,
851
852
  includePresence: !1
852
853
  }), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
@@ -884,7 +885,7 @@ const Kt = Oi("messaging", {
884
885
  filter: "requests"
885
886
  };
886
887
  e && (n.cursor = e);
887
- const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
888
+ const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = rt(
888
889
  r.data,
889
890
  "conversations"
890
891
  ), u = o.map((h) => {
@@ -917,10 +918,10 @@ const Kt = Oi("messaging", {
917
918
  throw v;
918
919
  o += 1, await kn(Co(v));
919
920
  }
920
- const { items: u, nextCursor: d } = st(
921
+ const { items: u, nextCursor: d } = rt(
921
922
  c.data,
922
923
  "messages"
923
- ), f = u.map(at), h = [...f].reverse();
924
+ ), f = u.map(ct), h = [...f].reverse();
924
925
  if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
925
926
  const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
926
927
  return v ? !v.last_message || !v.last_message_at : !1;
@@ -987,7 +988,7 @@ const Kt = Oi("messaging", {
987
988
  ...A,
988
989
  type: "text"
989
990
  });
990
- const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
991
+ const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = ct(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
991
992
  O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
992
993
  const z = m.id;
993
994
  let J = 0;
@@ -1131,17 +1132,19 @@ const Kt = Oi("messaging", {
1131
1132
  }
1132
1133
  },
1133
1134
  async pinConversation(e, n) {
1135
+ const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
1136
+ r && (r.is_pinned = n), this.conversations.sort(We);
1134
1137
  try {
1135
1138
  await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1136
- const r = this.conversations.find((o) => o.id === e);
1137
- r && (r.is_pinned = n), this.conversations.sort(ct);
1138
- } catch (r) {
1139
- throw this.error = Y(r), r;
1139
+ } catch (c) {
1140
+ throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(We)), this.error = Y(c), c;
1140
1141
  }
1141
1142
  },
1142
1143
  async archiveConversation(e, n) {
1143
1144
  try {
1144
- await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((r) => r.id !== e);
1145
+ await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
1146
+ const r = this.conversations.find((o) => o.id === e);
1147
+ r && (r.is_archived = n);
1145
1148
  } catch (r) {
1146
1149
  throw this.error = Y(r), r;
1147
1150
  }
@@ -1163,7 +1166,7 @@ const Kt = Oi("messaging", {
1163
1166
  if (!Fn(c))
1164
1167
  throw new Error("Invalid conversation payload from DM create endpoint.");
1165
1168
  let u = Dn(c) && Jt(c, e) ? Be(c) : await this.fetchConversation(c.id);
1166
- return u = await qn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
1169
+ return u = await qn(u, e), u.is_request === !0 ? (this.requests = it(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = it(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
1167
1170
  } catch (r) {
1168
1171
  throw this.error = Y(r), r;
1169
1172
  }
@@ -1177,7 +1180,7 @@ const Kt = Oi("messaging", {
1177
1180
  if (!Fn(o))
1178
1181
  throw new Error("Invalid conversation payload from group create endpoint.");
1179
1182
  const c = Dn(o) ? o : await this.fetchConversation(o.id);
1180
- return this.conversations = rt(this.conversations, c), c;
1183
+ return this.conversations = it(this.conversations, c), c;
1181
1184
  } catch (r) {
1182
1185
  throw this.error = Y(r), r;
1183
1186
  }
@@ -1225,7 +1228,7 @@ const Kt = Oi("messaging", {
1225
1228
  if (!n)
1226
1229
  return;
1227
1230
  this.messages[n] || (this.messages[n] = []);
1228
- const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1231
+ const r = ct({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1229
1232
  if (o.find((R) => R.id === r.id))
1230
1233
  return;
1231
1234
  const u = ke()();
@@ -1349,7 +1352,7 @@ const Kt = Oi("messaging", {
1349
1352
  const d = u.find((f) => f.id === e);
1350
1353
  return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
1351
1354
  }, o = r(this.conversations), c = r(this.requests);
1352
- o && this.conversations.sort(ct), c && this.requests.sort(ct);
1355
+ o && this.conversations.sort(We), c && this.requests.sort(We);
1353
1356
  },
1354
1357
  updatePresenceForUser(e, n, r) {
1355
1358
  const o = n === "online" || n === "idle" || n === "dnd", c = (u) => {
@@ -1382,7 +1385,7 @@ const Kt = Oi("messaging", {
1382
1385
  is_archived: n.is_archived ?? !1,
1383
1386
  is_muted: n.is_muted ?? !1
1384
1387
  });
1385
- this.conversations = rt(this.conversations, r);
1388
+ this.conversations = it(this.conversations, r);
1386
1389
  } catch (n) {
1387
1390
  throw this.error = Y(n), n;
1388
1391
  }
@@ -1401,7 +1404,7 @@ const Kt = Oi("messaging", {
1401
1404
  n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
1402
1405
  const c = await X().get("/v1/messaging/conversations", {
1403
1406
  params: o
1404
- }), { items: u } = st(
1407
+ }), { items: u } = rt(
1405
1408
  c.data,
1406
1409
  "conversations"
1407
1410
  );
@@ -1541,7 +1544,7 @@ function oc(e) {
1541
1544
  function K() {
1542
1545
  o.value || I();
1543
1546
  }
1544
- typeof window < "u" && window.addEventListener(Je(), K);
1547
+ typeof window < "u" && window.addEventListener(Ke(), K);
1545
1548
  const V = dt((_) => {
1546
1549
  if (_ === "connected") {
1547
1550
  o.value || I();
@@ -1557,7 +1560,7 @@ function oc(e) {
1557
1560
  c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
1558
1561
  }
1559
1562
  }
1560
- return ot(
1563
+ return at(
1561
1564
  () => A(),
1562
1565
  (_, L) => {
1563
1566
  if (_ !== L) {
@@ -1569,7 +1572,7 @@ function oc(e) {
1569
1572
  }
1570
1573
  }
1571
1574
  ), d !== null && qe(() => {
1572
- w(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
1575
+ w(), V(), G(), typeof window < "u" && window.removeEventListener(Ke(), K);
1573
1576
  }), {
1574
1577
  isSubscribed: se(() => o.value),
1575
1578
  error: se(() => c.value),
@@ -1639,7 +1642,7 @@ function Bn(e) {
1639
1642
  }
1640
1643
  function Qo(e) {
1641
1644
  return e === "messenger" ? {
1642
- initializedEvent: Je(),
1645
+ initializedEvent: Ke(),
1643
1646
  getConnectionStatus: gs,
1644
1647
  onConnectionStatusChange: dt,
1645
1648
  reconnect: zi,
@@ -2001,19 +2004,19 @@ function cc() {
2001
2004
  function O() {
2002
2005
  C && ($i(), C = !1);
2003
2006
  }
2004
- const z = ot(
2007
+ const z = at(
2005
2008
  d,
2006
2009
  () => {
2007
2010
  w();
2008
2011
  },
2009
2012
  { deep: !1, immediate: !0 }
2010
- ), J = ot(
2013
+ ), J = at(
2011
2014
  f,
2012
2015
  () => {
2013
2016
  w();
2014
2017
  },
2015
2018
  { deep: !1, immediate: !0 }
2016
- ), W = ot(
2019
+ ), W = at(
2017
2020
  () => c.fullPath,
2018
2021
  () => {
2019
2022
  w();
@@ -2074,14 +2077,14 @@ function ca(e) {
2074
2077
  return e.authTokenResolver !== ks;
2075
2078
  }
2076
2079
  const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
2077
- function We(e) {
2080
+ function Ge(e) {
2078
2081
  return typeof e == "object" && e !== null;
2079
2082
  }
2080
2083
  function Ls(e) {
2081
- if (!We(e))
2084
+ if (!Ge(e))
2082
2085
  return null;
2083
2086
  const n = e.response;
2084
- if (!We(n))
2087
+ if (!Ge(n))
2085
2088
  return null;
2086
2089
  const r = n.status;
2087
2090
  if (typeof r == "number")
@@ -2093,13 +2096,13 @@ function Ls(e) {
2093
2096
  return null;
2094
2097
  }
2095
2098
  function Is(e) {
2096
- if (!We(e))
2099
+ if (!Ge(e))
2097
2100
  return null;
2098
2101
  const n = e.response;
2099
- if (!We(n))
2102
+ if (!Ge(n))
2100
2103
  return null;
2101
2104
  const r = n.data;
2102
- return We(r) && typeof r.code == "string" ? r.code : null;
2105
+ return Ge(r) && typeof r.code == "string" ? r.code : null;
2103
2106
  }
2104
2107
  function kt(e) {
2105
2108
  const n = Ls(e), r = Is(e);
@@ -2109,32 +2112,32 @@ function xt(e) {
2109
2112
  const n = Ls(e), r = Is(e);
2110
2113
  return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
2111
2114
  }
2112
- function Ke() {
2115
+ function Qe() {
2113
2116
  return typeof sessionStorage > "u" ? null : sessionStorage;
2114
2117
  }
2115
2118
  function va(e) {
2116
- const n = Ke(), r = n?.getItem(e);
2119
+ const n = Qe(), r = n?.getItem(e);
2117
2120
  if (r)
2118
2121
  return r;
2119
2122
  const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
2120
2123
  return n?.setItem(e, o), o;
2121
2124
  }
2122
2125
  function ba(e) {
2123
- const n = Ke(), r = n?.getItem(e);
2126
+ const n = Qe(), r = n?.getItem(e);
2124
2127
  if (!r)
2125
2128
  return null;
2126
2129
  const o = Number.parseInt(r, 10);
2127
2130
  return Number.isFinite(o) ? o : (n?.removeItem(e), null);
2128
2131
  }
2129
2132
  function Lt(e, n = Date.now()) {
2130
- const r = Ke(), o = ba(e);
2133
+ const r = Qe(), o = ba(e);
2131
2134
  return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
2132
2135
  }
2133
2136
  function ya(e, n = Date.now()) {
2134
- Ke()?.setItem(e, String(n + ma));
2137
+ Qe()?.setItem(e, String(n + ma));
2135
2138
  }
2136
2139
  function _a(e) {
2137
- Ke()?.removeItem(e);
2140
+ Qe()?.removeItem(e);
2138
2141
  }
2139
2142
  function Sa(e) {
2140
2143
  return e.startsWith("/v1/") ? `/api${e}` : e;
@@ -2424,7 +2427,7 @@ function dc(e) {
2424
2427
  }), D = se(() => Se.value.length > 0), q = () => {
2425
2428
  m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
2426
2429
  };
2427
- typeof window < "u" && window.addEventListener(Je(), q);
2430
+ typeof window < "u" && window.addEventListener(Ke(), q);
2428
2431
  const _e = dt((M) => {
2429
2432
  if (M === "connected") {
2430
2433
  o.value || G();
@@ -2437,7 +2440,7 @@ function dc(e) {
2437
2440
  }
2438
2441
  });
2439
2442
  return h !== null && qe(() => {
2440
- K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Je(), q);
2443
+ K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Ke(), q);
2441
2444
  }), {
2442
2445
  isSubscribed: se(() => o.value),
2443
2446
  error: se(() => c.value),
@@ -2905,7 +2908,7 @@ qs._defaultOptions = {
2905
2908
  namespace: "App.Events"
2906
2909
  };
2907
2910
  let nn = qs;
2908
- class it extends nn {
2911
+ class ot extends nn {
2909
2912
  constructor() {
2910
2913
  super(...arguments), this.channels = {};
2911
2914
  }
@@ -3256,14 +3259,14 @@ class Ia {
3256
3259
  */
3257
3260
  connect() {
3258
3261
  if (this.options.broadcaster === "reverb")
3259
- this.connector = new it({
3262
+ this.connector = new ot({
3260
3263
  ...this.options,
3261
3264
  cluster: ""
3262
3265
  });
3263
3266
  else if (this.options.broadcaster === "pusher")
3264
- this.connector = new it(this.options);
3267
+ this.connector = new ot(this.options);
3265
3268
  else if (this.options.broadcaster === "ably")
3266
- this.connector = new it({
3269
+ this.connector = new ot({
3267
3270
  ...this.options,
3268
3271
  cluster: "",
3269
3272
  broadcaster: "pusher"
@@ -3335,7 +3338,7 @@ class Ia {
3335
3338
  );
3336
3339
  }
3337
3340
  connectorSupportsEncryptedPrivateChannels(n) {
3338
- return n instanceof it || n instanceof Xn;
3341
+ return n instanceof ot || n instanceof Xn;
3339
3342
  }
3340
3343
  /**
3341
3344
  * Get the Socket ID for the connection.
@@ -3914,7 +3917,7 @@ function Oa() {
3914
3917
  }
3915
3918
  function ht() {
3916
3919
  for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
3917
- typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
3920
+ typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Ye(arguments[t]));
3918
3921
  return i.join(" : ");
3919
3922
  }
3920
3923
  function ze(i, t) {
@@ -3993,7 +3996,7 @@ function Oa() {
3993
3996
  }
3994
3997
  function ve(i) {
3995
3998
  return re(i, function(t) {
3996
- return typeof t == "object" && (t = Qe(t)), encodeURIComponent(V(t.toString()));
3999
+ return typeof t == "object" && (t = Ye(t)), encodeURIComponent(V(t.toString()));
3997
4000
  });
3998
4001
  }
3999
4002
  function js(i) {
@@ -4029,7 +4032,7 @@ function Oa() {
4029
4032
  }
4030
4033
  })(i, "$");
4031
4034
  }
4032
- function Qe(i) {
4035
+ function Ye(i) {
4033
4036
  try {
4034
4037
  return JSON.stringify(i);
4035
4038
  } catch {
@@ -4340,7 +4343,7 @@ function Oa() {
4340
4343
  ws: nr,
4341
4344
  xhr_streaming: sr,
4342
4345
  xhr_polling: rr
4343
- }, Ye = ir, or = new De({
4346
+ }, Ze = ir, or = new De({
4344
4347
  file: "sockjs",
4345
4348
  urls: Zs,
4346
4349
  handlesActivityChecks: !0,
@@ -4370,8 +4373,8 @@ function Oa() {
4370
4373
  return t;
4371
4374
  }
4372
4375
  }, ar = new De(me({}, rn, cn)), cr = new De(me({}, on, cn));
4373
- Ye.xdr_streaming = ar, Ye.xdr_polling = cr, Ye.sockjs = or;
4374
- var ur = Ye;
4376
+ Ze.xdr_streaming = ar, Ze.xdr_polling = cr, Ze.sockjs = or;
4377
+ var ur = Ze;
4375
4378
  class lr extends Te {
4376
4379
  constructor() {
4377
4380
  super();
@@ -5182,8 +5185,8 @@ function Oa() {
5182
5185
  failFast: !0
5183
5186
  }))) : g++);
5184
5187
  }
5185
- var j = le.now(), Q = S.pop().connect(t, function ee(ce, tt) {
5186
- ce ? (dn(a), S.length > 0 ? (j = le.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (kr(a, tt.transport.name, le.now() - j, g), s(null, tt));
5188
+ var j = le.now(), Q = S.pop().connect(t, function ee(ce, nt) {
5189
+ ce ? (dn(a), S.length > 0 ? (j = le.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (kr(a, nt.transport.name, le.now() - j, g), s(null, nt));
5187
5190
  });
5188
5191
  return {
5189
5192
  abort: function() {
@@ -5214,7 +5217,7 @@ function Oa() {
5214
5217
  var l = $.getLocalStorage();
5215
5218
  if (l)
5216
5219
  try {
5217
- l[_t(i)] = Qe({
5220
+ l[_t(i)] = Ye({
5218
5221
  timestamp: le.now(),
5219
5222
  transport: t,
5220
5223
  latency: s,
@@ -5231,7 +5234,7 @@ function Oa() {
5231
5234
  } catch {
5232
5235
  }
5233
5236
  }
5234
- class Ze {
5237
+ class et {
5235
5238
  constructor(t, { delay: s }) {
5236
5239
  this.strategy = t, this.options = { delay: s };
5237
5240
  }
@@ -5311,23 +5314,23 @@ function Oa() {
5311
5314
  lives: 2,
5312
5315
  minPingDelay: 1e4,
5313
5316
  maxPingDelay: i.activityTimeout
5314
- }), ce = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Ai = l("sockjs", "sockjs", 1, x), mn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Ri = l("xdr_streaming", "xdr_streaming", 1, x, ee), vn = l("xhr_polling", "xhr_polling", 1, x), Pi = l("xdr_polling", "xdr_polling", 1, x), bn = new Ue([ce], j), Mi = new Ue([tt], j), ki = new Ue([Ai], j), yn = new Ue([
5317
+ }), ce = l("ws", "ws", 3, g, Q), nt = l("wss", "ws", 3, S, Q), Ai = l("sockjs", "sockjs", 1, x), mn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Ri = l("xdr_streaming", "xdr_streaming", 1, x, ee), vn = l("xhr_polling", "xhr_polling", 1, x), Pi = l("xdr_polling", "xdr_polling", 1, x), bn = new Ue([ce], j), Mi = new Ue([nt], j), ki = new Ue([Ai], j), yn = new Ue([
5315
5318
  new je($e(mn), mn, Ri)
5316
5319
  ], j), _n = new Ue([
5317
5320
  new je($e(vn), vn, Pi)
5318
5321
  ], j), Sn = new Ue([
5319
5322
  new je($e(yn), new yt([
5320
5323
  yn,
5321
- new Ze(_n, { delay: 4e3 })
5324
+ new et(_n, { delay: 4e3 })
5322
5325
  ]), _n)
5323
5326
  ], j), Tt = new je($e(Sn), Sn, ki), Et;
5324
5327
  return t.useTLS ? Et = new yt([
5325
5328
  bn,
5326
- new Ze(Tt, { delay: 2e3 })
5329
+ new et(Tt, { delay: 2e3 })
5327
5330
  ]) : Et = new yt([
5328
5331
  bn,
5329
- new Ze(Mi, { delay: 2e3 }),
5330
- new Ze(Tt, { delay: 5e3 })
5332
+ new et(Mi, { delay: 2e3 }),
5333
+ new et(Tt, { delay: 5e3 })
5331
5334
  ]), new Pr(new xr(new je($e(ce), Et, Tt)), a, {
5332
5335
  ttl: 18e5,
5333
5336
  timeline: t.timeline,
@@ -5669,7 +5672,7 @@ function Oa() {
5669
5672
  (function(i) {
5670
5673
  i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
5671
5674
  })(Ct || (Ct = {}));
5672
- var et = Ct;
5675
+ var tt = Ct;
5673
5676
  class ti {
5674
5677
  constructor(t, s, a) {
5675
5678
  this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
@@ -5678,13 +5681,13 @@ function Oa() {
5678
5681
  t <= this.options.level && (this.events.push(me({}, s, { timestamp: le.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5679
5682
  }
5680
5683
  error(t) {
5681
- this.log(et.ERROR, t);
5684
+ this.log(tt.ERROR, t);
5682
5685
  }
5683
5686
  info(t) {
5684
- this.log(et.INFO, t);
5687
+ this.log(tt.INFO, t);
5685
5688
  }
5686
5689
  debug(t) {
5687
- this.log(et.DEBUG, t);
5690
+ this.log(tt.DEBUG, t);
5688
5691
  }
5689
5692
  isEmpty() {
5690
5693
  return this.events.length === 0;
@@ -5733,7 +5736,7 @@ function Oa() {
5733
5736
  }, Q = function() {
5734
5737
  ee();
5735
5738
  var ce;
5736
- ce = Qe(l), s(new z(ce));
5739
+ ce = Ye(l), s(new z(ce));
5737
5740
  }, ee = function() {
5738
5741
  l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
5739
5742
  };
@@ -5998,7 +6001,7 @@ function Oa() {
5998
6001
  features: ge.getClientFeatures(),
5999
6002
  params: this.config.timelineParams || {},
6000
6003
  limit: 50,
6001
- level: et.INFO,
6004
+ level: tt.INFO,
6002
6005
  version: h.VERSION
6003
6006
  }), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
6004
6007
  host: this.config.statsHost,
@@ -6203,7 +6206,7 @@ function Gn(e, n) {
6203
6206
  "X-Requested-With": "XMLHttpRequest"
6204
6207
  }), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
6205
6208
  }
6206
- function Ge(e, n, r) {
6209
+ function Je(e, n, r) {
6207
6210
  const o = e[n];
6208
6211
  if (typeof o == "string" && o.trim() !== "")
6209
6212
  return o;
@@ -6219,14 +6222,14 @@ function Ga(e) {
6219
6222
  function Ja(e, n) {
6220
6223
  if (!ie(e))
6221
6224
  return null;
6222
- const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
6225
+ const r = Je(e, "user_id", "userId"), o = Ga(e.status);
6223
6226
  if (!r || !o)
6224
6227
  return null;
6225
6228
  const c = {
6226
6229
  user_id: r,
6227
- tenant_scope: Ge(e, "tenant_scope", "tenantScope") ?? n,
6230
+ tenant_scope: Je(e, "tenant_scope", "tenantScope") ?? n,
6228
6231
  status: o,
6229
- ts: Ge(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
6232
+ ts: Je(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
6230
6233
  }, u = e.tenant_id ?? e.tenantId;
6231
6234
  typeof u == "string" ? c.tenant_id = u : u === null && (c.tenant_id = null);
6232
6235
  const d = e.last_seen_at ?? e.lastSeenAt;
@@ -6235,7 +6238,7 @@ function Ja(e, n) {
6235
6238
  function Jn(e) {
6236
6239
  if (!ie(e))
6237
6240
  return null;
6238
- const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
6241
+ const n = Je(e, "user_id", "userId"), r = Je(e, "conversation_id", "conversationId");
6239
6242
  if (!n || !r)
6240
6243
  return null;
6241
6244
  const o = e.user, c = ie(o) ? {
@@ -6623,7 +6626,7 @@ export {
6623
6626
  En as getConnectionStatus,
6624
6627
  Ae as getEcho,
6625
6628
  gs as getEchoConnectionStatus,
6626
- Je as getEchoInitializedEvent,
6629
+ Ke as getEchoInitializedEvent,
6627
6630
  Y as getErrorMessage,
6628
6631
  Yt as getLoggerFactory,
6629
6632
  Bt as getMainApi,
@@ -150,6 +150,7 @@ interface MessagingState {
150
150
  _pendingSendIds: Set<string>;
151
151
  _activeDetailSubscriptions: Set<string>;
152
152
  _activeGlobalConversationSubscriptions: Set<string>;
153
+ activeListFilter: ConversationListFilter | undefined;
153
154
  }
154
155
  export declare const useMessagingStore: import("pinia").StoreDefinition<"messaging", MessagingState, {
155
156
  getConversationById: (state: {
@@ -407,6 +408,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
407
408
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
408
409
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
409
410
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
411
+ activeListFilter: ConversationListFilter | undefined;
410
412
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (id: string) => Conversation | undefined;
411
413
  getMessagesByConversationId: (state: {
412
414
  conversations: {
@@ -663,6 +665,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
663
665
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
664
666
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
665
667
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
668
+ activeListFilter: ConversationListFilter | undefined;
666
669
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (conversationId: string) => Message[];
667
670
  getTypingUsers: (state: {
668
671
  conversations: {
@@ -919,6 +922,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
919
922
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
920
923
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
921
924
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
925
+ activeListFilter: ConversationListFilter | undefined;
922
926
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (conversationId: string) => TypingUser[];
923
927
  unreadConversationsCount: (state: {
924
928
  conversations: {
@@ -1175,6 +1179,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
1175
1179
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
1176
1180
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1177
1181
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1182
+ activeListFilter: ConversationListFilter | undefined;
1178
1183
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => number;
1179
1184
  unreadCount: (state: {
1180
1185
  conversations: {
@@ -1431,6 +1436,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
1431
1436
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
1432
1437
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1433
1438
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1439
+ activeListFilter: ConversationListFilter | undefined;
1434
1440
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => number;
1435
1441
  totalUnreadCount: (state: {
1436
1442
  conversations: {
@@ -1687,6 +1693,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
1687
1693
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
1688
1694
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1689
1695
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1696
+ activeListFilter: ConversationListFilter | undefined;
1690
1697
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => number;
1691
1698
  sortedFolders: (state: {
1692
1699
  conversations: {
@@ -1943,6 +1950,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
1943
1950
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
1944
1951
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1945
1952
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
1953
+ activeListFilter: ConversationListFilter | undefined;
1946
1954
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => ConversationFolder[];
1947
1955
  folderById: (state: {
1948
1956
  conversations: {
@@ -2199,6 +2207,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
2199
2207
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
2200
2208
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2201
2209
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2210
+ activeListFilter: ConversationListFilter | undefined;
2202
2211
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (id: string) => ConversationFolder | undefined;
2203
2212
  conversationsInFolder: (state: {
2204
2213
  conversations: {
@@ -2455,6 +2464,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
2455
2464
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
2456
2465
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2457
2466
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2467
+ activeListFilter: ConversationListFilter | undefined;
2458
2468
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (folderId: string) => Conversation[];
2459
2469
  hasMoreMessages: (state: {
2460
2470
  conversations: {
@@ -2711,6 +2721,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
2711
2721
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
2712
2722
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2713
2723
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2724
+ activeListFilter: ConversationListFilter | undefined;
2714
2725
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (conversationId: string) => boolean;
2715
2726
  isLoadingMessages: (state: {
2716
2727
  conversations: {
@@ -2967,6 +2978,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
2967
2978
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
2968
2979
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2969
2980
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
2981
+ activeListFilter: ConversationListFilter | undefined;
2970
2982
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => (conversationId: string) => boolean;
2971
2983
  requestConversations: (state: {
2972
2984
  conversations: {
@@ -3223,6 +3235,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
3223
3235
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
3224
3236
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3225
3237
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3238
+ activeListFilter: ConversationListFilter | undefined;
3226
3239
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => Conversation[];
3227
3240
  requestCount: (state: {
3228
3241
  conversations: {
@@ -3479,6 +3492,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
3479
3492
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
3480
3493
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3481
3494
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3495
+ activeListFilter: ConversationListFilter | undefined;
3482
3496
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => number;
3483
3497
  unreadRequestCount: (state: {
3484
3498
  conversations: {
@@ -3735,6 +3749,7 @@ export declare const useMessagingStore: import("pinia").StoreDefinition<"messagi
3735
3749
  _pendingSendIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
3736
3750
  _activeDetailSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3737
3751
  _activeGlobalConversationSubscriptions: Set<string> & Omit<Set<string>, keyof Set<any>>;
3752
+ activeListFilter: ConversationListFilter | undefined;
3738
3753
  } & import("pinia").PiniaCustomStateProperties<MessagingState>) => number;
3739
3754
  }, {
3740
3755
  normalizeFolderAssignmentsState(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingfactory/messenger-client",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "Shared messaging frontend state, API helpers, and realtime composables.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",