@codingfactory/messenger-client 0.1.1 → 0.1.5
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/composables/useNotificationSound.d.ts +1 -1
- package/dist/index.js +556 -539
- package/dist/services/auth.d.ts +1 -1
- package/dist/services/mediaApi.d.ts +1 -1
- package/dist/stores/auth.d.ts +1 -1
- package/dist/stores/messaging.d.ts +6 -0
- package/dist/utils/logger.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,92 +1,101 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import
|
|
4
|
-
import { isAxiosError as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
}, Ae = () => {
|
|
8
|
-
}, Ee = () => {
|
|
9
|
-
}, Fe = () => {
|
|
1
|
+
import { ref as J, getCurrentInstance as Ae, computed as K, onUnmounted as Ee, toValue as Ve, watch as he } from "vue";
|
|
2
|
+
import { defineStore as Be, storeToRefs as He } from "pinia";
|
|
3
|
+
import je, { isAxiosError as Ye } from "axios";
|
|
4
|
+
import { isAxiosError as es } from "axios";
|
|
5
|
+
import { useRoute as We } from "vue-router";
|
|
6
|
+
const Fe = () => () => {
|
|
10
7
|
}, Te = () => {
|
|
8
|
+
}, xe = () => {
|
|
9
|
+
}, qe = () => {
|
|
10
|
+
}, Pe = () => {
|
|
11
11
|
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
12
|
-
},
|
|
12
|
+
}, y = {
|
|
13
13
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
14
14
|
getEcho: () => null,
|
|
15
|
-
onConnectionStatusChange:
|
|
16
|
-
subscribeToPresenceStatus:
|
|
17
|
-
unsubscribeFromPresenceStatus:
|
|
18
|
-
subscribeToConversation:
|
|
19
|
-
unsubscribeFromConversation:
|
|
20
|
-
},
|
|
21
|
-
function
|
|
22
|
-
e.initializedEvent && (
|
|
23
|
-
}
|
|
24
|
-
function
|
|
25
|
-
|
|
15
|
+
onConnectionStatusChange: Fe,
|
|
16
|
+
subscribeToPresenceStatus: Te,
|
|
17
|
+
unsubscribeFromPresenceStatus: xe,
|
|
18
|
+
subscribeToConversation: Pe,
|
|
19
|
+
unsubscribeFromConversation: qe
|
|
20
|
+
}, ge = () => y.ECHO_INITIALIZED_EVENT, G = () => y.getEcho(), Le = (e) => y.onConnectionStatusChange(e), Ze = (e) => y.subscribeToPresenceStatus(e), Xe = () => y.unsubscribeFromPresenceStatus(), Qe = (e, t) => y.subscribeToConversation(e, t), Je = (e) => y.unsubscribeFromConversation(e);
|
|
21
|
+
function Ke(e) {
|
|
22
|
+
e.initializedEvent && (y.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (y.getEcho = e.getEcho), e.onConnectionStatusChange && (y.onConnectionStatusChange = e.onConnectionStatusChange), e.subscribeToPresenceStatus && (y.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (y.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (y.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (y.unsubscribeFromConversation = e.unsubscribeFromConversation);
|
|
23
|
+
}
|
|
24
|
+
function et() {
|
|
25
|
+
y.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", y.getEcho = () => null, y.onConnectionStatusChange = Fe, y.subscribeToPresenceStatus = Te, y.unsubscribeFromPresenceStatus = xe, y.subscribeToConversation = Pe, y.unsubscribeFromConversation = qe;
|
|
26
26
|
}
|
|
27
27
|
function Z(e) {
|
|
28
28
|
return typeof e == "object" && e !== null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function tt(e) {
|
|
31
31
|
return Z(e) && typeof e.conversation_id == "string" && Z(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function st(e) {
|
|
34
34
|
return Z(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function nt(e) {
|
|
37
37
|
return Z(e) && typeof e.conversation_id == "string";
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
let
|
|
41
|
-
function
|
|
42
|
-
|
|
39
|
+
const Ne = je;
|
|
40
|
+
let oe = Ne;
|
|
41
|
+
function h() {
|
|
42
|
+
return oe;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
44
|
+
function rt(e) {
|
|
45
|
+
oe = e;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
function it() {
|
|
48
|
+
oe = Ne;
|
|
49
|
+
}
|
|
50
|
+
const Ue = {
|
|
48
51
|
currentUser: null
|
|
49
52
|
};
|
|
50
|
-
let
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
+
let ae = () => Ue;
|
|
54
|
+
function k() {
|
|
55
|
+
return ae;
|
|
53
56
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
57
|
+
function ot(e) {
|
|
58
|
+
ae = e;
|
|
56
59
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
60
|
+
function at() {
|
|
61
|
+
ae = () => Ue;
|
|
62
|
+
}
|
|
63
|
+
function g(e) {
|
|
64
|
+
if (Ye(e)) {
|
|
59
65
|
const t = e.response?.data?.message || e.message || "An error occurred";
|
|
60
66
|
return t.includes("SQLSTATE") || t.includes("Connection:") || t.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : t;
|
|
61
67
|
}
|
|
62
68
|
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";
|
|
63
69
|
}
|
|
64
|
-
function
|
|
70
|
+
function jt(e) {
|
|
65
71
|
return e instanceof Error;
|
|
66
72
|
}
|
|
67
|
-
function
|
|
73
|
+
function Yt(e) {
|
|
68
74
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
69
75
|
}
|
|
70
|
-
const
|
|
76
|
+
const ze = {
|
|
71
77
|
async uploadImage() {
|
|
72
78
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
|
-
let
|
|
76
|
-
function
|
|
77
|
-
|
|
81
|
+
let ce = ze;
|
|
82
|
+
function ct() {
|
|
83
|
+
return ce;
|
|
84
|
+
}
|
|
85
|
+
function ut(e) {
|
|
86
|
+
ce = e;
|
|
78
87
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
88
|
+
function dt() {
|
|
89
|
+
ce = ze;
|
|
81
90
|
}
|
|
82
|
-
function
|
|
91
|
+
function lt(e) {
|
|
83
92
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
84
93
|
}
|
|
85
|
-
function
|
|
94
|
+
function Ie(e) {
|
|
86
95
|
return typeof e == "object" && e !== null;
|
|
87
96
|
}
|
|
88
97
|
function D(e) {
|
|
89
|
-
return !
|
|
98
|
+
return !Ie(e) || !("data" in e) ? e : e.data;
|
|
90
99
|
}
|
|
91
100
|
function B(e, t) {
|
|
92
101
|
const s = e[t];
|
|
@@ -94,7 +103,7 @@ function B(e, t) {
|
|
|
94
103
|
throw new Error(`Invalid messaging folder payload: missing string ${t}`);
|
|
95
104
|
return s;
|
|
96
105
|
}
|
|
97
|
-
function
|
|
106
|
+
function me(e, t) {
|
|
98
107
|
const s = e[t];
|
|
99
108
|
if (s == null)
|
|
100
109
|
return null;
|
|
@@ -102,7 +111,7 @@ function fe(e, t) {
|
|
|
102
111
|
throw new Error(`Invalid messaging folder payload: ${t} must be a string or null`);
|
|
103
112
|
return s;
|
|
104
113
|
}
|
|
105
|
-
function
|
|
114
|
+
function ee(e, t) {
|
|
106
115
|
const s = e[t];
|
|
107
116
|
if (typeof s == "number" && Number.isFinite(s))
|
|
108
117
|
return s;
|
|
@@ -113,64 +122,64 @@ function K(e, t) {
|
|
|
113
122
|
}
|
|
114
123
|
throw new Error(`Invalid messaging folder payload: missing numeric ${t}`);
|
|
115
124
|
}
|
|
116
|
-
function
|
|
117
|
-
if (!
|
|
125
|
+
function re(e) {
|
|
126
|
+
if (!Ie(e))
|
|
118
127
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
119
128
|
return {
|
|
120
129
|
id: B(e, "id"),
|
|
121
130
|
name: B(e, "name"),
|
|
122
|
-
color:
|
|
123
|
-
icon:
|
|
124
|
-
sort_order:
|
|
125
|
-
conversation_count:
|
|
126
|
-
unread_count:
|
|
131
|
+
color: me(e, "color"),
|
|
132
|
+
icon: me(e, "icon"),
|
|
133
|
+
sort_order: ee(e, "sort_order"),
|
|
134
|
+
conversation_count: ee(e, "conversation_count"),
|
|
135
|
+
unread_count: ee(e, "unread_count"),
|
|
127
136
|
created_at: B(e, "created_at"),
|
|
128
137
|
updated_at: B(e, "updated_at")
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
|
-
function
|
|
140
|
+
function ft(e) {
|
|
132
141
|
if (!Array.isArray(e))
|
|
133
142
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
134
|
-
return e.map((t) =>
|
|
143
|
+
return e.map((t) => re(t));
|
|
135
144
|
}
|
|
136
|
-
function
|
|
137
|
-
if (!
|
|
145
|
+
function pe(e) {
|
|
146
|
+
if (!lt(e))
|
|
138
147
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
139
148
|
return e;
|
|
140
149
|
}
|
|
141
|
-
const
|
|
150
|
+
const x = {
|
|
142
151
|
async fetchFolders() {
|
|
143
|
-
const e = await
|
|
144
|
-
return
|
|
152
|
+
const e = await h().get("/v1/messaging/folders");
|
|
153
|
+
return ft(D(e.data));
|
|
145
154
|
},
|
|
146
155
|
async createFolder(e) {
|
|
147
|
-
const t = await
|
|
148
|
-
return
|
|
156
|
+
const t = await h().post("/v1/messaging/folders", e);
|
|
157
|
+
return re(D(t.data));
|
|
149
158
|
},
|
|
150
159
|
async updateFolder(e, t) {
|
|
151
|
-
const s = await
|
|
152
|
-
return
|
|
160
|
+
const s = await h().patch(`/v1/messaging/folders/${e}`, t);
|
|
161
|
+
return re(D(s.data));
|
|
153
162
|
},
|
|
154
163
|
async deleteFolder(e) {
|
|
155
|
-
await
|
|
164
|
+
await h().delete(`/v1/messaging/folders/${e}`);
|
|
156
165
|
},
|
|
157
166
|
async reorderFolders(e) {
|
|
158
|
-
await
|
|
167
|
+
await h().patch("/v1/messaging/folders/reorder", { order: e });
|
|
159
168
|
},
|
|
160
169
|
async assignFolder(e, t) {
|
|
161
|
-
const s = await
|
|
170
|
+
const s = await h().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
162
171
|
folder_id: t
|
|
163
172
|
});
|
|
164
|
-
return
|
|
173
|
+
return pe(D(s.data));
|
|
165
174
|
},
|
|
166
175
|
async acceptRequest(e) {
|
|
167
|
-
const t = await
|
|
168
|
-
return
|
|
176
|
+
const t = await h().post(`/v1/messaging/conversations/${e}/accept`);
|
|
177
|
+
return pe(D(t.data));
|
|
169
178
|
},
|
|
170
179
|
async declineRequest(e) {
|
|
171
|
-
await
|
|
180
|
+
await h().post(`/v1/messaging/conversations/${e}/decline`);
|
|
172
181
|
}
|
|
173
|
-
},
|
|
182
|
+
}, ve = 1e3, ue = 4e3, ht = 12e4, gt = 300, mt = 1, pt = 1600, de = (e) => {
|
|
174
183
|
if (typeof e == "number" && Number.isFinite(e))
|
|
175
184
|
return e;
|
|
176
185
|
if (typeof e == "string") {
|
|
@@ -178,32 +187,32 @@ const P = {
|
|
|
178
187
|
if (Number.isFinite(t))
|
|
179
188
|
return t;
|
|
180
189
|
}
|
|
181
|
-
},
|
|
182
|
-
const s =
|
|
183
|
-
return s === void 0 ? !0 : s === 429 ||
|
|
184
|
-
},
|
|
190
|
+
}, De = (e) => typeof e == "number" && e >= 500 && e < 600, _e = (e) => {
|
|
191
|
+
const s = de(e.response?.status);
|
|
192
|
+
return s === void 0 ? !0 : s === 429 || De(s);
|
|
193
|
+
}, $e = (e) => {
|
|
185
194
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
186
|
-
return Math.max(
|
|
195
|
+
return Math.max(ve, e * 1e3);
|
|
187
196
|
if (typeof e == "string") {
|
|
188
197
|
const t = Number.parseInt(e, 10);
|
|
189
198
|
if (Number.isFinite(t) && t > 0)
|
|
190
|
-
return Math.max(
|
|
199
|
+
return Math.max(ve, t * 1e3);
|
|
191
200
|
}
|
|
192
|
-
return
|
|
193
|
-
},
|
|
194
|
-
const t = Math.max(0, e), s = 2 ** Math.min(t, 6), n =
|
|
195
|
-
return Math.min(
|
|
196
|
-
},
|
|
201
|
+
return ue;
|
|
202
|
+
}, vt = (e) => {
|
|
203
|
+
const t = Math.max(0, e), s = 2 ** Math.min(t, 6), n = ue * s;
|
|
204
|
+
return Math.min(ht, n);
|
|
205
|
+
}, _t = (e) => {
|
|
197
206
|
const t = e;
|
|
198
|
-
return
|
|
199
|
-
},
|
|
207
|
+
return de(t.response?.status) === 429 ? $e(t.response?.headers?.["retry-after"]) : gt;
|
|
208
|
+
}, ye = async (e) => {
|
|
200
209
|
await new Promise((t) => {
|
|
201
210
|
setTimeout(t, e);
|
|
202
211
|
});
|
|
203
|
-
},
|
|
204
|
-
if (!
|
|
212
|
+
}, yt = (e) => {
|
|
213
|
+
if (!C(e))
|
|
205
214
|
return !1;
|
|
206
|
-
const s = (
|
|
215
|
+
const s = (C(e.data) ? e.data : e).throttled;
|
|
207
216
|
if (typeof s == "boolean")
|
|
208
217
|
return s;
|
|
209
218
|
if (typeof s == "number")
|
|
@@ -214,7 +223,7 @@ const P = {
|
|
|
214
223
|
}
|
|
215
224
|
return !1;
|
|
216
225
|
};
|
|
217
|
-
function
|
|
226
|
+
function bt(e, t, s) {
|
|
218
227
|
const n = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
219
228
|
if (n)
|
|
220
229
|
return n;
|
|
@@ -224,17 +233,17 @@ function pt(e, t, s) {
|
|
|
224
233
|
const i = typeof s == "string" && s.trim().length > 0 ? s.trim().toLowerCase() : void 0;
|
|
225
234
|
return i ? i === "image" ? "image/*" : i === "video" ? "video/*" : i === "audio" ? "audio/*" : i : "application/octet-stream";
|
|
226
235
|
}
|
|
227
|
-
function
|
|
236
|
+
function Ct(e) {
|
|
228
237
|
const t = e.url || "", s = e.thumbnail_url ?? e.thumbnail, n = {
|
|
229
238
|
id: e.media_id ?? e.id ?? "",
|
|
230
|
-
name: e.name ??
|
|
239
|
+
name: e.name ?? St(t),
|
|
231
240
|
url: t,
|
|
232
|
-
type:
|
|
241
|
+
type: bt(e.mime, e.mime_type, e.type),
|
|
233
242
|
size: e.size ?? 0
|
|
234
243
|
};
|
|
235
244
|
return s !== void 0 && (n.thumbnail = s), n;
|
|
236
245
|
}
|
|
237
|
-
function
|
|
246
|
+
function St(e) {
|
|
238
247
|
if (!e) return "attachment";
|
|
239
248
|
try {
|
|
240
249
|
const s = new URL(e).pathname.split("/");
|
|
@@ -243,8 +252,8 @@ function _t(e) {
|
|
|
243
252
|
return "attachment";
|
|
244
253
|
}
|
|
245
254
|
}
|
|
246
|
-
function
|
|
247
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
255
|
+
function Mt(e) {
|
|
256
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(Ct);
|
|
248
257
|
}
|
|
249
258
|
function X(e) {
|
|
250
259
|
if (typeof e != "string")
|
|
@@ -253,7 +262,7 @@ function X(e) {
|
|
|
253
262
|
if (t.length !== 0)
|
|
254
263
|
return t;
|
|
255
264
|
}
|
|
256
|
-
function
|
|
265
|
+
function Rt(e) {
|
|
257
266
|
if (!e)
|
|
258
267
|
return;
|
|
259
268
|
const t = X(e.avatar) ?? X(e.avatar_url), s = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -264,7 +273,7 @@ function bt(e) {
|
|
|
264
273
|
...s ? { handle: s } : {}
|
|
265
274
|
};
|
|
266
275
|
}
|
|
267
|
-
function
|
|
276
|
+
function Y(e) {
|
|
268
277
|
const t = e.shared_post, s = e.author, n = t && typeof t == "object" ? {
|
|
269
278
|
id: t.id ?? "",
|
|
270
279
|
title: t.title ?? "",
|
|
@@ -280,99 +289,105 @@ function j(e) {
|
|
|
280
289
|
} : null;
|
|
281
290
|
return {
|
|
282
291
|
...e,
|
|
283
|
-
...s ? { author:
|
|
292
|
+
...s ? { author: Rt(s) } : {},
|
|
284
293
|
shared_post: n,
|
|
285
|
-
attachments:
|
|
294
|
+
attachments: Mt(e.attachments)
|
|
286
295
|
};
|
|
287
296
|
}
|
|
288
|
-
function
|
|
297
|
+
function wt(e) {
|
|
289
298
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
290
299
|
}
|
|
291
|
-
function
|
|
300
|
+
function be(e) {
|
|
292
301
|
if (!(typeof e != "string" || e.length === 0))
|
|
293
302
|
return e;
|
|
294
303
|
}
|
|
295
|
-
function
|
|
304
|
+
function ie(e) {
|
|
296
305
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
297
306
|
}
|
|
298
|
-
function
|
|
307
|
+
function At(e, t = []) {
|
|
299
308
|
const s = /* @__PURE__ */ new Map();
|
|
300
309
|
for (const n of t) {
|
|
301
|
-
const r =
|
|
310
|
+
const r = be(n.last_read_message_id);
|
|
302
311
|
r && s.set(n.user_id, r);
|
|
303
312
|
}
|
|
304
313
|
return e.map((n) => {
|
|
305
|
-
const r = X(n.user?.avatar) ?? X(n.user?.avatar_url),
|
|
314
|
+
const r = Object.prototype.hasOwnProperty.call(n, "last_read_message_id"), i = X(n.user?.avatar) ?? X(n.user?.avatar_url), o = n.user ? {
|
|
306
315
|
id: n.user.id,
|
|
307
316
|
name: n.user.name,
|
|
308
|
-
...
|
|
317
|
+
...i ? { avatar: i } : {},
|
|
309
318
|
...n.user.handle ? { handle: n.user.handle } : {}
|
|
310
|
-
} : void 0,
|
|
311
|
-
if (
|
|
319
|
+
} : void 0, a = be(n.last_read_message_id);
|
|
320
|
+
if (a)
|
|
312
321
|
return {
|
|
313
322
|
...n,
|
|
314
|
-
...
|
|
315
|
-
last_read_message_id:
|
|
323
|
+
...o ? { user: o } : {},
|
|
324
|
+
last_read_message_id: a
|
|
316
325
|
};
|
|
317
|
-
|
|
318
|
-
|
|
326
|
+
if (r)
|
|
327
|
+
return {
|
|
328
|
+
...n,
|
|
329
|
+
...o ? { user: o } : {},
|
|
330
|
+
last_read_message_id: ""
|
|
331
|
+
};
|
|
332
|
+
const c = s.get(n.user_id);
|
|
333
|
+
return c ? {
|
|
319
334
|
...n,
|
|
320
|
-
...
|
|
321
|
-
last_read_message_id:
|
|
335
|
+
...o ? { user: o } : {},
|
|
336
|
+
last_read_message_id: c
|
|
322
337
|
} : {
|
|
323
338
|
...n,
|
|
324
|
-
...
|
|
339
|
+
...o ? { user: o } : {},
|
|
325
340
|
last_read_message_id: ""
|
|
326
341
|
};
|
|
327
342
|
});
|
|
328
343
|
}
|
|
329
|
-
function
|
|
330
|
-
const s =
|
|
344
|
+
function $(e, t) {
|
|
345
|
+
const s = wt(e.muted_until), n = e.is_muted ?? s !== null, r = e.last_message ? Y(e.last_message) : t?.last_message, i = e.last_message_at ?? t?.last_message_at, o = (() => {
|
|
331
346
|
if (!t || t.unread_count !== 0 || e.unread_count <= 0)
|
|
332
347
|
return !1;
|
|
333
|
-
const a = t.last_message?.id,
|
|
334
|
-
return !a || !
|
|
348
|
+
const a = t.last_message?.id, c = e.last_message?.id;
|
|
349
|
+
return !a || !c ? !1 : a === c;
|
|
335
350
|
})();
|
|
336
351
|
return {
|
|
337
352
|
...e,
|
|
338
353
|
unread_count: n || o ? 0 : e.unread_count,
|
|
339
|
-
participants:
|
|
354
|
+
participants: At(e.participants, t?.participants),
|
|
340
355
|
is_muted: n,
|
|
341
356
|
muted_until: s,
|
|
342
357
|
...r ? { last_message: r } : {},
|
|
343
358
|
...i ? { last_message_at: i } : {}
|
|
344
359
|
};
|
|
345
360
|
}
|
|
346
|
-
function
|
|
361
|
+
function Et(e) {
|
|
347
362
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
348
363
|
}
|
|
349
|
-
function
|
|
350
|
-
return
|
|
364
|
+
function te(e) {
|
|
365
|
+
return Et(e) ? 0 : e.unread_count || 0;
|
|
351
366
|
}
|
|
352
|
-
function
|
|
367
|
+
function Ce(e, t) {
|
|
353
368
|
const s = t[e.id];
|
|
354
369
|
if (Array.isArray(s))
|
|
355
370
|
for (let n = s.length - 1; n >= 0; n -= 1) {
|
|
356
371
|
const r = s[n]?.id;
|
|
357
|
-
if (
|
|
372
|
+
if (ie(r))
|
|
358
373
|
return r;
|
|
359
374
|
}
|
|
360
|
-
return
|
|
375
|
+
return ie(e.last_message?.id) ? e.last_message.id : null;
|
|
361
376
|
}
|
|
362
|
-
function
|
|
377
|
+
function C(e) {
|
|
363
378
|
return typeof e == "object" && e !== null;
|
|
364
379
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
380
|
+
function Ft(e) {
|
|
381
|
+
return C(e) ? (C(e.response) ? e.response : null)?.status === 401 : !1;
|
|
367
382
|
}
|
|
368
|
-
function
|
|
383
|
+
function Se(e) {
|
|
369
384
|
if (!Array.isArray(e))
|
|
370
385
|
return [];
|
|
371
386
|
const t = [];
|
|
372
387
|
for (const s of e) {
|
|
373
|
-
if (!
|
|
388
|
+
if (!C(s) || typeof s.reaction != "string" || typeof s.count != "number" || !Array.isArray(s.users))
|
|
374
389
|
continue;
|
|
375
|
-
const n = s.users.filter((r) =>
|
|
390
|
+
const n = s.users.filter((r) => C(r)).filter(
|
|
376
391
|
(r) => typeof r.id == "string" && typeof r.name == "string"
|
|
377
392
|
).map((r) => ({
|
|
378
393
|
id: r.id,
|
|
@@ -386,24 +401,24 @@ function ye(e) {
|
|
|
386
401
|
}
|
|
387
402
|
return t;
|
|
388
403
|
}
|
|
389
|
-
function
|
|
390
|
-
const s =
|
|
404
|
+
function Tt(e, t) {
|
|
405
|
+
const s = C(t) ? t : null, n = s?.next ?? s?.next_cursor ?? e.next_cursor;
|
|
391
406
|
if (!(typeof n != "string" || n.length === 0))
|
|
392
407
|
return n;
|
|
393
408
|
}
|
|
394
409
|
function H(e, t) {
|
|
395
|
-
const s =
|
|
410
|
+
const s = C(e) ? e : {}, n = s.data ?? e;
|
|
396
411
|
let r = [];
|
|
397
|
-
return Array.isArray(n) ? r = n :
|
|
412
|
+
return Array.isArray(n) ? r = n : C(n) && (Array.isArray(n.items) ? r = n.items : Array.isArray(n[t]) ? r = n[t] : Array.isArray(n.data) && (r = n.data)), {
|
|
398
413
|
items: r,
|
|
399
|
-
nextCursor:
|
|
414
|
+
nextCursor: Tt(s, n)
|
|
400
415
|
};
|
|
401
416
|
}
|
|
402
|
-
function
|
|
403
|
-
return
|
|
417
|
+
function Me(e) {
|
|
418
|
+
return C(e) && typeof e.id == "string" && e.id.length > 0;
|
|
404
419
|
}
|
|
405
|
-
function
|
|
406
|
-
return
|
|
420
|
+
function Re(e) {
|
|
421
|
+
return C(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
407
422
|
}
|
|
408
423
|
function W(e, t) {
|
|
409
424
|
if (e.is_pinned !== t.is_pinned)
|
|
@@ -411,25 +426,25 @@ function W(e, t) {
|
|
|
411
426
|
const s = e.last_message_at ?? e.created_at, r = (t.last_message_at ?? t.created_at).localeCompare(s);
|
|
412
427
|
return r !== 0 ? r : e.id.localeCompare(t.id);
|
|
413
428
|
}
|
|
414
|
-
function
|
|
429
|
+
function j(e, t) {
|
|
415
430
|
return [t, ...e.filter((s) => s.id !== t.id)];
|
|
416
431
|
}
|
|
417
|
-
function
|
|
432
|
+
function O(e) {
|
|
418
433
|
return [...e].sort((t, s) => t.sort_order !== s.sort_order ? t.sort_order - s.sort_order : t.name.localeCompare(s.name));
|
|
419
434
|
}
|
|
420
|
-
function
|
|
435
|
+
function xt(e, t) {
|
|
421
436
|
return typeof e != "string" || e.length === 0 ? null : t.has(e) ? e : null;
|
|
422
437
|
}
|
|
423
|
-
function
|
|
438
|
+
function we(e, t) {
|
|
424
439
|
return e.map((s) => {
|
|
425
|
-
const n =
|
|
440
|
+
const n = xt(s.folder_id, t);
|
|
426
441
|
return (s.folder_id ?? null) === n ? s : {
|
|
427
442
|
...s,
|
|
428
443
|
folder_id: n
|
|
429
444
|
};
|
|
430
445
|
});
|
|
431
446
|
}
|
|
432
|
-
function
|
|
447
|
+
function se(e) {
|
|
433
448
|
const t = /* @__PURE__ */ new Map();
|
|
434
449
|
for (const s of e.requests)
|
|
435
450
|
s.is_request === !0 && t.set(s.id, s);
|
|
@@ -437,7 +452,7 @@ function te(e) {
|
|
|
437
452
|
s.is_request === !0 && t.set(s.id, s);
|
|
438
453
|
return Array.from(t.values()).sort(W);
|
|
439
454
|
}
|
|
440
|
-
const
|
|
455
|
+
const Oe = Be("messaging", {
|
|
441
456
|
state: () => ({
|
|
442
457
|
conversations: [],
|
|
443
458
|
requests: [],
|
|
@@ -464,62 +479,62 @@ const De = Ge("messaging", {
|
|
|
464
479
|
getConversationById: (e) => (t) => e.conversations.find((s) => s.id === t),
|
|
465
480
|
getMessagesByConversationId: (e) => (t) => e.messages[t] || [],
|
|
466
481
|
getTypingUsers: (e) => (t) => e.typingUsers[t] || [],
|
|
467
|
-
unreadConversationsCount: (e) => e.conversations.filter((t) =>
|
|
468
|
-
unreadCount: (e) => e.conversations.reduce((t, s) => t +
|
|
469
|
-
totalUnreadCount: (e) => e.conversations.reduce((t, s) => t +
|
|
470
|
-
sortedFolders: (e) =>
|
|
482
|
+
unreadConversationsCount: (e) => e.conversations.filter((t) => te(t) > 0).length,
|
|
483
|
+
unreadCount: (e) => e.conversations.reduce((t, s) => t + te(s), 0),
|
|
484
|
+
totalUnreadCount: (e) => e.conversations.reduce((t, s) => t + te(s), 0),
|
|
485
|
+
sortedFolders: (e) => O(e.folders),
|
|
471
486
|
folderById: (e) => (t) => e.folders.find((s) => s.id === t),
|
|
472
487
|
conversationsInFolder: (e) => (t) => e.conversations.filter((s) => s.folder_id === t),
|
|
473
488
|
hasMoreMessages: (e) => (t) => e.conversationHasMore[t] ?? !1,
|
|
474
489
|
isLoadingMessages: (e) => (t) => e.loadingMessages[t] ?? !1,
|
|
475
490
|
// Message request getters
|
|
476
|
-
requestConversations: (e) =>
|
|
477
|
-
requestCount: (e) =>
|
|
478
|
-
unreadRequestCount: (e) =>
|
|
491
|
+
requestConversations: (e) => se(e),
|
|
492
|
+
requestCount: (e) => se(e).length,
|
|
493
|
+
unreadRequestCount: (e) => se(e).filter((t) => t.unread_count > 0).length
|
|
479
494
|
},
|
|
480
495
|
actions: {
|
|
481
496
|
normalizeFolderAssignmentsState() {
|
|
482
497
|
if (!this.foldersLoaded)
|
|
483
498
|
return;
|
|
484
499
|
const e = new Set(this.folders.map((t) => t.id));
|
|
485
|
-
this.conversations =
|
|
500
|
+
this.conversations = we(this.conversations, e), this.requests = we(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
486
501
|
},
|
|
487
502
|
async fetchFolders() {
|
|
488
503
|
try {
|
|
489
|
-
const e = await
|
|
490
|
-
return this.folders =
|
|
504
|
+
const e = await x.fetchFolders();
|
|
505
|
+
return this.folders = O(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
491
506
|
} catch (e) {
|
|
492
|
-
throw this.error =
|
|
507
|
+
throw this.error = g(e), e;
|
|
493
508
|
}
|
|
494
509
|
},
|
|
495
510
|
async createFolder(e) {
|
|
496
511
|
try {
|
|
497
|
-
const t = await
|
|
498
|
-
return this.folders =
|
|
512
|
+
const t = await x.createFolder(e);
|
|
513
|
+
return this.folders = O([...this.folders, t]), t;
|
|
499
514
|
} catch (t) {
|
|
500
|
-
throw this.error =
|
|
515
|
+
throw this.error = g(t), t;
|
|
501
516
|
}
|
|
502
517
|
},
|
|
503
518
|
async updateFolder(e, t) {
|
|
504
519
|
try {
|
|
505
|
-
const s = await
|
|
506
|
-
return this.folders =
|
|
520
|
+
const s = await x.updateFolder(e, t);
|
|
521
|
+
return this.folders = O(
|
|
507
522
|
this.folders.map((n) => n.id === e ? s : n)
|
|
508
523
|
), s;
|
|
509
524
|
} catch (s) {
|
|
510
|
-
throw this.error =
|
|
525
|
+
throw this.error = g(s), s;
|
|
511
526
|
}
|
|
512
527
|
},
|
|
513
528
|
async deleteFolder(e) {
|
|
514
529
|
try {
|
|
515
|
-
await
|
|
530
|
+
await x.deleteFolder(e), this.folders = this.folders.filter((t) => t.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
516
531
|
} catch (t) {
|
|
517
|
-
throw this.error =
|
|
532
|
+
throw this.error = g(t), t;
|
|
518
533
|
}
|
|
519
534
|
},
|
|
520
535
|
async reorderFolders(e) {
|
|
521
536
|
try {
|
|
522
|
-
await
|
|
537
|
+
await x.reorderFolders(e);
|
|
523
538
|
const t = new Map(this.folders.map((r) => [r.id, r])), s = [];
|
|
524
539
|
for (const r of e) {
|
|
525
540
|
const i = t.get(r);
|
|
@@ -528,7 +543,7 @@ const De = Ge("messaging", {
|
|
|
528
543
|
sort_order: s.length + 1
|
|
529
544
|
}), t.delete(r));
|
|
530
545
|
}
|
|
531
|
-
const n =
|
|
546
|
+
const n = O(Array.from(t.values()));
|
|
532
547
|
for (const r of n)
|
|
533
548
|
s.push({
|
|
534
549
|
...r,
|
|
@@ -536,12 +551,12 @@ const De = Ge("messaging", {
|
|
|
536
551
|
});
|
|
537
552
|
this.folders = s;
|
|
538
553
|
} catch (t) {
|
|
539
|
-
throw this.error =
|
|
554
|
+
throw this.error = g(t), t;
|
|
540
555
|
}
|
|
541
556
|
},
|
|
542
557
|
async assignToFolder(e, t) {
|
|
543
558
|
try {
|
|
544
|
-
const s = await
|
|
559
|
+
const s = await x.assignFolder(e, t), n = this.conversations.findIndex((o) => o.id === e);
|
|
545
560
|
if (n < 0)
|
|
546
561
|
return;
|
|
547
562
|
const r = this.conversations[n];
|
|
@@ -553,7 +568,7 @@ const De = Ge("messaging", {
|
|
|
553
568
|
folder_id: i
|
|
554
569
|
};
|
|
555
570
|
} catch (s) {
|
|
556
|
-
throw this.error =
|
|
571
|
+
throw this.error = g(s), s;
|
|
557
572
|
}
|
|
558
573
|
},
|
|
559
574
|
async fetchConversations(e, t, s, n) {
|
|
@@ -561,23 +576,23 @@ const De = Ge("messaging", {
|
|
|
561
576
|
try {
|
|
562
577
|
const r = n?.includePresence ?? !0, i = {};
|
|
563
578
|
r && (i.include_presence = 1), e && (i.cursor = e), t && (i.filter = t), typeof s == "string" && s.length > 0 && (i.folder_id = s);
|
|
564
|
-
const o = await
|
|
579
|
+
const o = await h().get("/v1/messaging/conversations", { params: i }), { items: a, nextCursor: c } = H(
|
|
565
580
|
o.data,
|
|
566
581
|
"conversations"
|
|
567
582
|
), f = a.map((d) => {
|
|
568
|
-
const
|
|
569
|
-
(
|
|
583
|
+
const m = this.conversations.find(
|
|
584
|
+
(S) => S.id === d.id
|
|
570
585
|
);
|
|
571
|
-
return
|
|
586
|
+
return $(d, m);
|
|
572
587
|
});
|
|
573
588
|
e ? this.conversations.push(...f) : this.conversations = f, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
574
|
-
const
|
|
589
|
+
const p = {
|
|
575
590
|
data: f,
|
|
576
|
-
has_more: !!
|
|
591
|
+
has_more: !!c
|
|
577
592
|
};
|
|
578
|
-
return
|
|
593
|
+
return c !== void 0 && (p.next_cursor = c), p;
|
|
579
594
|
} catch (r) {
|
|
580
|
-
throw n?.background &&
|
|
595
|
+
throw n?.background && _e(r) || (this.error = g(r)), r;
|
|
581
596
|
} finally {
|
|
582
597
|
this.loading = !1;
|
|
583
598
|
}
|
|
@@ -591,21 +606,21 @@ const De = Ge("messaging", {
|
|
|
591
606
|
includePresence: !1
|
|
592
607
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
593
608
|
} catch (e) {
|
|
594
|
-
const t = e, s =
|
|
595
|
-
return s === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
609
|
+
const t = e, s = de(t.response?.status);
|
|
610
|
+
return s === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + $e(t.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, s === void 0 || De(s) ? (this.backgroundPollRetryAfterUntil = Date.now() + vt(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + ue, !1));
|
|
596
611
|
}
|
|
597
612
|
},
|
|
598
613
|
async fetchConversation(e) {
|
|
599
614
|
this.loading = !0, this.error = null;
|
|
600
615
|
try {
|
|
601
|
-
const t = await
|
|
616
|
+
const t = await h().get(`/v1/messaging/conversations/${e}`, {
|
|
602
617
|
params: { include_presence: 1 }
|
|
603
|
-
}), s = this.conversations.find((o) => o.id === e), n =
|
|
618
|
+
}), s = this.conversations.find((o) => o.id === e), n = $(t.data.data || t.data, s), r = this.conversations.findIndex((o) => o.id === e);
|
|
604
619
|
r >= 0 ? this.conversations[r] = n : this.conversations.push(n);
|
|
605
620
|
const i = this.requests.findIndex((o) => o.id === e);
|
|
606
621
|
return i >= 0 && (this.requests[i] = n), this.normalizeFolderAssignmentsState(), n;
|
|
607
622
|
} catch (t) {
|
|
608
|
-
throw this.error =
|
|
623
|
+
throw this.error = g(t), t;
|
|
609
624
|
} finally {
|
|
610
625
|
this.loading = !1;
|
|
611
626
|
}
|
|
@@ -618,12 +633,12 @@ const De = Ge("messaging", {
|
|
|
618
633
|
filter: "requests"
|
|
619
634
|
};
|
|
620
635
|
e && (t.cursor = e);
|
|
621
|
-
const s = await
|
|
636
|
+
const s = await h().get("/v1/messaging/conversations", { params: t }), { items: n, nextCursor: r } = H(
|
|
622
637
|
s.data,
|
|
623
638
|
"conversations"
|
|
624
639
|
), i = n.map((a) => {
|
|
625
|
-
const
|
|
626
|
-
return
|
|
640
|
+
const c = this.requests.find((f) => f.id === a.id);
|
|
641
|
+
return $(a, c);
|
|
627
642
|
});
|
|
628
643
|
e ? this.requests.push(...i) : this.requests = i, this.normalizeFolderAssignmentsState();
|
|
629
644
|
const o = {
|
|
@@ -632,7 +647,7 @@ const De = Ge("messaging", {
|
|
|
632
647
|
};
|
|
633
648
|
return r !== void 0 && (o.next_cursor = r), o;
|
|
634
649
|
} catch (t) {
|
|
635
|
-
throw this.error =
|
|
650
|
+
throw this.error = g(t), t;
|
|
636
651
|
} finally {
|
|
637
652
|
this.loading = !1;
|
|
638
653
|
}
|
|
@@ -644,111 +659,111 @@ const De = Ge("messaging", {
|
|
|
644
659
|
let n = 0, r;
|
|
645
660
|
for (; ; )
|
|
646
661
|
try {
|
|
647
|
-
r = await
|
|
662
|
+
r = await h().get(`/v1/messaging/conversations/${e}/messages`, { params: s });
|
|
648
663
|
break;
|
|
649
664
|
} catch (d) {
|
|
650
|
-
if (!(n <
|
|
665
|
+
if (!(n < mt && _e(d)))
|
|
651
666
|
throw d;
|
|
652
|
-
n += 1, await
|
|
667
|
+
n += 1, await ye(_t(d));
|
|
653
668
|
}
|
|
654
669
|
const { items: i, nextCursor: o } = H(
|
|
655
670
|
r.data,
|
|
656
671
|
"messages"
|
|
657
|
-
), a = i.map(
|
|
658
|
-
if (t ? this.messages[e] = [...
|
|
659
|
-
const d = this.conversations.find((
|
|
672
|
+
), a = i.map(Y), c = [...a].reverse();
|
|
673
|
+
if (t ? this.messages[e] = [...c, ...this.messages[e] || []] : this.messages[e] = c, (() => {
|
|
674
|
+
const d = this.conversations.find((m) => m.id === e) ?? this.requests.find((m) => m.id === e);
|
|
660
675
|
return d ? !d.last_message || !d.last_message_at : !1;
|
|
661
676
|
})()) {
|
|
662
677
|
const d = this.messages[e]?.at(-1);
|
|
663
678
|
d && this.updateConversationLastMessage(e, d);
|
|
664
679
|
}
|
|
665
680
|
o ? (this.conversationCursors[e] = o, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
666
|
-
const
|
|
681
|
+
const p = {
|
|
667
682
|
data: a,
|
|
668
683
|
has_more: !!o
|
|
669
684
|
};
|
|
670
|
-
return o !== void 0 && (
|
|
685
|
+
return o !== void 0 && (p.next_cursor = o), p;
|
|
671
686
|
} catch (s) {
|
|
672
|
-
throw this.error =
|
|
687
|
+
throw this.error = g(s), s;
|
|
673
688
|
} finally {
|
|
674
689
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
675
690
|
}
|
|
676
691
|
},
|
|
677
692
|
async sendMessage(e, t, s, n, r, i) {
|
|
678
|
-
const o =
|
|
693
|
+
const o = k()(), a = `temp-${Date.now()}-${Math.random()}`, c = typeof i == "string" && i.trim().length > 0 ? i.trim() : null, f = o.currentUser, p = {
|
|
679
694
|
id: a,
|
|
680
695
|
conversation_id: e,
|
|
681
696
|
author_id: f?.id || "",
|
|
682
697
|
body: t || "",
|
|
683
698
|
attachments: [],
|
|
684
|
-
meta:
|
|
699
|
+
meta: c ? { shared_post_id: c } : {},
|
|
685
700
|
is_deleted: !1,
|
|
686
701
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
687
702
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
688
703
|
};
|
|
689
|
-
f && (
|
|
704
|
+
f && (p.author = {
|
|
690
705
|
id: f.id,
|
|
691
706
|
name: f.name,
|
|
692
707
|
...f.avatar ? { avatar: f.avatar } : {},
|
|
693
708
|
...f.handle ? { handle: f.handle } : {}
|
|
694
|
-
}), n != null && (
|
|
709
|
+
}), n != null && (p.reply_to_id = n), r != null && (p.reply_to = r), this.messages[e] || (this.messages[e] = []), this.messages[e].push(p), this._pendingSendIds.add(a);
|
|
695
710
|
try {
|
|
696
711
|
let d;
|
|
697
|
-
const
|
|
712
|
+
const m = {
|
|
698
713
|
body: t || "",
|
|
699
714
|
...n ? { reply_to_id: n } : {},
|
|
700
|
-
...
|
|
715
|
+
...c ? { shared_post_id: c } : {}
|
|
701
716
|
};
|
|
702
717
|
if (s && s.length > 0) {
|
|
703
|
-
const
|
|
704
|
-
s.map(async (
|
|
705
|
-
const
|
|
718
|
+
const l = await Promise.all(
|
|
719
|
+
s.map(async (v) => {
|
|
720
|
+
const A = await ct().uploadImage(v);
|
|
706
721
|
return {
|
|
707
|
-
media_id:
|
|
708
|
-
mime:
|
|
709
|
-
size:
|
|
722
|
+
media_id: A.id,
|
|
723
|
+
mime: A.mime_type,
|
|
724
|
+
size: A.size
|
|
710
725
|
};
|
|
711
726
|
})
|
|
712
727
|
);
|
|
713
|
-
d = await
|
|
714
|
-
...
|
|
715
|
-
attachments:
|
|
728
|
+
d = await h().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
729
|
+
...m,
|
|
730
|
+
attachments: l
|
|
716
731
|
});
|
|
717
732
|
} else
|
|
718
|
-
d = await
|
|
719
|
-
...
|
|
733
|
+
d = await h().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
734
|
+
...m,
|
|
720
735
|
type: "text"
|
|
721
736
|
});
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
const
|
|
725
|
-
let
|
|
726
|
-
for (let
|
|
727
|
-
const
|
|
728
|
-
|
|
737
|
+
const S = d.data.data || d.data, U = { ...p, ...S, attachments: S.attachments ?? p.attachments }, w = Y(U), E = this.messages[e], L = E.findIndex((l) => l.id === a);
|
|
738
|
+
L >= 0 && (E[L] = w), this._pendingSendIds.delete(a);
|
|
739
|
+
const z = w.id;
|
|
740
|
+
let N = 0;
|
|
741
|
+
for (let l = E.length - 1; l >= 0; l--) {
|
|
742
|
+
const v = E[l];
|
|
743
|
+
v && v.id === z && (N++, N > 1 && E.splice(l, 1));
|
|
729
744
|
}
|
|
730
|
-
return this.updateConversationLastMessage(e,
|
|
745
|
+
return this.updateConversationLastMessage(e, w), w;
|
|
731
746
|
} catch (d) {
|
|
732
|
-
throw this._pendingSendIds.delete(a), this.messages[e] = this.messages[e].filter((
|
|
747
|
+
throw this._pendingSendIds.delete(a), this.messages[e] = this.messages[e].filter((m) => m.id !== a), this.error = g(d), d;
|
|
733
748
|
}
|
|
734
749
|
},
|
|
735
750
|
async editMessage(e, t, s) {
|
|
736
751
|
try {
|
|
737
|
-
const n = await
|
|
752
|
+
const n = await h().patch(`/v1/messaging/conversations/${e}/messages/${t}`, {
|
|
738
753
|
body: s
|
|
739
754
|
}), r = n.data.data || n.data, i = this.messages[e] || [], o = i.findIndex((a) => a.id === t);
|
|
740
755
|
if (o >= 0) {
|
|
741
|
-
const a = i[o],
|
|
742
|
-
return i[o] =
|
|
756
|
+
const a = i[o], c = r.id ? { ...a, ...r } : { ...a, body: s, edited_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
757
|
+
return i[o] = c, c;
|
|
743
758
|
}
|
|
744
759
|
return r;
|
|
745
760
|
} catch (n) {
|
|
746
|
-
throw this.error =
|
|
761
|
+
throw this.error = g(n), n;
|
|
747
762
|
}
|
|
748
763
|
},
|
|
749
764
|
async deleteMessage(e, t) {
|
|
750
765
|
try {
|
|
751
|
-
await
|
|
766
|
+
await h().delete(`/v1/messaging/conversations/${e}/messages/${t}`);
|
|
752
767
|
const s = this.messages[e] || [], n = s.findIndex((r) => r.id === t);
|
|
753
768
|
if (n >= 0) {
|
|
754
769
|
const r = s[n];
|
|
@@ -758,7 +773,7 @@ const De = Ge("messaging", {
|
|
|
758
773
|
delete i.body, s[n] = i;
|
|
759
774
|
}
|
|
760
775
|
} catch (s) {
|
|
761
|
-
throw this.error =
|
|
776
|
+
throw this.error = g(s), s;
|
|
762
777
|
}
|
|
763
778
|
},
|
|
764
779
|
async markAsRead(e) {
|
|
@@ -769,14 +784,14 @@ const De = Ge("messaging", {
|
|
|
769
784
|
return null;
|
|
770
785
|
for (let i = r.length - 1; i >= 0; i -= 1) {
|
|
771
786
|
const o = r[i]?.id;
|
|
772
|
-
if (
|
|
787
|
+
if (ie(o))
|
|
773
788
|
return o;
|
|
774
789
|
}
|
|
775
790
|
return null;
|
|
776
|
-
})(), n = t ?
|
|
791
|
+
})(), n = t ? Ce(t, this.messages) : s;
|
|
777
792
|
if (!n)
|
|
778
793
|
return;
|
|
779
|
-
await
|
|
794
|
+
await h().post(`/v1/messaging/conversations/${e}/read`, {
|
|
780
795
|
message_id: n
|
|
781
796
|
}), this.conversations.forEach((r) => {
|
|
782
797
|
r.id === e && (r.unread_count = 0);
|
|
@@ -784,7 +799,7 @@ const De = Ge("messaging", {
|
|
|
784
799
|
r.id === e && (r.unread_count = 0);
|
|
785
800
|
});
|
|
786
801
|
} catch (t) {
|
|
787
|
-
throw this.error =
|
|
802
|
+
throw this.error = g(t), t;
|
|
788
803
|
}
|
|
789
804
|
},
|
|
790
805
|
async markAllAsRead() {
|
|
@@ -792,7 +807,7 @@ const De = Ge("messaging", {
|
|
|
792
807
|
if (e.length === 0)
|
|
793
808
|
return;
|
|
794
809
|
const t = e.map((r) => {
|
|
795
|
-
const i =
|
|
810
|
+
const i = Ce(r, this.messages);
|
|
796
811
|
return i ? {
|
|
797
812
|
conversationId: r.id,
|
|
798
813
|
messageId: i
|
|
@@ -802,7 +817,7 @@ const De = Ge("messaging", {
|
|
|
802
817
|
return;
|
|
803
818
|
const s = await Promise.allSettled(
|
|
804
819
|
t.map(
|
|
805
|
-
(r) =>
|
|
820
|
+
(r) => h().post(`/v1/messaging/conversations/${r.conversationId}/read`, {
|
|
806
821
|
message_id: r.messageId
|
|
807
822
|
})
|
|
808
823
|
)
|
|
@@ -812,46 +827,46 @@ const De = Ge("messaging", {
|
|
|
812
827
|
const o = t[i];
|
|
813
828
|
if (o) {
|
|
814
829
|
if (r.status === "fulfilled") {
|
|
815
|
-
const a = this.conversations.find((
|
|
830
|
+
const a = this.conversations.find((c) => c.id === o.conversationId);
|
|
816
831
|
a && (a.unread_count = 0);
|
|
817
832
|
return;
|
|
818
833
|
}
|
|
819
834
|
n === null && (n = r.reason);
|
|
820
835
|
}
|
|
821
836
|
}), n !== null)
|
|
822
|
-
throw this.error =
|
|
837
|
+
throw this.error = g(n), n;
|
|
823
838
|
},
|
|
824
839
|
async sendTyping(e, t = "start") {
|
|
825
840
|
try {
|
|
826
|
-
const s = await
|
|
827
|
-
if (t !== "start" || !
|
|
841
|
+
const s = await h().post(`/v1/messaging/conversations/${e}/typing`, { state: t });
|
|
842
|
+
if (t !== "start" || !yt(s.data))
|
|
828
843
|
return;
|
|
829
|
-
await
|
|
844
|
+
await ye(pt), await h().post(`/v1/messaging/conversations/${e}/typing`, { state: t });
|
|
830
845
|
} catch (s) {
|
|
831
846
|
console.warn("Failed to send typing indicator:", s);
|
|
832
847
|
}
|
|
833
848
|
},
|
|
834
849
|
async muteConversation(e, t) {
|
|
835
850
|
try {
|
|
836
|
-
const s = { minutes: t }, n = await
|
|
851
|
+
const s = { minutes: t }, n = await h().patch(`/v1/messaging/conversations/${e}/mute`, s), i = (n.data.data || n.data).muted_until || null, o = this.conversations.find((a) => a.id === e);
|
|
837
852
|
o && (o.is_muted = i !== null, o.muted_until = i);
|
|
838
853
|
} catch (s) {
|
|
839
|
-
throw this.error =
|
|
854
|
+
throw this.error = g(s), s;
|
|
840
855
|
}
|
|
841
856
|
},
|
|
842
857
|
async unmuteConversation(e) {
|
|
843
858
|
try {
|
|
844
|
-
const t = await
|
|
859
|
+
const t = await h().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
845
860
|
minutes: 0
|
|
846
861
|
}), n = (t.data.data || t.data).muted_until || null, r = this.conversations.find((i) => i.id === e);
|
|
847
862
|
r && (r.is_muted = n !== null, r.muted_until = n);
|
|
848
863
|
} catch (t) {
|
|
849
|
-
throw this.error =
|
|
864
|
+
throw this.error = g(t), t;
|
|
850
865
|
}
|
|
851
866
|
},
|
|
852
867
|
async updateConversationTitle(e, t) {
|
|
853
868
|
try {
|
|
854
|
-
const s = await
|
|
869
|
+
const s = await h().patch(`/v1/messaging/conversations/${e}`, {
|
|
855
870
|
title: t
|
|
856
871
|
}), n = s.data.data || s.data, r = typeof n?.title == "string" ? n.title : t, i = (o) => o.map((a) => a.id !== e ? a : {
|
|
857
872
|
...a,
|
|
@@ -859,30 +874,30 @@ const De = Ge("messaging", {
|
|
|
859
874
|
});
|
|
860
875
|
this.conversations = i(this.conversations), this.requests = i(this.requests);
|
|
861
876
|
} catch (s) {
|
|
862
|
-
throw this.error =
|
|
877
|
+
throw this.error = g(s), s;
|
|
863
878
|
}
|
|
864
879
|
},
|
|
865
880
|
async pinConversation(e, t) {
|
|
866
881
|
try {
|
|
867
|
-
await
|
|
882
|
+
await h().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: t });
|
|
868
883
|
const s = this.conversations.find((n) => n.id === e);
|
|
869
884
|
s && (s.is_pinned = t), this.conversations.sort(W);
|
|
870
885
|
} catch (s) {
|
|
871
|
-
throw this.error =
|
|
886
|
+
throw this.error = g(s), s;
|
|
872
887
|
}
|
|
873
888
|
},
|
|
874
889
|
async archiveConversation(e, t) {
|
|
875
890
|
try {
|
|
876
|
-
await
|
|
891
|
+
await h().patch(`/v1/messaging/conversations/${e}/archive`, { archived: t }), this.conversations = this.conversations.filter((s) => s.id !== e);
|
|
877
892
|
} catch (s) {
|
|
878
|
-
throw this.error =
|
|
893
|
+
throw this.error = g(s), s;
|
|
879
894
|
}
|
|
880
895
|
},
|
|
881
896
|
async deleteConversation(e) {
|
|
882
897
|
try {
|
|
883
|
-
await
|
|
898
|
+
await h().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((t) => t.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
884
899
|
} catch (t) {
|
|
885
|
-
throw this.error =
|
|
900
|
+
throw this.error = g(t), t;
|
|
886
901
|
}
|
|
887
902
|
},
|
|
888
903
|
async createDMConversation(e, t) {
|
|
@@ -891,52 +906,64 @@ const De = Ge("messaging", {
|
|
|
891
906
|
user_id: e
|
|
892
907
|
};
|
|
893
908
|
t && (s.message = t);
|
|
894
|
-
const n = await
|
|
895
|
-
if (!
|
|
909
|
+
const n = await h().post("/v1/messaging/conversations/dm", s), r = n.data.data || n.data;
|
|
910
|
+
if (!Me(r))
|
|
896
911
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
897
|
-
const i =
|
|
898
|
-
return i.is_request === !0 ? (this.requests =
|
|
912
|
+
const i = Re(r) ? $(r) : await this.fetchConversation(r.id);
|
|
913
|
+
return i.is_request === !0 ? (this.requests = j(this.requests, i), this.conversations = this.conversations.filter((o) => o.id !== i.id), i) : (this.conversations = j(this.conversations, i), this.requests = this.requests.filter((o) => o.id !== i.id), i);
|
|
899
914
|
} catch (s) {
|
|
900
|
-
throw this.error =
|
|
915
|
+
throw this.error = g(s), s;
|
|
901
916
|
}
|
|
902
917
|
},
|
|
903
918
|
async createGroupConversation(e, t) {
|
|
904
919
|
try {
|
|
905
|
-
const s = await
|
|
920
|
+
const s = await h().post("/v1/messaging/conversations/group", {
|
|
906
921
|
title: e,
|
|
907
922
|
participant_ids: t
|
|
908
923
|
}), n = s.data.data || s.data;
|
|
909
|
-
if (!
|
|
924
|
+
if (!Me(n))
|
|
910
925
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
911
|
-
const r =
|
|
912
|
-
return this.conversations =
|
|
926
|
+
const r = Re(n) ? n : await this.fetchConversation(n.id);
|
|
927
|
+
return this.conversations = j(this.conversations, r), r;
|
|
913
928
|
} catch (s) {
|
|
914
|
-
throw this.error =
|
|
929
|
+
throw this.error = g(s), s;
|
|
915
930
|
}
|
|
916
931
|
},
|
|
917
932
|
async addParticipants(e, t) {
|
|
918
933
|
try {
|
|
919
|
-
await
|
|
934
|
+
await h().post(`/v1/messaging/conversations/${e}/participants`, {
|
|
920
935
|
user_ids: t
|
|
921
936
|
// Changed from participant_ids to user_ids to match backend
|
|
922
937
|
}), await this.fetchConversation(e);
|
|
923
938
|
} catch (s) {
|
|
924
|
-
throw this.error =
|
|
939
|
+
throw this.error = g(s), s;
|
|
925
940
|
}
|
|
926
941
|
},
|
|
927
942
|
async removeParticipant(e, t) {
|
|
928
943
|
try {
|
|
929
|
-
await
|
|
930
|
-
const s =
|
|
944
|
+
await h().delete(`/v1/messaging/conversations/${e}/participants/${t}`);
|
|
945
|
+
const s = k()();
|
|
931
946
|
if (t === s.currentUser?.id) {
|
|
932
947
|
this.conversations = this.conversations.filter((n) => n.id !== e), this.requests = this.requests.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
933
948
|
return;
|
|
934
949
|
}
|
|
935
950
|
await this.fetchConversation(e);
|
|
936
951
|
} catch (s) {
|
|
937
|
-
throw this.error =
|
|
952
|
+
throw this.error = g(s), s;
|
|
938
953
|
}
|
|
939
954
|
},
|
|
955
|
+
applyParticipantReadState(e) {
|
|
956
|
+
const t = this.getConversationById(e.conversation_id);
|
|
957
|
+
if (!t)
|
|
958
|
+
return;
|
|
959
|
+
let s = !1;
|
|
960
|
+
const n = t.participants.map((o) => o.user_id !== e.user_id || o.last_read_message_id === e.message_id ? o : (s = !0, {
|
|
961
|
+
...o,
|
|
962
|
+
last_read_message_id: e.message_id
|
|
963
|
+
}));
|
|
964
|
+
s && (t.participants = n), !this.getMessagesByConversationId(e.conversation_id).some((o) => o.id === e.message_id) && this.fetchConversation(e.conversation_id).catch(() => {
|
|
965
|
+
});
|
|
966
|
+
},
|
|
940
967
|
// Real-time event handlers
|
|
941
968
|
// Accepts messages with any attachment shape — broadcast events use MessageAttachment[]
|
|
942
969
|
// while the store uses Attachment[]. normalizeMessage converts either format.
|
|
@@ -945,25 +972,25 @@ const De = Ge("messaging", {
|
|
|
945
972
|
if (!t)
|
|
946
973
|
return;
|
|
947
974
|
this.messages[t] || (this.messages[t] = []);
|
|
948
|
-
const s =
|
|
949
|
-
if (n.find((
|
|
975
|
+
const s = Y({ ...e, attachments: e.attachments ?? [] }), n = this.messages[t];
|
|
976
|
+
if (n.find((c) => c.id === s.id))
|
|
950
977
|
return;
|
|
951
|
-
const i =
|
|
978
|
+
const i = k()();
|
|
952
979
|
if (s.author_id === i.currentUser?.id) {
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
const f = n[
|
|
956
|
-
n[
|
|
980
|
+
const c = n.findIndex((f) => f.id.startsWith("temp-"));
|
|
981
|
+
if (c >= 0) {
|
|
982
|
+
const f = n[c]?.id ?? "";
|
|
983
|
+
n[c] = s, this._pendingSendIds.delete(f), this.updateConversationLastMessage(t, s);
|
|
957
984
|
return;
|
|
958
985
|
}
|
|
959
986
|
}
|
|
960
987
|
const o = s.created_at;
|
|
961
988
|
let a = n.length;
|
|
962
|
-
for (let
|
|
963
|
-
const f = n[
|
|
989
|
+
for (let c = n.length - 1; c >= 0; c--) {
|
|
990
|
+
const f = n[c];
|
|
964
991
|
if (f && f.created_at <= o)
|
|
965
992
|
break;
|
|
966
|
-
a =
|
|
993
|
+
a = c;
|
|
967
994
|
}
|
|
968
995
|
n.splice(a, 0, s), a === n.length - 1 && this.updateConversationLastMessage(t, s);
|
|
969
996
|
},
|
|
@@ -972,27 +999,27 @@ const De = Ge("messaging", {
|
|
|
972
999
|
s >= 0 && (t[s] = e);
|
|
973
1000
|
},
|
|
974
1001
|
removeMessage(e, t) {
|
|
975
|
-
const s = (
|
|
976
|
-
const f = { ...
|
|
1002
|
+
const s = (c) => {
|
|
1003
|
+
const f = { ...c, is_deleted: !0 };
|
|
977
1004
|
return delete f.body, f;
|
|
978
1005
|
};
|
|
979
1006
|
let n = null;
|
|
980
|
-
const r = this.conversations.find((
|
|
1007
|
+
const r = this.conversations.find((c) => c.id === e);
|
|
981
1008
|
r?.last_message?.id === t && (n = s(r.last_message), r.last_message = n);
|
|
982
|
-
const i = this.requests.find((
|
|
1009
|
+
const i = this.requests.find((c) => c.id === e);
|
|
983
1010
|
if (i?.last_message?.id === t) {
|
|
984
|
-
const
|
|
985
|
-
i.last_message =
|
|
1011
|
+
const c = s(i.last_message);
|
|
1012
|
+
i.last_message = c, n === null && (n = c);
|
|
986
1013
|
}
|
|
987
1014
|
const o = this.messages[e];
|
|
988
1015
|
if (!o) {
|
|
989
1016
|
n && this.addMessage(n);
|
|
990
1017
|
return;
|
|
991
1018
|
}
|
|
992
|
-
const a = o.findIndex((
|
|
1019
|
+
const a = o.findIndex((c) => c.id === t);
|
|
993
1020
|
if (a >= 0) {
|
|
994
|
-
const
|
|
995
|
-
|
|
1021
|
+
const c = o[a];
|
|
1022
|
+
c && (o[a] = s(c));
|
|
996
1023
|
return;
|
|
997
1024
|
}
|
|
998
1025
|
n && this.addMessage(n);
|
|
@@ -1002,25 +1029,25 @@ const De = Ge("messaging", {
|
|
|
1002
1029
|
try {
|
|
1003
1030
|
let a;
|
|
1004
1031
|
try {
|
|
1005
|
-
a = await
|
|
1032
|
+
a = await h().post(n, r);
|
|
1006
1033
|
} catch (d) {
|
|
1007
|
-
if (!
|
|
1034
|
+
if (!Ft(d))
|
|
1008
1035
|
throw d;
|
|
1009
|
-
a = await
|
|
1036
|
+
a = await h().post(n, r);
|
|
1010
1037
|
}
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1038
|
+
const c = C(a.data) && "data" in a.data ? a.data.data : a.data, f = Se(
|
|
1039
|
+
C(c) ? c.reactions : void 0
|
|
1013
1040
|
);
|
|
1014
1041
|
(f.length > 0 || o.length === 0) && this.updateMessageReactions(e, t, f);
|
|
1015
1042
|
try {
|
|
1016
|
-
const d = await
|
|
1017
|
-
|
|
1043
|
+
const d = await h().get(n), m = C(d.data) && "data" in d.data ? d.data.data : d.data, S = Se(
|
|
1044
|
+
C(m) ? m.reactions : void 0
|
|
1018
1045
|
);
|
|
1019
|
-
this.updateMessageReactions(e, t,
|
|
1046
|
+
this.updateMessageReactions(e, t, S);
|
|
1020
1047
|
} catch {
|
|
1021
1048
|
}
|
|
1022
1049
|
} catch (a) {
|
|
1023
|
-
throw this.error =
|
|
1050
|
+
throw this.error = g(a), a;
|
|
1024
1051
|
}
|
|
1025
1052
|
},
|
|
1026
1053
|
updateMessageReactions(e, t, s) {
|
|
@@ -1054,24 +1081,24 @@ const De = Ge("messaging", {
|
|
|
1054
1081
|
},
|
|
1055
1082
|
async acceptRequest(e) {
|
|
1056
1083
|
try {
|
|
1057
|
-
const t = await
|
|
1084
|
+
const t = await x.acceptRequest(e);
|
|
1058
1085
|
this.requests = this.requests.filter((n) => n.id !== e);
|
|
1059
|
-
const s =
|
|
1086
|
+
const s = $({
|
|
1060
1087
|
...t,
|
|
1061
1088
|
is_pinned: t.is_pinned ?? !1,
|
|
1062
1089
|
is_archived: t.is_archived ?? !1,
|
|
1063
1090
|
is_muted: t.is_muted ?? !1
|
|
1064
1091
|
});
|
|
1065
|
-
this.conversations =
|
|
1092
|
+
this.conversations = j(this.conversations, s);
|
|
1066
1093
|
} catch (t) {
|
|
1067
|
-
throw this.error =
|
|
1094
|
+
throw this.error = g(t), t;
|
|
1068
1095
|
}
|
|
1069
1096
|
},
|
|
1070
1097
|
async declineRequest(e) {
|
|
1071
1098
|
try {
|
|
1072
|
-
await
|
|
1099
|
+
await x.declineRequest(e), this.requests = this.requests.filter((t) => t.id !== e);
|
|
1073
1100
|
} catch (t) {
|
|
1074
|
-
throw this.error =
|
|
1101
|
+
throw this.error = g(t), t;
|
|
1075
1102
|
}
|
|
1076
1103
|
},
|
|
1077
1104
|
async searchConversations(e, t, s) {
|
|
@@ -1079,7 +1106,7 @@ const De = Ge("messaging", {
|
|
|
1079
1106
|
try {
|
|
1080
1107
|
const n = { search: e, limit: 20 };
|
|
1081
1108
|
t && (n.filter = t), typeof s == "string" && s.length > 0 && (n.folder_id = s);
|
|
1082
|
-
const r = await
|
|
1109
|
+
const r = await h().get("/v1/messaging/conversations", {
|
|
1083
1110
|
params: n
|
|
1084
1111
|
}), { items: i } = H(
|
|
1085
1112
|
r.data,
|
|
@@ -1087,7 +1114,7 @@ const De = Ge("messaging", {
|
|
|
1087
1114
|
);
|
|
1088
1115
|
return i;
|
|
1089
1116
|
} catch (n) {
|
|
1090
|
-
return this.error =
|
|
1117
|
+
return this.error = g(n), [];
|
|
1091
1118
|
} finally {
|
|
1092
1119
|
this.searchLoading = !1;
|
|
1093
1120
|
}
|
|
@@ -1095,12 +1122,12 @@ const De = Ge("messaging", {
|
|
|
1095
1122
|
async searchMessages(e, t) {
|
|
1096
1123
|
this.searchLoading = !0;
|
|
1097
1124
|
try {
|
|
1098
|
-
const s = await
|
|
1125
|
+
const s = await h().get(`/v1/messaging/conversations/${e}/search`, {
|
|
1099
1126
|
params: { q: t }
|
|
1100
1127
|
}), n = s.data.data || s.data || [];
|
|
1101
1128
|
return this.searchResults = n, n;
|
|
1102
1129
|
} catch (s) {
|
|
1103
|
-
return this.error =
|
|
1130
|
+
return this.error = g(s), [];
|
|
1104
1131
|
} finally {
|
|
1105
1132
|
this.searchLoading = !1;
|
|
1106
1133
|
}
|
|
@@ -1140,117 +1167,114 @@ const De = Ge("messaging", {
|
|
|
1140
1167
|
}
|
|
1141
1168
|
}
|
|
1142
1169
|
});
|
|
1143
|
-
function
|
|
1144
|
-
const t =
|
|
1145
|
-
let
|
|
1146
|
-
const
|
|
1147
|
-
d && (clearTimeout(d), d = null),
|
|
1148
|
-
},
|
|
1149
|
-
!a || n.value || d ||
|
|
1150
|
-
d = null,
|
|
1170
|
+
function Wt(e) {
|
|
1171
|
+
const t = Oe(), s = k()(), n = J(!1), r = J(null), i = J(null), o = Ae(), a = o !== null, c = 20, f = 250;
|
|
1172
|
+
let p = 0, d = null, m = null;
|
|
1173
|
+
const S = K(() => s.currentUser?.id), U = () => Ve(e)?.trim() ?? "", w = () => {
|
|
1174
|
+
d && (clearTimeout(d), d = null), p = 0;
|
|
1175
|
+
}, E = () => {
|
|
1176
|
+
!a || n.value || d || p >= c || (d = setTimeout(() => {
|
|
1177
|
+
d = null, p += 1, q();
|
|
1151
1178
|
}, f));
|
|
1152
|
-
},
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1179
|
+
}, L = (u) => {
|
|
1180
|
+
if (t.addMessage(u.message), u.message.author_id !== S.value) {
|
|
1181
|
+
const _ = t.getConversationById(u.conversation_id);
|
|
1182
|
+
_ && (_.unread_count = 0), t.markAsRead(u.conversation_id).catch(() => {
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
}, z = (u) => {
|
|
1186
|
+
t.applyParticipantReadState(u);
|
|
1187
|
+
}, N = (u) => {
|
|
1188
|
+
const _ = t.getMessagesByConversationId(u.conversation_id), P = _.findIndex((T) => T.id === u.message.id);
|
|
1189
|
+
if (P >= 0) {
|
|
1190
|
+
const T = _[P];
|
|
1191
|
+
if (!T) return;
|
|
1192
|
+
const F = { ...T };
|
|
1193
|
+
u.message.body !== void 0 && (F.body = u.message.body), u.message.edited_at !== void 0 && (F.edited_at = u.message.edited_at), u.message.meta !== void 0 && (F.meta = u.message.meta), _[P] = F;
|
|
1194
|
+
const Q = t.getConversationById(u.conversation_id);
|
|
1195
|
+
Q && Q.last_message?.id === u.message.id && (Q.last_message = F);
|
|
1196
|
+
}
|
|
1197
|
+
}, l = (u) => {
|
|
1198
|
+
t.removeMessage(u.conversation_id, u.message_id);
|
|
1199
|
+
}, v = (u) => {
|
|
1200
|
+
t.updateMessageReactions(
|
|
1201
|
+
u.conversation_id,
|
|
1202
|
+
u.message_id,
|
|
1203
|
+
u.reactions
|
|
1204
|
+
);
|
|
1205
|
+
}, A = (u) => {
|
|
1206
|
+
const _ = t.getConversationById(u.conversation_id);
|
|
1207
|
+
_ && (_.is_request = !1), t.requests = t.requests.filter(
|
|
1208
|
+
(P) => P.id !== u.conversation_id
|
|
1209
|
+
);
|
|
1210
|
+
};
|
|
1211
|
+
let b = null;
|
|
1212
|
+
const V = (u) => {
|
|
1213
|
+
u.removed_user_id === S.value && (b?.(), t.deleteConversation(u.conversation_id).catch(() => {
|
|
1214
|
+
}));
|
|
1215
|
+
}, q = () => {
|
|
1216
|
+
const u = U();
|
|
1217
|
+
if (!(n.value || !u)) {
|
|
1218
|
+
if (!G()) {
|
|
1219
|
+
E();
|
|
1157
1220
|
return;
|
|
1158
1221
|
}
|
|
1159
1222
|
r.value = null;
|
|
1160
1223
|
try {
|
|
1161
|
-
|
|
1162
|
-
onMessageSent:
|
|
1163
|
-
onMessageRead:
|
|
1164
|
-
onMessageEdited:
|
|
1165
|
-
onMessageDeleted:
|
|
1166
|
-
onReactionToggled:
|
|
1167
|
-
onRequestAccepted:
|
|
1168
|
-
onParticipantRemoved:
|
|
1169
|
-
}), n.value = !0, i.value =
|
|
1170
|
-
} catch (
|
|
1171
|
-
r.value =
|
|
1224
|
+
m = Qe(u, {
|
|
1225
|
+
onMessageSent: L,
|
|
1226
|
+
onMessageRead: z,
|
|
1227
|
+
onMessageEdited: N,
|
|
1228
|
+
onMessageDeleted: l,
|
|
1229
|
+
onReactionToggled: v,
|
|
1230
|
+
onRequestAccepted: A,
|
|
1231
|
+
onParticipantRemoved: V
|
|
1232
|
+
}), n.value = !0, i.value = u, t.registerDetailSubscription(u), w();
|
|
1233
|
+
} catch (_) {
|
|
1234
|
+
r.value = _ instanceof Error ? _.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", _);
|
|
1172
1235
|
}
|
|
1173
1236
|
}
|
|
1174
|
-
},
|
|
1175
|
-
n.value ||
|
|
1237
|
+
}, I = () => {
|
|
1238
|
+
n.value || q();
|
|
1176
1239
|
};
|
|
1177
|
-
typeof window < "u" && window.addEventListener(
|
|
1178
|
-
const
|
|
1179
|
-
if (
|
|
1180
|
-
n.value ||
|
|
1240
|
+
typeof window < "u" && window.addEventListener(ge(), I);
|
|
1241
|
+
const R = Le((u) => {
|
|
1242
|
+
if (u === "connected") {
|
|
1243
|
+
n.value || q();
|
|
1181
1244
|
return;
|
|
1182
1245
|
}
|
|
1183
|
-
(
|
|
1184
|
-
}),
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1246
|
+
(u === "disconnected" || u === "error") && (w(), m && (m(), m = null), i.value && (t.unregisterDetailSubscription(i.value), i.value = null), n.value = !1);
|
|
1247
|
+
}), M = () => {
|
|
1248
|
+
const u = i.value;
|
|
1249
|
+
if (w(), !(!n.value || !u))
|
|
1187
1250
|
try {
|
|
1188
|
-
|
|
1189
|
-
} catch (
|
|
1190
|
-
r.value =
|
|
1251
|
+
m && (m(), m = null), t.hasGlobalConversationSubscription(u) || Je(u), n.value = !1, t.unregisterDetailSubscription(u), i.value = null, r.value = null;
|
|
1252
|
+
} catch (_) {
|
|
1253
|
+
r.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1191
1254
|
}
|
|
1192
|
-
}, E = (c) => {
|
|
1193
|
-
if (t.addMessage(c.message), c.message.author_id !== F.value) {
|
|
1194
|
-
const g = t.getConversationById(c.conversation_id);
|
|
1195
|
-
g && (g.unread_count = 0), t.markAsRead(c.conversation_id).catch(() => {
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
}, b = (c) => {
|
|
1199
|
-
const g = t.getConversationById(c.conversation_id);
|
|
1200
|
-
if (g) {
|
|
1201
|
-
let w = !1;
|
|
1202
|
-
const R = g.participants.map((S) => S.user_id !== c.user_id || S.last_read_message_id === c.message_id ? S : (w = !0, {
|
|
1203
|
-
...S,
|
|
1204
|
-
last_read_message_id: c.message_id
|
|
1205
|
-
}));
|
|
1206
|
-
w && (g.participants = R);
|
|
1207
|
-
}
|
|
1208
|
-
}, z = (c) => {
|
|
1209
|
-
const g = t.getMessagesByConversationId(c.conversation_id), w = g.findIndex((R) => R.id === c.message.id);
|
|
1210
|
-
if (w >= 0) {
|
|
1211
|
-
const R = g[w];
|
|
1212
|
-
if (!R) return;
|
|
1213
|
-
const S = { ...R };
|
|
1214
|
-
c.message.body !== void 0 && (S.body = c.message.body), c.message.edited_at !== void 0 && (S.edited_at = c.message.edited_at), c.message.meta !== void 0 && (S.meta = c.message.meta), g[w] = S;
|
|
1215
|
-
const q = t.getConversationById(c.conversation_id);
|
|
1216
|
-
q && q.last_message?.id === c.message.id && (q.last_message = S);
|
|
1217
|
-
}
|
|
1218
|
-
}, G = (c) => {
|
|
1219
|
-
t.removeMessage(c.conversation_id, c.message_id);
|
|
1220
|
-
}, k = (c) => {
|
|
1221
|
-
t.updateMessageReactions(
|
|
1222
|
-
c.conversation_id,
|
|
1223
|
-
c.message_id,
|
|
1224
|
-
c.reactions
|
|
1225
|
-
);
|
|
1226
|
-
}, V = (c) => {
|
|
1227
|
-
const g = t.getConversationById(c.conversation_id);
|
|
1228
|
-
g && (g.is_request = !1), t.requests = t.requests.filter(
|
|
1229
|
-
(w) => w.id !== c.conversation_id
|
|
1230
|
-
);
|
|
1231
|
-
}, C = (c) => {
|
|
1232
|
-
c.removed_user_id === F.value && (v(), t.deleteConversation(c.conversation_id).catch(() => {
|
|
1233
|
-
}));
|
|
1234
1255
|
};
|
|
1235
|
-
return o !== null &&
|
|
1236
|
-
|
|
1256
|
+
return b = M, o !== null && Ee(() => {
|
|
1257
|
+
w(), R(), M(), typeof window < "u" && window.removeEventListener(ge(), I);
|
|
1237
1258
|
}), {
|
|
1238
|
-
isSubscribed:
|
|
1239
|
-
error:
|
|
1240
|
-
subscribe:
|
|
1241
|
-
unsubscribe:
|
|
1259
|
+
isSubscribed: K(() => n.value),
|
|
1260
|
+
error: K(() => r.value),
|
|
1261
|
+
subscribe: q,
|
|
1262
|
+
unsubscribe: M
|
|
1242
1263
|
};
|
|
1243
1264
|
}
|
|
1244
|
-
const
|
|
1265
|
+
const Ge = () => {
|
|
1245
1266
|
};
|
|
1246
|
-
let
|
|
1247
|
-
function
|
|
1248
|
-
|
|
1267
|
+
let le = Ge;
|
|
1268
|
+
function qt() {
|
|
1269
|
+
return le;
|
|
1270
|
+
}
|
|
1271
|
+
function Pt(e) {
|
|
1272
|
+
le = e;
|
|
1249
1273
|
}
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1274
|
+
function Lt() {
|
|
1275
|
+
le = Ge;
|
|
1252
1276
|
}
|
|
1253
|
-
const
|
|
1277
|
+
const Nt = {
|
|
1254
1278
|
debug: () => {
|
|
1255
1279
|
},
|
|
1256
1280
|
info: () => {
|
|
@@ -1259,189 +1283,182 @@ const Tt = {
|
|
|
1259
1283
|
},
|
|
1260
1284
|
error: () => {
|
|
1261
1285
|
}
|
|
1262
|
-
},
|
|
1263
|
-
let
|
|
1264
|
-
function
|
|
1265
|
-
|
|
1286
|
+
}, ke = () => Nt;
|
|
1287
|
+
let fe = ke;
|
|
1288
|
+
function Ut() {
|
|
1289
|
+
return fe;
|
|
1266
1290
|
}
|
|
1267
|
-
function
|
|
1268
|
-
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1291
|
+
function zt(e) {
|
|
1292
|
+
fe = e;
|
|
1293
|
+
}
|
|
1294
|
+
function It() {
|
|
1295
|
+
fe = ke;
|
|
1296
|
+
}
|
|
1297
|
+
const ne = Ut()("GlobalMessaging"), Dt = 3, $t = (e) => e.replace(/\/+$/, ""), Ot = (e) => $t(window.location.pathname) === `/messages/${e}`, Gt = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1298
|
+
function Zt() {
|
|
1299
|
+
const e = Oe(), t = k()(), s = qt(), n = We(), r = Ae(), { conversations: i } = He(e), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
1300
|
+
let c = !1;
|
|
1301
|
+
function f(l) {
|
|
1302
|
+
const v = a.get(l);
|
|
1303
|
+
if (v && (a.delete(l), typeof v.channel.stopListening == "function"))
|
|
1304
|
+
for (const A of v.bindings)
|
|
1278
1305
|
try {
|
|
1279
|
-
v.channel.stopListening(
|
|
1306
|
+
v.channel.stopListening(A.event, A.handler);
|
|
1280
1307
|
} catch {
|
|
1281
1308
|
}
|
|
1282
1309
|
}
|
|
1283
|
-
function
|
|
1284
|
-
for (const
|
|
1285
|
-
|
|
1286
|
-
|
|
1310
|
+
function p() {
|
|
1311
|
+
for (const l of o)
|
|
1312
|
+
f(l), e.unregisterGlobalConversationSubscription(l);
|
|
1313
|
+
o.clear();
|
|
1287
1314
|
}
|
|
1288
|
-
function
|
|
1289
|
-
const v =
|
|
1290
|
-
if (!v ||
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
const w = c.participants.map((R) => R.user_id !== C.user_id || R.last_read_message_id === C.message_id ? R : (g = !0, {
|
|
1297
|
-
...R,
|
|
1298
|
-
last_read_message_id: C.message_id
|
|
1299
|
-
}));
|
|
1300
|
-
g && (c.participants = w);
|
|
1301
|
-
}, b = `conversation.${h}`;
|
|
1302
|
-
u(h);
|
|
1303
|
-
const z = v.private(b), G = (C) => {
|
|
1304
|
-
if (!Je(C)) {
|
|
1305
|
-
se.warn("Dropping malformed ConversationMessageSent event", C);
|
|
1315
|
+
function d(l) {
|
|
1316
|
+
const v = G();
|
|
1317
|
+
if (!v || o.has(l)) return;
|
|
1318
|
+
const A = `conversation.${l}`;
|
|
1319
|
+
f(l);
|
|
1320
|
+
const b = v.private(A), V = (R) => {
|
|
1321
|
+
if (!tt(R)) {
|
|
1322
|
+
ne.warn("Dropping malformed ConversationMessageSent event", R);
|
|
1306
1323
|
return;
|
|
1307
1324
|
}
|
|
1308
|
-
const
|
|
1309
|
-
if (!
|
|
1310
|
-
e.addMessage(
|
|
1311
|
-
const
|
|
1312
|
-
if (
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1325
|
+
const M = R, u = t.currentUser?.id;
|
|
1326
|
+
if (!u || M.message.author_id === u) return;
|
|
1327
|
+
e.addMessage(M.message);
|
|
1328
|
+
const _ = e.hasDetailSubscription(M.conversation_id), P = Ot(M.conversation_id);
|
|
1329
|
+
if (_ || P) {
|
|
1330
|
+
const F = e.getConversationById(M.conversation_id);
|
|
1331
|
+
F && (F.unread_count = 0), e.markAsRead(M.conversation_id).catch(() => {
|
|
1315
1332
|
});
|
|
1316
1333
|
return;
|
|
1317
1334
|
}
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1335
|
+
const T = e.getConversationById(M.conversation_id);
|
|
1336
|
+
if (T) {
|
|
1337
|
+
const F = Gt(T);
|
|
1338
|
+
F || T.unread_count++, s(F);
|
|
1322
1339
|
}
|
|
1323
|
-
},
|
|
1324
|
-
if (!
|
|
1325
|
-
|
|
1340
|
+
}, q = (R) => {
|
|
1341
|
+
if (!st(R)) {
|
|
1342
|
+
ne.warn("Dropping malformed ConversationMessageRead event", R);
|
|
1326
1343
|
return;
|
|
1327
1344
|
}
|
|
1328
|
-
|
|
1329
|
-
},
|
|
1330
|
-
if (!
|
|
1331
|
-
|
|
1345
|
+
e.applyParticipantReadState(R);
|
|
1346
|
+
}, I = (R) => {
|
|
1347
|
+
if (!nt(R)) {
|
|
1348
|
+
ne.warn("Dropping malformed ConversationRequestAccepted event", R);
|
|
1332
1349
|
return;
|
|
1333
1350
|
}
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
(
|
|
1351
|
+
const M = R, u = e.getConversationById(M.conversation_id);
|
|
1352
|
+
u && (u.is_request = !1), e.requests = e.requests.filter(
|
|
1353
|
+
(_) => _.id !== M.conversation_id
|
|
1337
1354
|
);
|
|
1338
1355
|
};
|
|
1339
|
-
|
|
1340
|
-
channel:
|
|
1356
|
+
b.listen(".ConversationMessageSent", V), b.listen(".ConversationMessageRead", q), b.listen(".ConversationRequestAccepted", I), a.set(l, {
|
|
1357
|
+
channel: b,
|
|
1341
1358
|
bindings: [
|
|
1342
|
-
{ event: ".ConversationMessageSent", handler:
|
|
1343
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1344
|
-
{ event: ".ConversationRequestAccepted", handler:
|
|
1359
|
+
{ event: ".ConversationMessageSent", handler: V },
|
|
1360
|
+
{ event: ".ConversationMessageRead", handler: q },
|
|
1361
|
+
{ event: ".ConversationRequestAccepted", handler: I }
|
|
1345
1362
|
]
|
|
1346
|
-
}),
|
|
1363
|
+
}), o.add(l), e.registerGlobalConversationSubscription(l);
|
|
1347
1364
|
}
|
|
1348
|
-
function
|
|
1349
|
-
const
|
|
1350
|
-
if (!
|
|
1351
|
-
|
|
1365
|
+
function m() {
|
|
1366
|
+
const l = G();
|
|
1367
|
+
if (!l) {
|
|
1368
|
+
p();
|
|
1352
1369
|
return;
|
|
1353
1370
|
}
|
|
1354
|
-
for (const v of
|
|
1355
|
-
|
|
1371
|
+
for (const v of o) {
|
|
1372
|
+
f(v);
|
|
1356
1373
|
try {
|
|
1357
|
-
|
|
1374
|
+
l.leave(`conversation.${v}`);
|
|
1358
1375
|
} catch {
|
|
1359
1376
|
}
|
|
1360
1377
|
e.unregisterGlobalConversationSubscription(v);
|
|
1361
1378
|
}
|
|
1362
|
-
|
|
1379
|
+
o.clear();
|
|
1363
1380
|
}
|
|
1364
|
-
function
|
|
1365
|
-
const
|
|
1366
|
-
if (!
|
|
1367
|
-
const v = e.conversations.slice(0,
|
|
1368
|
-
for (const b of
|
|
1369
|
-
if (!
|
|
1381
|
+
function S() {
|
|
1382
|
+
const l = G();
|
|
1383
|
+
if (!l) return;
|
|
1384
|
+
const v = e.conversations.slice(0, Dt), A = new Set(v.map((b) => b.id));
|
|
1385
|
+
for (const b of o)
|
|
1386
|
+
if (!A.has(b) && !e.hasDetailSubscription(b)) {
|
|
1370
1387
|
try {
|
|
1371
|
-
|
|
1388
|
+
f(b), l.leave(`conversation.${b}`);
|
|
1372
1389
|
} catch {
|
|
1373
1390
|
}
|
|
1374
|
-
|
|
1391
|
+
o.delete(b), e.unregisterGlobalConversationSubscription(b);
|
|
1375
1392
|
}
|
|
1376
1393
|
for (const b of v)
|
|
1377
|
-
|
|
1394
|
+
d(b.id);
|
|
1378
1395
|
}
|
|
1379
|
-
function
|
|
1380
|
-
e.updatePresenceForUser(
|
|
1396
|
+
function U(l) {
|
|
1397
|
+
e.updatePresenceForUser(l.user_id, l.status);
|
|
1381
1398
|
}
|
|
1382
|
-
function
|
|
1383
|
-
!
|
|
1399
|
+
function w() {
|
|
1400
|
+
!G() || c || (Ze(U), c = !0);
|
|
1384
1401
|
}
|
|
1385
|
-
function
|
|
1386
|
-
|
|
1402
|
+
function E() {
|
|
1403
|
+
c && (Xe(), c = !1);
|
|
1387
1404
|
}
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1405
|
+
const L = he(
|
|
1406
|
+
i,
|
|
1390
1407
|
() => {
|
|
1391
|
-
|
|
1408
|
+
S();
|
|
1392
1409
|
},
|
|
1393
1410
|
{ deep: !1, immediate: !0 }
|
|
1394
|
-
),
|
|
1395
|
-
() =>
|
|
1411
|
+
), z = he(
|
|
1412
|
+
() => n.fullPath,
|
|
1396
1413
|
() => {
|
|
1397
|
-
|
|
1414
|
+
S();
|
|
1398
1415
|
}
|
|
1399
|
-
),
|
|
1400
|
-
|
|
1416
|
+
), N = Le((l) => {
|
|
1417
|
+
l === "connected" ? (p(), S(), E(), w()) : (l === "disconnected" || l === "error") && (p(), E());
|
|
1401
1418
|
});
|
|
1402
|
-
|
|
1403
|
-
|
|
1419
|
+
S(), w(), r !== null && Ee(() => {
|
|
1420
|
+
L(), z(), N(), m(), E();
|
|
1404
1421
|
});
|
|
1405
1422
|
}
|
|
1406
|
-
function
|
|
1407
|
-
e.apiClient &&
|
|
1423
|
+
function Xt(e) {
|
|
1424
|
+
e.apiClient && rt(e.apiClient), e.authStore && ot(e.authStore), e.mediaApi && ut(e.mediaApi), e.createLogger && zt(e.createLogger), e.playMessageNotification && Pt(e.playMessageNotification), e.echo && Ke(e.echo);
|
|
1408
1425
|
}
|
|
1409
|
-
function
|
|
1410
|
-
|
|
1426
|
+
function Qt() {
|
|
1427
|
+
it(), at(), dt(), It(), Lt(), et();
|
|
1411
1428
|
}
|
|
1412
1429
|
export {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
Ze as
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1430
|
+
Xt as configureMessengerClient,
|
|
1431
|
+
h as getApi,
|
|
1432
|
+
k as getAuthStore,
|
|
1433
|
+
G as getEcho,
|
|
1434
|
+
ge as getEchoInitializedEvent,
|
|
1435
|
+
g as getErrorMessage,
|
|
1436
|
+
Ut as getLoggerFactory,
|
|
1437
|
+
ct as getMediaApi,
|
|
1438
|
+
Yt as hasResponse,
|
|
1439
|
+
es as isAxiosError,
|
|
1440
|
+
jt as isError,
|
|
1441
|
+
st as isValidMessageReadEvent,
|
|
1442
|
+
tt as isValidMessageSentEvent,
|
|
1443
|
+
nt as isValidRequestAcceptedEvent,
|
|
1444
|
+
x as messagingApi,
|
|
1445
|
+
Le as onConnectionStatusChange,
|
|
1446
|
+
et as resetEchoRuntimeConfig,
|
|
1447
|
+
It as resetLoggerFactory,
|
|
1448
|
+
it as resetMessagingApiClient,
|
|
1449
|
+
at as resetMessagingAuthStoreResolver,
|
|
1450
|
+
dt as resetMessagingMediaApi,
|
|
1451
|
+
Qt as resetMessengerClientConfig,
|
|
1452
|
+
Ke as setEchoRuntimeConfig,
|
|
1453
|
+
zt as setLoggerFactory,
|
|
1454
|
+
rt as setMessagingApiClient,
|
|
1455
|
+
ot as setMessagingAuthStoreResolver,
|
|
1456
|
+
ut as setMessagingMediaApi,
|
|
1457
|
+
Qe as subscribeToConversation,
|
|
1458
|
+
Ze as subscribeToPresenceStatus,
|
|
1459
|
+
Je as unsubscribeFromConversation,
|
|
1460
|
+
Xe as unsubscribeFromPresenceStatus,
|
|
1461
|
+
Wt as useConversationChannel,
|
|
1462
|
+
Zt as useGlobalMessaging,
|
|
1463
|
+
Oe as useMessagingStore
|
|
1447
1464
|
};
|