@codingfactory/messenger-client 0.2.1 → 0.2.2

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/index.js +94 -91
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ref as de, getCurrentInstance as xt, computed as ie, onUnmounted as qe, toValue as Ln, onMounted as Un, watch as fn } from "vue";
2
2
  import { defineStore as ci, storeToRefs as ui } from "pinia";
3
3
  import Mt, { isAxiosError as li, AxiosHeaders as pn } from "axios";
4
- import { isAxiosError as $a } from "axios";
4
+ import { isAxiosError as Ha } from "axios";
5
5
  import { useRoute as hi } from "vue-router";
6
6
  const On = () => () => {
7
7
  }, Nn = async () => {
@@ -25,7 +25,7 @@ const On = () => () => {
25
25
  unsubscribeFromConversation: qn,
26
26
  subscribeToTyping: $n,
27
27
  unsubscribeFromTyping: zn
28
- }, De = () => G.ECHO_INITIALIZED_EVENT, Ae = () => G.getEcho(), Hn = () => G.getConnectionStatus(), xa = () => Hn(), it = (e) => G.onConnectionStatusChange(e), di = async () => {
28
+ }, De = () => G.ECHO_INITIALIZED_EVENT, Ae = () => G.getEcho(), Hn = () => G.getConnectionStatus(), Ma = () => Hn(), it = (e) => G.onConnectionStatusChange(e), di = async () => {
29
29
  await G.reconnect();
30
30
  }, fi = (e) => G.subscribeToPresenceStatus(e), pi = () => G.unsubscribeFromPresenceStatus(), gi = (e, n) => G.subscribeToConversation(e, n), mi = (e) => G.unsubscribeFromConversation(e), vi = (e, n) => G.subscribeToTyping(e, n), bi = (e) => G.unsubscribeFromTyping(e);
31
31
  function yi(e) {
@@ -77,10 +77,10 @@ function Q(e) {
77
77
  }
78
78
  return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
79
79
  }
80
- function Ma(e) {
80
+ function ka(e) {
81
81
  return e instanceof Error;
82
82
  }
83
- function ka(e) {
83
+ function Ia(e) {
84
84
  return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
85
85
  }
86
86
  const Xn = {
@@ -1177,7 +1177,7 @@ const Nt = ci("messaging", {
1177
1177
  }
1178
1178
  }
1179
1179
  });
1180
- function Ia(e) {
1180
+ function La(e) {
1181
1181
  const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = xt(), g = h !== null, d = 20, A = 250;
1182
1182
  let x = 0, m = null, y = null;
1183
1183
  const E = ie(() => i.currentUser?.id), R = () => Ln(e)?.trim() ?? "";
@@ -1360,7 +1360,7 @@ function co(e) {
1360
1360
  function Pn(e) {
1361
1361
  return e.getEchoConnection()?.state ?? null;
1362
1362
  }
1363
- function La(e = {}) {
1363
+ function Ua(e = {}) {
1364
1364
  const o = co(e.source ?? "app"), u = {
1365
1365
  ...ao,
1366
1366
  ...e.icons
@@ -1590,7 +1590,7 @@ function bo() {
1590
1590
  zt = ns;
1591
1591
  }
1592
1592
  const Ye = Dt()("GlobalMessaging"), yo = 3, _o = (e) => e.replace(/\/+$/, ""), So = (e) => _o(window.location.pathname) === `/messages/${e}`, wo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1593
- function Ua() {
1593
+ function Oa() {
1594
1594
  const e = Nt(), n = Pe()(), i = mo(), o = es(), u = hi(), l = xt(), { conversations: h } = ui(e), g = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map();
1595
1595
  let A = !1;
1596
1596
  function x(P) {
@@ -1825,7 +1825,10 @@ function No(e, n = Date.now()) {
1825
1825
  function Fo(e) {
1826
1826
  ze()?.removeItem(e);
1827
1827
  }
1828
- function Do(e, n, i) {
1828
+ function Do(e) {
1829
+ return e.startsWith("/v1/") ? `/api${e}` : e;
1830
+ }
1831
+ function qo(e, n, i) {
1829
1832
  if (typeof fetch > "u")
1830
1833
  return null;
1831
1834
  const o = {
@@ -1834,7 +1837,7 @@ function Do(e, n, i) {
1834
1837
  };
1835
1838
  i && (o.Authorization = `Bearer ${i}`);
1836
1839
  try {
1837
- return fetch(e, {
1840
+ return fetch(Do(e), {
1838
1841
  method: "POST",
1839
1842
  headers: o,
1840
1843
  body: JSON.stringify({ client_id: n }),
@@ -1846,7 +1849,7 @@ function Do(e, n, i) {
1846
1849
  return null;
1847
1850
  }
1848
1851
  }
1849
- function Oa() {
1852
+ function Na() {
1850
1853
  const e = Pe()(), n = Co(), i = es(), o = Uo(n.clientIdStorageKey);
1851
1854
  let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, A = null, x = 0;
1852
1855
  const m = () => {
@@ -1908,7 +1911,7 @@ function Oa() {
1908
1911
  if (!h)
1909
1912
  return;
1910
1913
  h = !1, A = null, y();
1911
- const w = Do(
1914
+ const w = qo(
1912
1915
  n.sessionCloseUrl,
1913
1916
  o,
1914
1917
  n.authTokenResolver()
@@ -1955,8 +1958,8 @@ function Oa() {
1955
1958
  d = !0, j(), y(), m(), $(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", se), window.removeEventListener("beforeunload", se);
1956
1959
  });
1957
1960
  }
1958
- const qo = 12e3, zo = 250, jo = 20;
1959
- function Na(e) {
1961
+ const zo = 12e3, jo = 250, $o = 20;
1962
+ function Fa(e) {
1960
1963
  const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = xt(), A = d !== null;
1961
1964
  let x = 0, m = null, y = null;
1962
1965
  const E = ie(() => i.currentUser?.id), R = () => Ln(e)?.trim() ?? "", S = () => {
@@ -1981,7 +1984,7 @@ function Na(e) {
1981
1984
  b(C);
1982
1985
  const L = setTimeout(() => {
1983
1986
  g.delete(C), n.removeTypingUser(O, C), h.value = h.value.filter((H) => H.id !== C);
1984
- }, qo);
1987
+ }, zo);
1985
1988
  g.set(C, L);
1986
1989
  }, B = () => {
1987
1990
  m && (clearTimeout(m), m = null), x = 0;
@@ -1989,9 +1992,9 @@ function Na(e) {
1989
1992
  const C = R();
1990
1993
  if (!(o.value || !C)) {
1991
1994
  if (u.value = null, !Ae()) {
1992
- A && !m && x < jo && (m = setTimeout(() => {
1995
+ A && !m && x < $o && (m = setTimeout(() => {
1993
1996
  m = null, x += 1, P();
1994
- }, zo));
1997
+ }, jo));
1995
1998
  return;
1996
1999
  }
1997
2000
  try {
@@ -2090,10 +2093,10 @@ function Na(e) {
2090
2093
  unsubscribe: U
2091
2094
  };
2092
2095
  }
2093
- function Fa(e) {
2096
+ function Da(e) {
2094
2097
  e.apiClient && Ti(e.apiClient), e.mainApiClient && uo(e.mainApiClient), e.authStore && Ri(e.authStore), e.mediaApi && xi(e.mediaApi), e.createLogger && io(e.createLogger), e.playMessageNotification && vo(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && no(e.mainEcho), e.presence && To(e.presence);
2095
2098
  }
2096
- function Da() {
2099
+ function qa() {
2097
2100
  Ei(), lo(), Ai(), Mi(), oo(), bo(), _i(), so(), Eo();
2098
2101
  }
2099
2102
  class jt {
@@ -2145,7 +2148,7 @@ class rs {
2145
2148
  this.namespace = n;
2146
2149
  }
2147
2150
  }
2148
- function $o(e) {
2151
+ function Ho(e) {
2149
2152
  try {
2150
2153
  new e();
2151
2154
  } catch (n) {
@@ -2242,7 +2245,7 @@ class is extends $t {
2242
2245
  ), this;
2243
2246
  }
2244
2247
  }
2245
- class Ho extends $t {
2248
+ class Bo extends $t {
2246
2249
  /**
2247
2250
  * Send a whisper event to other clients in the channel.
2248
2251
  */
@@ -2253,7 +2256,7 @@ class Ho extends $t {
2253
2256
  ), this;
2254
2257
  }
2255
2258
  }
2256
- class Bo extends is {
2259
+ class Vo extends is {
2257
2260
  /**
2258
2261
  * Register a callback to be called anytime the member list changes.
2259
2262
  */
@@ -2376,7 +2379,7 @@ class as extends os {
2376
2379
  }), this;
2377
2380
  }
2378
2381
  }
2379
- class Vo extends as {
2382
+ class Xo extends as {
2380
2383
  /**
2381
2384
  * Register a callback to be called anytime the member list changes.
2382
2385
  */
@@ -2470,7 +2473,7 @@ class cs extends rt {
2470
2473
  return this;
2471
2474
  }
2472
2475
  }
2473
- class Xo extends rt {
2476
+ class Wo extends rt {
2474
2477
  /**
2475
2478
  * Send a whisper event to other clients in the channel.
2476
2479
  */
@@ -2478,7 +2481,7 @@ class Xo extends rt {
2478
2481
  return this;
2479
2482
  }
2480
2483
  }
2481
- class Wo extends cs {
2484
+ class Go extends cs {
2482
2485
  /**
2483
2486
  * Register a callback to be called anytime the member list changes.
2484
2487
  */
@@ -2605,7 +2608,7 @@ class Qe extends Ht {
2605
2608
  * Get a private encrypted channel instance by name.
2606
2609
  */
2607
2610
  encryptedPrivateChannel(n) {
2608
- return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Ho(
2611
+ return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Bo(
2609
2612
  this.pusher,
2610
2613
  "private-encrypted-" + n,
2611
2614
  this.options
@@ -2615,7 +2618,7 @@ class Qe extends Ht {
2615
2618
  * Get a presence channel instance by name.
2616
2619
  */
2617
2620
  presenceChannel(n) {
2618
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Bo(
2621
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Vo(
2619
2622
  this.pusher,
2620
2623
  "presence-" + n,
2621
2624
  this.options
@@ -2684,7 +2687,7 @@ class Qe extends Ht {
2684
2687
  this.pusher.disconnect();
2685
2688
  }
2686
2689
  }
2687
- class Go extends Ht {
2690
+ class Jo extends Ht {
2688
2691
  constructor() {
2689
2692
  super(...arguments), this.channels = {};
2690
2693
  }
@@ -2744,7 +2747,7 @@ class Go extends Ht {
2744
2747
  * Get a presence channel instance by name.
2745
2748
  */
2746
2749
  presenceChannel(n) {
2747
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Vo(
2750
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Xo(
2748
2751
  this.socket,
2749
2752
  "presence-" + n,
2750
2753
  this.options
@@ -2837,13 +2840,13 @@ class Mn extends Ht {
2837
2840
  * Get a private encrypted channel instance by name.
2838
2841
  */
2839
2842
  encryptedPrivateChannel(n) {
2840
- return new Xo();
2843
+ return new Wo();
2841
2844
  }
2842
2845
  /**
2843
2846
  * Get a presence channel instance by name.
2844
2847
  */
2845
2848
  presenceChannel(n) {
2846
- return new Wo();
2849
+ return new Go();
2847
2850
  }
2848
2851
  /**
2849
2852
  * Leave the given channel, as well as its private and presence variants.
@@ -2880,7 +2883,7 @@ class Mn extends Ht {
2880
2883
  disconnect() {
2881
2884
  }
2882
2885
  }
2883
- class Jo {
2886
+ class Ko {
2884
2887
  /**
2885
2888
  * Create a new class instance.
2886
2889
  */
@@ -2911,10 +2914,10 @@ class Jo {
2911
2914
  broadcaster: "pusher"
2912
2915
  });
2913
2916
  else if (this.options.broadcaster === "socket.io")
2914
- this.connector = new Go(this.options);
2917
+ this.connector = new Jo(this.options);
2915
2918
  else if (this.options.broadcaster === "null")
2916
2919
  this.connector = new Mn(this.options);
2917
- else if (typeof this.options.broadcaster == "function" && $o(this.options.broadcaster))
2920
+ else if (typeof this.options.broadcaster == "function" && Ho(this.options.broadcaster))
2918
2921
  this.connector = new this.options.broadcaster(this.options);
2919
2922
  else
2920
2923
  throw new Error(
@@ -3038,12 +3041,12 @@ class Jo {
3038
3041
  );
3039
3042
  }
3040
3043
  }
3041
- function Ko(e) {
3044
+ function Yo(e) {
3042
3045
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3043
3046
  }
3044
3047
  var Et = { exports: {} };
3045
3048
  var kn;
3046
- function Yo() {
3049
+ function Qo() {
3047
3050
  return kn || (kn = 1, (function(e, n) {
3048
3051
  (function(o, u) {
3049
3052
  e.exports = u();
@@ -5740,8 +5743,8 @@ function Yo() {
5740
5743
  });
5741
5744
  })(Et)), Et.exports;
5742
5745
  }
5743
- var Qo = Yo();
5744
- const Zo = /* @__PURE__ */ Ko(Qo), ea = "/v1/messenger/bootstrap", ta = 3e4, na = 3e4, sa = 5 * 6e4;
5746
+ var Zo = Qo();
5747
+ const ea = /* @__PURE__ */ Yo(Zo), ta = "/v1/messenger/bootstrap", na = 3e4, sa = 3e4, ra = 5 * 6e4;
5745
5748
  function ne(e) {
5746
5749
  return typeof e == "object" && e !== null;
5747
5750
  }
@@ -5763,7 +5766,7 @@ function Ne(e, n) {
5763
5766
  const o = i.trim();
5764
5767
  return o === "" ? null : o;
5765
5768
  }
5766
- function ra(e, n) {
5769
+ function ia(e, n) {
5767
5770
  const i = e[n];
5768
5771
  if (typeof i == "number" && Number.isFinite(i))
5769
5772
  return i;
@@ -5774,14 +5777,14 @@ function ra(e, n) {
5774
5777
  }
5775
5778
  throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
5776
5779
  }
5777
- function ia(e) {
5780
+ function oa(e) {
5778
5781
  return e.toLowerCase() === "http" ? "http" : "https";
5779
5782
  }
5780
- function oa(e) {
5783
+ function aa(e) {
5781
5784
  if (e !== null)
5782
5785
  return e.startsWith("/") ? e : `/${e}`;
5783
5786
  }
5784
- function aa(e) {
5787
+ function ca(e) {
5785
5788
  if (!ne(e))
5786
5789
  throw new Error("Invalid messenger bootstrap payload: expected object");
5787
5790
  const n = e.auth, i = e.service;
@@ -5790,7 +5793,7 @@ function aa(e) {
5790
5793
  const o = n.user, u = i.reverb;
5791
5794
  if (!ne(o) || !ne(u))
5792
5795
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
5793
- const l = oa(Ne(u, "path"));
5796
+ const l = aa(Ne(u, "path"));
5794
5797
  return {
5795
5798
  auth: {
5796
5799
  token: ge(n, "token"),
@@ -5812,14 +5815,14 @@ function aa(e) {
5812
5815
  reverb: {
5813
5816
  appKey: ge(u, "app_key"),
5814
5817
  host: ge(u, "host"),
5815
- port: ra(u, "port"),
5816
- scheme: ia(ge(u, "scheme")),
5818
+ port: ia(u, "port"),
5819
+ scheme: oa(ge(u, "scheme")),
5817
5820
  ...l ? { path: l } : {}
5818
5821
  }
5819
5822
  }
5820
5823
  };
5821
5824
  }
5822
- function ca(e) {
5825
+ function ua(e) {
5823
5826
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
5824
5827
  }
5825
5828
  function In(e, n) {
@@ -5842,16 +5845,16 @@ function _e(e, n, i) {
5842
5845
  const u = e[i];
5843
5846
  return typeof u == "string" && u.trim() !== "" ? u : null;
5844
5847
  }
5845
- function ua(e) {
5848
+ function la(e) {
5846
5849
  if (typeof e != "string")
5847
5850
  return null;
5848
5851
  const n = e.trim().toLowerCase();
5849
5852
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
5850
5853
  }
5851
- function la(e, n) {
5854
+ function ha(e, n) {
5852
5855
  if (!ne(e))
5853
5856
  return null;
5854
- const i = _e(e, "user_id", "userId"), o = ua(e.status);
5857
+ const i = _e(e, "user_id", "userId"), o = la(e.status);
5855
5858
  if (!i || !o)
5856
5859
  return null;
5857
5860
  const u = {
@@ -5864,7 +5867,7 @@ function la(e, n) {
5864
5867
  const h = e.last_seen_at ?? e.lastSeenAt;
5865
5868
  return typeof h == "string" ? u.last_seen_at = h : h === null && (u.last_seen_at = null), u;
5866
5869
  }
5867
- function ha(e) {
5870
+ function da(e) {
5868
5871
  if (!ne(e))
5869
5872
  return null;
5870
5873
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
@@ -5885,7 +5888,7 @@ function ha(e) {
5885
5888
  ...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
5886
5889
  };
5887
5890
  }
5888
- function da(e) {
5891
+ function fa(e) {
5889
5892
  if (!ne(e))
5890
5893
  return null;
5891
5894
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
@@ -5904,7 +5907,7 @@ function da(e) {
5904
5907
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5905
5908
  };
5906
5909
  }
5907
- function fa(e) {
5910
+ function pa(e) {
5908
5911
  if (!ne(e))
5909
5912
  return null;
5910
5913
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
@@ -5915,31 +5918,31 @@ function fa(e) {
5915
5918
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5916
5919
  };
5917
5920
  }
5918
- function pa(e) {
5919
- return ne(e) && ae(e, "id") && ae(e, "name");
5920
- }
5921
5921
  function ga(e) {
5922
- return !ne(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => pa(n));
5922
+ return ne(e) && ae(e, "id") && ae(e, "name");
5923
5923
  }
5924
5924
  function ma(e) {
5925
- return ne(e) && ne(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
5925
+ return !ne(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ga(n));
5926
5926
  }
5927
5927
  function va(e) {
5928
- return ne(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
5928
+ return ne(e) && ne(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
5929
5929
  }
5930
5930
  function ba(e) {
5931
- return ne(e) && ae(e, "conversation_id") && ne(e.message) && ae(e.message, "id");
5931
+ return ne(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
5932
5932
  }
5933
5933
  function ya(e) {
5934
- return ne(e) && ae(e, "conversation_id") && ae(e, "message_id");
5934
+ return ne(e) && ae(e, "conversation_id") && ne(e.message) && ae(e.message, "id");
5935
5935
  }
5936
5936
  function _a(e) {
5937
- return ne(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ga(n));
5937
+ return ne(e) && ae(e, "conversation_id") && ae(e, "message_id");
5938
5938
  }
5939
5939
  function Sa(e) {
5940
- return ne(e) && ae(e, "conversation_id");
5940
+ return ne(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ma(n));
5941
5941
  }
5942
5942
  function wa(e) {
5943
+ return ne(e) && ae(e, "conversation_id");
5944
+ }
5945
+ function Ca(e) {
5943
5946
  return ne(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
5944
5947
  }
5945
5948
  function Re(e, n, i, o) {
@@ -5948,9 +5951,9 @@ function Re(e, n, i, o) {
5948
5951
  };
5949
5952
  return e.listen(n, u), u;
5950
5953
  }
5951
- function qa(e) {
5952
- const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ea, o = e.bootstrapRefreshSkewMs ?? ta, u = e.presenceFreshnessTtlMs ?? sa, l = (e.createLogger ?? Dt())("MessengerEcho");
5953
- typeof window < "u" && (window.Pusher = Zo);
5954
+ function za(e) {
5955
+ const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ta, o = e.bootstrapRefreshSkewMs ?? na, u = e.presenceFreshnessTtlMs ?? ra, l = (e.createLogger ?? Dt())("MessengerEcho");
5956
+ typeof window < "u" && (window.Pusher = ea);
5954
5957
  let h = null, g = null, d = null, A = null, x = "disconnected", m = null, y = null;
5955
5958
  const E = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), S = (T) => {
5956
5959
  x = T;
@@ -5988,7 +5991,7 @@ function qa(e) {
5988
5991
  const Y = await e.bootstrapClient.get(
5989
5992
  i,
5990
5993
  T ? { params: { refresh: 1 } } : void 0
5991
- ), N = aa(Y.data);
5994
+ ), N = ca(Y.data);
5992
5995
  return h = N, B(N), N;
5993
5996
  })().finally(() => {
5994
5997
  g = null;
@@ -6026,7 +6029,7 @@ function qa(e) {
6026
6029
  const N = Y.service.reverb.scheme === "https", V = {
6027
6030
  broadcaster: "reverb",
6028
6031
  key: Y.service.reverb.appKey,
6029
- wsHost: ca(Y.service.reverb.host),
6032
+ wsHost: ua(Y.service.reverb.host),
6030
6033
  wsPort: Y.service.reverb.port,
6031
6034
  wssPort: Y.service.reverb.port,
6032
6035
  forceTLS: N,
@@ -6041,11 +6044,11 @@ function qa(e) {
6041
6044
  }
6042
6045
  }
6043
6046
  };
6044
- return Y.service.reverb.path && (V.wsPath = Y.service.reverb.path), d = new Jo(V), $(d), S("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
6047
+ return Y.service.reverb.path && (V.wsPath = Y.service.reverb.path), d = new Ko(V), $(d), S("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
6045
6048
  })().finally(() => {
6046
6049
  A = null;
6047
6050
  }), await A), K = Mt.create({
6048
- timeout: e.requestTimeoutMs ?? na,
6051
+ timeout: e.requestTimeoutMs ?? sa,
6049
6052
  withCredentials: !1,
6050
6053
  headers: {
6051
6054
  Accept: "application/json",
@@ -6115,7 +6118,7 @@ function qa(e) {
6115
6118
  ];
6116
6119
  for (const V of N)
6117
6120
  Y.listen(V, (me) => {
6118
- const ve = la(me, M());
6121
+ const ve = ha(me, M());
6119
6122
  !ve || !ee(ve) || T(ve);
6120
6123
  });
6121
6124
  },
@@ -6130,25 +6133,25 @@ function qa(e) {
6130
6133
  const N = Y.private(`conversation.${T}`), V = [];
6131
6134
  return k.onMessageSent && V.push({
6132
6135
  event: ".ConversationMessageSent",
6133
- handler: Re(N, ".ConversationMessageSent", ma, k.onMessageSent)
6136
+ handler: Re(N, ".ConversationMessageSent", va, k.onMessageSent)
6134
6137
  }), k.onMessageRead && V.push({
6135
6138
  event: ".ConversationMessageRead",
6136
- handler: Re(N, ".ConversationMessageRead", va, k.onMessageRead)
6139
+ handler: Re(N, ".ConversationMessageRead", ba, k.onMessageRead)
6137
6140
  }), k.onMessageEdited && V.push({
6138
6141
  event: ".ConversationMessageEdited",
6139
- handler: Re(N, ".ConversationMessageEdited", ba, k.onMessageEdited)
6142
+ handler: Re(N, ".ConversationMessageEdited", ya, k.onMessageEdited)
6140
6143
  }), k.onMessageDeleted && V.push({
6141
6144
  event: ".ConversationMessageDeleted",
6142
- handler: Re(N, ".ConversationMessageDeleted", ya, k.onMessageDeleted)
6145
+ handler: Re(N, ".ConversationMessageDeleted", _a, k.onMessageDeleted)
6143
6146
  }), k.onReactionToggled && V.push({
6144
6147
  event: ".MessageReactionToggled",
6145
- handler: Re(N, ".MessageReactionToggled", _a, k.onReactionToggled)
6148
+ handler: Re(N, ".MessageReactionToggled", Sa, k.onReactionToggled)
6146
6149
  }), k.onRequestAccepted && V.push({
6147
6150
  event: ".ConversationRequestAccepted",
6148
- handler: Re(N, ".ConversationRequestAccepted", Sa, k.onRequestAccepted)
6151
+ handler: Re(N, ".ConversationRequestAccepted", wa, k.onRequestAccepted)
6149
6152
  }), k.onParticipantRemoved && V.push({
6150
6153
  event: ".ConversationParticipantRemoved",
6151
- handler: Re(N, ".ConversationParticipantRemoved", wa, k.onParticipantRemoved)
6154
+ handler: Re(N, ".ConversationParticipantRemoved", Ca, k.onParticipantRemoved)
6152
6155
  }), () => {
6153
6156
  if (typeof N.stopListening == "function")
6154
6157
  for (const me of V)
@@ -6175,7 +6178,7 @@ function qa(e) {
6175
6178
  ], ve = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], fe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], $e = /* @__PURE__ */ new Set(["start", "typing"]), ot = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
6176
6179
  for (const ce of me) {
6177
6180
  const pe = (we) => {
6178
- const W = ha(we);
6181
+ const W = da(we);
6179
6182
  if (W) {
6180
6183
  if ($e.has(W.state)) {
6181
6184
  k.onTypingStart?.({
@@ -6200,7 +6203,7 @@ function qa(e) {
6200
6203
  }
6201
6204
  for (const ce of ve) {
6202
6205
  const pe = (we) => {
6203
- const W = da(we);
6206
+ const W = fa(we);
6204
6207
  if (!W)
6205
6208
  return;
6206
6209
  const xe = {
@@ -6219,7 +6222,7 @@ function qa(e) {
6219
6222
  }
6220
6223
  for (const ce of fe) {
6221
6224
  const pe = (we) => {
6222
- const W = fa(we);
6225
+ const W = pa(we);
6223
6226
  if (!W)
6224
6227
  return;
6225
6228
  const xe = {
@@ -6245,11 +6248,11 @@ function qa(e) {
6245
6248
  }
6246
6249
  export {
6247
6250
  ho as DEFAULT_PRESENCE_STALE_AFTER_MS,
6248
- Fa as configureMessengerClient,
6249
- qa as createMessengerEcho,
6251
+ Da as configureMessengerClient,
6252
+ za as createMessengerEcho,
6250
6253
  X as getApi,
6251
6254
  Pe as getAuthStore,
6252
- xa as getConnectionStatus,
6255
+ Ma as getConnectionStatus,
6253
6256
  Ae as getEcho,
6254
6257
  Hn as getEchoConnectionStatus,
6255
6258
  De as getEchoInitializedEvent,
@@ -6261,9 +6264,9 @@ export {
6261
6264
  Yi as getMainEchoInitializedEvent,
6262
6265
  Pi as getMediaApi,
6263
6266
  Co as getPresenceRuntimeConfig,
6264
- ka as hasResponse,
6265
- $a as isAxiosError,
6266
- Ma as isError,
6267
+ Ia as hasResponse,
6268
+ Ha as isAxiosError,
6269
+ ka as isError,
6267
6270
  wi as isValidMessageReadEvent,
6268
6271
  Si as isValidMessageSentEvent,
6269
6272
  Ci as isValidRequestAcceptedEvent,
@@ -6282,7 +6285,7 @@ export {
6282
6285
  Ei as resetMessagingApiClient,
6283
6286
  Ai as resetMessagingAuthStoreResolver,
6284
6287
  Mi as resetMessagingMediaApi,
6285
- Da as resetMessengerClientConfig,
6288
+ qa as resetMessengerClientConfig,
6286
6289
  Eo as resetPresenceRuntimeConfig,
6287
6290
  go as resolveFreshPresenceStatus,
6288
6291
  xn as resolvePresenceSnapshot,
@@ -6300,10 +6303,10 @@ export {
6300
6303
  mi as unsubscribeFromConversation,
6301
6304
  pi as unsubscribeFromPresenceStatus,
6302
6305
  bi as unsubscribeFromTyping,
6303
- La as useConnectionStatus,
6304
- Ia as useConversationChannel,
6305
- Ua as useGlobalMessaging,
6306
+ Ua as useConnectionStatus,
6307
+ La as useConversationChannel,
6308
+ Oa as useGlobalMessaging,
6306
6309
  Nt as useMessagingStore,
6307
- Oa as usePresence,
6308
- Na as useTypingChannel
6310
+ Na as usePresence,
6311
+ Fa as useTypingChannel
6309
6312
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingfactory/messenger-client",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Shared messaging frontend state, API helpers, and realtime composables.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",