@linktr.ee/messaging-react 1.6.2 โ 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d, Fragment as oe } from "react/jsx-runtime";
|
|
2
2
|
import D from "classnames";
|
|
3
|
-
import X, { createContext as
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { NotePencilIcon as
|
|
7
|
-
const
|
|
3
|
+
import X, { createContext as we, useContext as Ee, useCallback as F, useState as E, useRef as H, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as Ie } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as ye, useChatContext as Se, ChannelList as Re, Channel as ke, useChannelStateContext as me, Window as Te, MessageList as Pe, MessageInput as De } from "stream-chat-react";
|
|
6
|
+
import { NotePencilIcon as Oe, XIcon as he, ArrowLeftIcon as Me, DotsThreeIcon as Fe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
|
|
7
|
+
const fe = we({
|
|
8
8
|
service: null,
|
|
9
9
|
client: null,
|
|
10
10
|
isConnected: !1,
|
|
@@ -15,172 +15,172 @@ const he = ve({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), se = () =>
|
|
18
|
+
}), se = () => Ee(fe), ls = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
22
|
+
apiKey: o,
|
|
23
23
|
capabilities: i = {},
|
|
24
24
|
customization: c = {},
|
|
25
25
|
debug: a = !1
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
(w, ...
|
|
29
|
-
a && console.log(`๐ฅ [MessagingProvider] ${w}`, ...
|
|
27
|
+
const l = F(
|
|
28
|
+
(w, ...O) => {
|
|
29
|
+
a && console.log(`๐ฅ [MessagingProvider] ${w}`, ...O);
|
|
30
30
|
},
|
|
31
31
|
[a]
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
l("๐ RENDER START", {
|
|
34
34
|
userId: s == null ? void 0 : s.id,
|
|
35
|
-
apiKey: (
|
|
35
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
36
36
|
serviceConfig: !!n,
|
|
37
37
|
capabilities: Object.keys(i),
|
|
38
38
|
customization: Object.keys(c)
|
|
39
39
|
});
|
|
40
|
-
const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null),
|
|
40
|
+
const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null), M = H(!1), y = H({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
|
-
apiKey:
|
|
42
|
+
apiKey: o,
|
|
43
43
|
serviceConfig: n,
|
|
44
44
|
capabilities: i,
|
|
45
45
|
customization: c
|
|
46
46
|
}), k = H(0);
|
|
47
|
-
k.current++,
|
|
47
|
+
k.current++, l("๐ RENDER INFO", {
|
|
48
48
|
renderCount: k.current,
|
|
49
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
49
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
50
50
|
propChanges: {
|
|
51
51
|
userChanged: y.current.userId !== (s == null ? void 0 : s.id),
|
|
52
|
-
apiKeyChanged: y.current.apiKey !==
|
|
52
|
+
apiKeyChanged: y.current.apiKey !== o,
|
|
53
53
|
serviceConfigChanged: y.current.serviceConfig !== n,
|
|
54
54
|
capabilitiesChanged: y.current.capabilities !== i,
|
|
55
55
|
customizationChanged: y.current.customization !== c
|
|
56
56
|
}
|
|
57
57
|
}), y.current = {
|
|
58
58
|
userId: s == null ? void 0 : s.id,
|
|
59
|
-
apiKey:
|
|
59
|
+
apiKey: o,
|
|
60
60
|
serviceConfig: n,
|
|
61
61
|
capabilities: i,
|
|
62
62
|
customization: c
|
|
63
63
|
}, G(() => {
|
|
64
64
|
const w = k.current;
|
|
65
|
-
if (
|
|
65
|
+
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
66
66
|
renderCount: w,
|
|
67
|
-
apiKey: !!
|
|
67
|
+
apiKey: !!o,
|
|
68
68
|
serviceConfig: !!n,
|
|
69
69
|
dependencies: {
|
|
70
|
-
apiKey: (
|
|
70
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
71
71
|
serviceConfigRef: n,
|
|
72
72
|
serviceConfigStable: y.current.serviceConfig === n,
|
|
73
|
-
apiKeyStable: y.current.apiKey ===
|
|
73
|
+
apiKeyStable: y.current.apiKey === o
|
|
74
74
|
}
|
|
75
|
-
}), !
|
|
76
|
-
|
|
75
|
+
}), !o || !n) {
|
|
76
|
+
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
77
77
|
renderCount: w,
|
|
78
78
|
reason: "Missing apiKey or serviceConfig"
|
|
79
79
|
});
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
l("๐ CREATING NEW SERVICE", {
|
|
83
83
|
renderCount: w,
|
|
84
|
-
apiKey: (
|
|
84
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
85
85
|
serviceConfigChanged: y.current.serviceConfig !== n
|
|
86
86
|
});
|
|
87
|
-
const
|
|
87
|
+
const O = new Ie({
|
|
88
88
|
...n,
|
|
89
|
-
apiKey:
|
|
89
|
+
apiKey: o,
|
|
90
90
|
debug: a
|
|
91
91
|
});
|
|
92
|
-
return b(
|
|
92
|
+
return b(O), l("โ
SERVICE SET", {
|
|
93
93
|
renderCount: w,
|
|
94
|
-
serviceInstance: !!
|
|
94
|
+
serviceInstance: !!O
|
|
95
95
|
}), () => {
|
|
96
|
-
|
|
96
|
+
l("๐งน SERVICE CLEANUP", {
|
|
97
97
|
renderCount: w,
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
|
-
}),
|
|
99
|
+
}), O.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
|
-
}, [
|
|
101
|
+
}, [o, n, a, l]);
|
|
102
102
|
const T = H(null);
|
|
103
103
|
G(() => {
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
104
|
+
var O, L;
|
|
105
|
+
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
106
106
|
hasService: !!r,
|
|
107
107
|
hasUser: !!s,
|
|
108
108
|
userId: s == null ? void 0 : s.id,
|
|
109
|
-
isConnecting:
|
|
109
|
+
isConnecting: M.current,
|
|
110
110
|
isConnected: m,
|
|
111
111
|
dependencies: { service: !!r, userId: s == null ? void 0 : s.id }
|
|
112
112
|
}), !r || !s) {
|
|
113
|
-
|
|
113
|
+
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
116
|
+
if (M.current) {
|
|
117
|
+
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (((
|
|
121
|
-
|
|
120
|
+
if (((O = T.current) == null ? void 0 : O.serviceId) === r && ((L = T.current) == null ? void 0 : L.userId) === s.id) {
|
|
121
|
+
l(
|
|
122
122
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
123
123
|
"Already connected this user with this service"
|
|
124
124
|
);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
(async () => {
|
|
128
|
-
|
|
128
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), M.current = !0, h(!0), S(null);
|
|
129
129
|
try {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
g(
|
|
130
|
+
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
131
|
+
const p = await r.connectUser(s);
|
|
132
|
+
g(p), I(!0), T.current = { serviceId: r, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
133
133
|
userId: s.id,
|
|
134
|
-
clientId:
|
|
134
|
+
clientId: p.userID
|
|
135
135
|
});
|
|
136
|
-
} catch (
|
|
137
|
-
const $ =
|
|
138
|
-
S($),
|
|
136
|
+
} catch (p) {
|
|
137
|
+
const $ = p instanceof Error ? p.message : "Connection failed";
|
|
138
|
+
S($), l("โ USER CONNECTION ERROR", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
error: $
|
|
141
141
|
});
|
|
142
142
|
} finally {
|
|
143
|
-
h(!1),
|
|
143
|
+
h(!1), M.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
144
144
|
userId: s.id,
|
|
145
145
|
isConnected: m
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
})();
|
|
149
|
-
}, [r, s,
|
|
149
|
+
}, [r, s, l, m]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
150
150
|
hasService: !!r,
|
|
151
151
|
isConnected: m
|
|
152
152
|
}), () => {
|
|
153
|
-
r && m ? (
|
|
153
|
+
r && m ? (l(
|
|
154
154
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
155
155
|
"Cleaning up connection on unmount"
|
|
156
|
-
), T.current = null, r.disconnectUser().catch(console.error)) :
|
|
156
|
+
), T.current = null, r.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
157
157
|
hasService: !!r,
|
|
158
158
|
isConnected: m
|
|
159
159
|
});
|
|
160
|
-
}), [r, m,
|
|
161
|
-
const f =
|
|
162
|
-
if (
|
|
160
|
+
}), [r, m, l]);
|
|
161
|
+
const f = F(async () => {
|
|
162
|
+
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
163
163
|
hasService: !!r,
|
|
164
164
|
hasUser: !!s
|
|
165
165
|
}), !r || !s) {
|
|
166
|
-
|
|
166
|
+
l("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
|
|
170
170
|
try {
|
|
171
|
-
|
|
171
|
+
l("๐ DISCONNECTING FOR REFRESH"), await r.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
172
172
|
const w = await r.connectUser(s);
|
|
173
|
-
g(w), I(!0), S(null),
|
|
173
|
+
g(w), I(!0), S(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
174
174
|
} catch (w) {
|
|
175
|
-
const
|
|
176
|
-
S(
|
|
175
|
+
const O = w instanceof Error ? w.message : "Refresh failed";
|
|
176
|
+
S(O), l("โ CONNECTION REFRESH ERROR", {
|
|
177
177
|
userId: s.id,
|
|
178
|
-
error:
|
|
178
|
+
error: O
|
|
179
179
|
});
|
|
180
180
|
} finally {
|
|
181
|
-
h(!1),
|
|
181
|
+
h(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
182
182
|
}
|
|
183
|
-
}, [r, s,
|
|
183
|
+
}, [r, s, l]), x = X.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
184
184
|
hasService: !!r,
|
|
185
185
|
hasClient: !!u,
|
|
186
186
|
isConnected: m,
|
|
@@ -208,15 +208,15 @@ const he = ve({
|
|
|
208
208
|
c,
|
|
209
209
|
f,
|
|
210
210
|
a,
|
|
211
|
-
|
|
211
|
+
l
|
|
212
212
|
]);
|
|
213
|
-
return
|
|
213
|
+
return l("๐ RENDER END", {
|
|
214
214
|
renderCount: k.current,
|
|
215
215
|
willRenderChat: !!(u && m),
|
|
216
216
|
contextValueReady: !!x
|
|
217
|
-
}), /* @__PURE__ */ e(
|
|
218
|
-
},
|
|
219
|
-
function ne({ label: t, className: s, children: n, ...
|
|
217
|
+
}), /* @__PURE__ */ e(fe.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(ye, { client: u, children: t }) : t });
|
|
218
|
+
}, je = () => se();
|
|
219
|
+
function ne({ label: t, className: s, children: n, ...o }) {
|
|
220
220
|
return /* @__PURE__ */ d(
|
|
221
221
|
"button",
|
|
222
222
|
{
|
|
@@ -224,12 +224,12 @@ function ne({ label: t, className: s, children: n, ...l }) {
|
|
|
224
224
|
className: D(
|
|
225
225
|
"rounded-full p-2 transition-colors focus-ring",
|
|
226
226
|
{
|
|
227
|
-
"cursor-not-allowed opacity-50":
|
|
228
|
-
"hover:bg-sand": !
|
|
227
|
+
"cursor-not-allowed opacity-50": o.disabled,
|
|
228
|
+
"hover:bg-sand": !o.disabled
|
|
229
229
|
},
|
|
230
230
|
s
|
|
231
231
|
),
|
|
232
|
-
...
|
|
232
|
+
...o,
|
|
233
233
|
children: [
|
|
234
234
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
235
235
|
n
|
|
@@ -237,59 +237,65 @@ function ne({ label: t, className: s, children: n, ...l }) {
|
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
240
|
+
const de = [
|
|
241
|
+
"๐",
|
|
242
|
+
// Apple
|
|
243
|
+
"๐",
|
|
244
|
+
// Banana
|
|
245
|
+
"๐",
|
|
246
|
+
// Grape
|
|
247
|
+
"๐",
|
|
248
|
+
// Orange
|
|
249
|
+
"๐",
|
|
250
|
+
// Strawberry
|
|
251
|
+
"๐ฅฅ",
|
|
252
|
+
// Coconut
|
|
253
|
+
"๐",
|
|
254
|
+
// Cherry
|
|
255
|
+
"๐ฅญ",
|
|
256
|
+
// Mango
|
|
257
|
+
"๐",
|
|
258
|
+
// Watermelon
|
|
259
|
+
"๐",
|
|
260
|
+
// Lemon
|
|
261
|
+
"๐ฅ",
|
|
262
|
+
// Kiwi
|
|
263
|
+
"๐ซ",
|
|
264
|
+
// Olive
|
|
265
|
+
"๐"
|
|
266
|
+
// Melon
|
|
267
|
+
];
|
|
268
|
+
function Ae(t) {
|
|
269
|
+
let s = 0;
|
|
270
|
+
for (let n = 0; n < t.length; n++) {
|
|
271
|
+
const o = t.charCodeAt(n);
|
|
272
|
+
s = (s << 5) - s + o, s = s & s;
|
|
273
|
+
}
|
|
274
|
+
return Math.abs(s);
|
|
275
|
+
}
|
|
276
|
+
function Be(t) {
|
|
277
|
+
const n = Ae(t) % de.length;
|
|
278
|
+
return de[n];
|
|
272
279
|
}
|
|
273
|
-
const
|
|
280
|
+
const J = ({
|
|
274
281
|
id: t,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
className: i
|
|
282
|
+
image: s,
|
|
283
|
+
size: n = 40,
|
|
284
|
+
className: o
|
|
279
285
|
}) => {
|
|
280
|
-
const
|
|
286
|
+
const i = Be(t), c = "#FBFAF9", l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
|
|
281
287
|
return /* @__PURE__ */ e(
|
|
282
288
|
"div",
|
|
283
289
|
{
|
|
284
290
|
className: D(
|
|
285
|
-
"flex-shrink-0 overflow-hidden rounded-
|
|
286
|
-
|
|
291
|
+
"flex-shrink-0 overflow-hidden rounded-lg",
|
|
292
|
+
o
|
|
287
293
|
),
|
|
288
|
-
style: { width: `${
|
|
289
|
-
children:
|
|
294
|
+
style: { width: `${n}px`, height: `${n}px` },
|
|
295
|
+
children: s ? /* @__PURE__ */ e(
|
|
290
296
|
"img",
|
|
291
297
|
{
|
|
292
|
-
src:
|
|
298
|
+
src: s,
|
|
293
299
|
alt: "",
|
|
294
300
|
className: "h-full w-full object-cover aspect-square"
|
|
295
301
|
}
|
|
@@ -298,20 +304,20 @@ const Y = ({
|
|
|
298
304
|
{
|
|
299
305
|
"aria-hidden": "true",
|
|
300
306
|
className: D(
|
|
301
|
-
"flex h-full w-full items-center justify-center font-semibold",
|
|
302
|
-
|
|
307
|
+
"flex h-full w-full items-center justify-center font-semibold rounded-sm",
|
|
308
|
+
l
|
|
303
309
|
),
|
|
304
310
|
style: {
|
|
305
311
|
color: c,
|
|
306
|
-
backgroundColor: `color-mix(in srgb, ${c}
|
|
312
|
+
backgroundColor: `color-mix(in srgb, ${c} 60%, solid)`
|
|
307
313
|
},
|
|
308
|
-
children:
|
|
314
|
+
children: i
|
|
309
315
|
}
|
|
310
316
|
)
|
|
311
317
|
}
|
|
312
318
|
);
|
|
313
|
-
},
|
|
314
|
-
var h, v, S,
|
|
319
|
+
}, He = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: o = !1, unread: i }) => {
|
|
320
|
+
var h, v, S, M, y, k;
|
|
315
321
|
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
|
|
316
322
|
t && n(t);
|
|
317
323
|
}, r = Object.values(((h = t == null ? void 0 : t.state) == null ? void 0 : h.members) || {}).find(
|
|
@@ -319,11 +325,11 @@ const Y = ({
|
|
|
319
325
|
var f, x;
|
|
320
326
|
return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
|
|
321
327
|
}
|
|
322
|
-
), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (
|
|
328
|
+
), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : y[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", I = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
|
|
323
329
|
hour: "2-digit",
|
|
324
330
|
minute: "2-digit"
|
|
325
331
|
}) : "", N = i ?? 0;
|
|
326
|
-
return
|
|
332
|
+
return o && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
327
333
|
channelId: t == null ? void 0 : t.id,
|
|
328
334
|
isSelected: c,
|
|
329
335
|
participantName: b,
|
|
@@ -343,7 +349,7 @@ const Y = ({
|
|
|
343
349
|
),
|
|
344
350
|
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
345
351
|
/* @__PURE__ */ e(
|
|
346
|
-
|
|
352
|
+
J,
|
|
347
353
|
{
|
|
348
354
|
id: ((k = r == null ? void 0 : r.user) == null ? void 0 : k.id) || t.id || "unknown",
|
|
349
355
|
name: b,
|
|
@@ -373,26 +379,26 @@ const Y = ({
|
|
|
373
379
|
] })
|
|
374
380
|
}
|
|
375
381
|
);
|
|
376
|
-
},
|
|
382
|
+
}, Ge = ({
|
|
377
383
|
onChannelSelect: t,
|
|
378
384
|
selectedChannel: s,
|
|
379
385
|
showStartConversation: n = !1,
|
|
380
|
-
onStartConversation:
|
|
386
|
+
onStartConversation: o,
|
|
381
387
|
participantLabel: i = "participants",
|
|
382
388
|
className: c
|
|
383
389
|
}) => {
|
|
384
390
|
var u;
|
|
385
391
|
const a = X.useRef(0);
|
|
386
392
|
a.current++;
|
|
387
|
-
const { debug:
|
|
388
|
-
|
|
393
|
+
const { debug: l = !1 } = se();
|
|
394
|
+
l && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
389
395
|
renderCount: a.current,
|
|
390
396
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
391
397
|
showStartConversation: n,
|
|
392
398
|
participantLabel: i
|
|
393
399
|
});
|
|
394
|
-
const { client: r } =
|
|
395
|
-
|
|
400
|
+
const { client: r } = Se();
|
|
401
|
+
l && console.log("๐บ [ChannelList] ๐ก CHAT CONTEXT", {
|
|
396
402
|
renderCount: a.current,
|
|
397
403
|
hasClient: !!r,
|
|
398
404
|
clientUserId: r == null ? void 0 : r.userID,
|
|
@@ -400,12 +406,12 @@ const Y = ({
|
|
|
400
406
|
});
|
|
401
407
|
const b = X.useMemo(() => {
|
|
402
408
|
const g = r.userID, m = g ? { type: "messaging", members: { $in: [g] }, hidden: !1 } : { type: "messaging" };
|
|
403
|
-
return
|
|
409
|
+
return l && console.log("๐บ [ChannelList] ๐ FILTERS MEMOIZED", {
|
|
404
410
|
renderCount: a.current,
|
|
405
411
|
userId: g,
|
|
406
412
|
filters: m
|
|
407
413
|
}), m;
|
|
408
|
-
}, [r.userID,
|
|
414
|
+
}, [r.userID, l]);
|
|
409
415
|
return /* @__PURE__ */ d(
|
|
410
416
|
"div",
|
|
411
417
|
{
|
|
@@ -416,40 +422,40 @@ const Y = ({
|
|
|
416
422
|
children: [
|
|
417
423
|
/* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
|
|
418
424
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
|
|
419
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n &&
|
|
425
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && o && /* @__PURE__ */ e(
|
|
420
426
|
ne,
|
|
421
427
|
{
|
|
422
428
|
label: "Start a new conversation",
|
|
423
|
-
onClick:
|
|
429
|
+
onClick: o,
|
|
424
430
|
className: "inline-flex size-10 items-center justify-center",
|
|
425
|
-
children: /* @__PURE__ */ e(
|
|
431
|
+
children: /* @__PURE__ */ e(Oe, { className: "h-5 w-5" })
|
|
426
432
|
}
|
|
427
433
|
) })
|
|
428
434
|
] }) }),
|
|
429
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (
|
|
435
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (l && console.log("๐บ [ChannelList] ๐ฌ RENDERING STREAM CHANNEL LIST", {
|
|
430
436
|
renderCount: a.current,
|
|
431
437
|
filters: b,
|
|
432
438
|
hasClient: !!r,
|
|
433
439
|
clientUserId: r == null ? void 0 : r.userID
|
|
434
440
|
}), /* @__PURE__ */ e(
|
|
435
|
-
|
|
441
|
+
Re,
|
|
436
442
|
{
|
|
437
443
|
filters: b,
|
|
438
444
|
sort: { last_message_at: -1 },
|
|
439
445
|
options: { limit: 30 },
|
|
440
446
|
Preview: (g) => {
|
|
441
447
|
var m, I;
|
|
442
|
-
return
|
|
448
|
+
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
443
449
|
channelId: (m = g.channel) == null ? void 0 : m.id,
|
|
444
450
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
445
451
|
isSelected: (s == null ? void 0 : s.id) === ((I = g.channel) == null ? void 0 : I.id)
|
|
446
452
|
}), /* @__PURE__ */ e(
|
|
447
|
-
|
|
453
|
+
He,
|
|
448
454
|
{
|
|
449
455
|
...g,
|
|
450
456
|
selectedChannel: s,
|
|
451
457
|
onChannelSelect: t,
|
|
452
|
-
debug:
|
|
458
|
+
debug: l
|
|
453
459
|
}
|
|
454
460
|
);
|
|
455
461
|
}
|
|
@@ -462,7 +468,7 @@ const Y = ({
|
|
|
462
468
|
variant: t = "default",
|
|
463
469
|
className: s,
|
|
464
470
|
children: n,
|
|
465
|
-
...
|
|
471
|
+
...o
|
|
466
472
|
}) => /* @__PURE__ */ e(
|
|
467
473
|
"button",
|
|
468
474
|
{
|
|
@@ -472,24 +478,24 @@ const Y = ({
|
|
|
472
478
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
473
479
|
s
|
|
474
480
|
),
|
|
475
|
-
...
|
|
481
|
+
...o,
|
|
476
482
|
children: n
|
|
477
483
|
}
|
|
478
484
|
);
|
|
479
|
-
function
|
|
480
|
-
return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(
|
|
485
|
+
function ge({ onClick: t }) {
|
|
486
|
+
return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
481
487
|
}
|
|
482
|
-
const
|
|
488
|
+
const $e = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
483
489
|
t && t(),
|
|
484
|
-
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
485
|
-
] }),
|
|
490
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(De, { focus: !0, maxRows: 4 }) })
|
|
491
|
+
] }), _e = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: o }) => {
|
|
486
492
|
var r, b, u, g;
|
|
487
|
-
const { channel: i } =
|
|
493
|
+
const { channel: i } = me(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
|
|
488
494
|
(I) => {
|
|
489
495
|
var N;
|
|
490
496
|
return ((N = I.user) == null ? void 0 : N.id) && I.user.id !== i._client.userID;
|
|
491
497
|
}
|
|
492
|
-
), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member",
|
|
498
|
+
), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member", l = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
|
|
493
499
|
return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
|
|
494
500
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
495
501
|
s && t && /* @__PURE__ */ e(
|
|
@@ -503,38 +509,38 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
503
509
|
}
|
|
504
510
|
),
|
|
505
511
|
/* @__PURE__ */ e(
|
|
506
|
-
|
|
512
|
+
J,
|
|
507
513
|
{
|
|
508
514
|
id: ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || i.id || "unknown",
|
|
509
515
|
name: a,
|
|
510
|
-
image:
|
|
516
|
+
image: l,
|
|
511
517
|
size: 40
|
|
512
518
|
}
|
|
513
519
|
),
|
|
514
520
|
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: a }) })
|
|
515
521
|
] }),
|
|
516
|
-
|
|
522
|
+
o && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Fe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
|
|
517
523
|
] });
|
|
518
|
-
},
|
|
524
|
+
}, Ve = ({
|
|
519
525
|
isOpen: t,
|
|
520
526
|
onClose: s,
|
|
521
527
|
participant: n,
|
|
522
|
-
channel:
|
|
528
|
+
channel: o,
|
|
523
529
|
followerStatusLabel: i,
|
|
524
530
|
onLeaveConversation: c,
|
|
525
531
|
onBlockParticipant: a
|
|
526
532
|
}) => {
|
|
527
|
-
var
|
|
528
|
-
const { service:
|
|
533
|
+
var p, $, _, V, Q, W, z;
|
|
534
|
+
const { service: l, debug: r } = se(), b = H(null), [u, g] = E(!1), [m, I] = E(!1), [N, h] = E(!1);
|
|
529
535
|
G(() => {
|
|
530
536
|
const R = b.current;
|
|
531
537
|
R && (t ? R.showModal() : R.close());
|
|
532
538
|
}, [t]);
|
|
533
|
-
const v =
|
|
539
|
+
const v = F(async () => {
|
|
534
540
|
var R;
|
|
535
|
-
if (!(!
|
|
541
|
+
if (!(!l || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
536
542
|
try {
|
|
537
|
-
const A = (await
|
|
543
|
+
const A = (await l.getBlockedUsers()).some(
|
|
538
544
|
(q) => {
|
|
539
545
|
var Z;
|
|
540
546
|
return q.blocked_user_id === ((Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id);
|
|
@@ -547,29 +553,29 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
547
553
|
P
|
|
548
554
|
);
|
|
549
555
|
}
|
|
550
|
-
}, [
|
|
556
|
+
}, [l, (p = n == null ? void 0 : n.user) == null ? void 0 : p.id]);
|
|
551
557
|
G(() => {
|
|
552
558
|
t && v();
|
|
553
559
|
}, [t, v]);
|
|
554
560
|
const S = async () => {
|
|
555
561
|
var R;
|
|
556
562
|
if (!m) {
|
|
557
|
-
r && console.log("[ChannelInfoDialog] Leave conversation",
|
|
563
|
+
r && console.log("[ChannelInfoDialog] Leave conversation", o.cid), I(!0);
|
|
558
564
|
try {
|
|
559
|
-
const P = ((R =
|
|
560
|
-
await
|
|
565
|
+
const P = ((R = o._client) == null ? void 0 : R.userID) ?? null;
|
|
566
|
+
await o.hide(P, !1), c && await c(o), s();
|
|
561
567
|
} catch (P) {
|
|
562
568
|
console.error("[ChannelInfoDialog] Failed to leave conversation", P);
|
|
563
569
|
} finally {
|
|
564
570
|
I(!1);
|
|
565
571
|
}
|
|
566
572
|
}
|
|
567
|
-
},
|
|
573
|
+
}, M = async () => {
|
|
568
574
|
var R, P, A;
|
|
569
|
-
if (!(N || !
|
|
575
|
+
if (!(N || !l)) {
|
|
570
576
|
r && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
|
|
571
577
|
try {
|
|
572
|
-
await
|
|
578
|
+
await l.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
573
579
|
} catch (q) {
|
|
574
580
|
console.error("[ChannelInfoDialog] Failed to block member", q);
|
|
575
581
|
} finally {
|
|
@@ -578,10 +584,10 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
578
584
|
}
|
|
579
585
|
}, y = async () => {
|
|
580
586
|
var R, P, A;
|
|
581
|
-
if (!(N || !
|
|
587
|
+
if (!(N || !l)) {
|
|
582
588
|
r && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
|
|
583
589
|
try {
|
|
584
|
-
await
|
|
590
|
+
await l.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
585
591
|
} catch (q) {
|
|
586
592
|
console.error("[ChannelInfoDialog] Failed to unblock member", q);
|
|
587
593
|
} finally {
|
|
@@ -596,7 +602,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
596
602
|
);
|
|
597
603
|
};
|
|
598
604
|
if (!n) return null;
|
|
599
|
-
const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username,
|
|
605
|
+
const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, O = x || (w ? `linktr.ee/${w}` : void 0), L = ((z = n.user) == null ? void 0 : z.id) || "unknown";
|
|
600
606
|
return (
|
|
601
607
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
602
608
|
/* @__PURE__ */ e(
|
|
@@ -611,14 +617,14 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
611
617
|
children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
612
618
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
613
619
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
614
|
-
/* @__PURE__ */ e(
|
|
620
|
+
/* @__PURE__ */ e(ge, { onClick: s })
|
|
615
621
|
] }),
|
|
616
622
|
/* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
|
|
617
623
|
/* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
|
|
618
624
|
/* @__PURE__ */ e(
|
|
619
|
-
|
|
625
|
+
J,
|
|
620
626
|
{
|
|
621
|
-
id:
|
|
627
|
+
id: L,
|
|
622
628
|
name: T,
|
|
623
629
|
image: f,
|
|
624
630
|
size: 64
|
|
@@ -626,7 +632,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
626
632
|
),
|
|
627
633
|
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
628
634
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
|
|
629
|
-
|
|
635
|
+
O && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: O }),
|
|
630
636
|
i && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: i })
|
|
631
637
|
] })
|
|
632
638
|
] }) }),
|
|
@@ -657,7 +663,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
657
663
|
) : /* @__PURE__ */ d(
|
|
658
664
|
K,
|
|
659
665
|
{
|
|
660
|
-
onClick:
|
|
666
|
+
onClick: M,
|
|
661
667
|
disabled: N,
|
|
662
668
|
"aria-busy": N,
|
|
663
669
|
children: [
|
|
@@ -667,7 +673,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
667
673
|
}
|
|
668
674
|
) }),
|
|
669
675
|
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: k, children: [
|
|
670
|
-
/* @__PURE__ */ e(
|
|
676
|
+
/* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
|
|
671
677
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
672
678
|
] }) })
|
|
673
679
|
] })
|
|
@@ -676,16 +682,16 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
676
682
|
}
|
|
677
683
|
)
|
|
678
684
|
);
|
|
679
|
-
},
|
|
685
|
+
}, We = ({
|
|
680
686
|
onBack: t,
|
|
681
687
|
showBackButton: s,
|
|
682
688
|
renderMessageInputActions: n,
|
|
683
|
-
onLeaveConversation:
|
|
689
|
+
onLeaveConversation: o,
|
|
684
690
|
onBlockParticipant: i,
|
|
685
691
|
CustomChannelEmptyState: c
|
|
686
692
|
}) => {
|
|
687
693
|
var m, I;
|
|
688
|
-
const { channel: a } =
|
|
694
|
+
const { channel: a } = me(), [l, r] = E(!1), b = (((I = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : I.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
|
|
689
695
|
(h) => {
|
|
690
696
|
var v;
|
|
691
697
|
return ((v = h.user) == null ? void 0 : v.id) && h.user.id !== a._client.userID;
|
|
@@ -695,9 +701,9 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
695
701
|
return N.followerStatus ? String(N.followerStatus) : N.isFollower ? "Subscribed to you" : void 0;
|
|
696
702
|
}, [a.data]);
|
|
697
703
|
return /* @__PURE__ */ d(oe, { children: [
|
|
698
|
-
/* @__PURE__ */ d(
|
|
704
|
+
/* @__PURE__ */ d(Te, { children: [
|
|
699
705
|
/* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
|
|
700
|
-
|
|
706
|
+
_e,
|
|
701
707
|
{
|
|
702
708
|
onBack: t,
|
|
703
709
|
showBackButton: s,
|
|
@@ -706,38 +712,38 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
706
712
|
}
|
|
707
713
|
) }),
|
|
708
714
|
/* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
709
|
-
/* @__PURE__ */ e(
|
|
715
|
+
/* @__PURE__ */ e(Pe, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
|
|
710
716
|
!b && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(c, {}) })
|
|
711
717
|
] }),
|
|
712
718
|
/* @__PURE__ */ e(
|
|
713
|
-
|
|
719
|
+
$e,
|
|
714
720
|
{
|
|
715
721
|
renderActions: () => n == null ? void 0 : n(a)
|
|
716
722
|
}
|
|
717
723
|
)
|
|
718
724
|
] }),
|
|
719
725
|
/* @__PURE__ */ e(
|
|
720
|
-
|
|
726
|
+
Ve,
|
|
721
727
|
{
|
|
722
|
-
isOpen:
|
|
728
|
+
isOpen: l,
|
|
723
729
|
onClose: () => r(!1),
|
|
724
730
|
participant: u,
|
|
725
731
|
channel: a,
|
|
726
732
|
followerStatusLabel: g,
|
|
727
|
-
onLeaveConversation:
|
|
733
|
+
onLeaveConversation: o,
|
|
728
734
|
onBlockParticipant: i
|
|
729
735
|
}
|
|
730
736
|
)
|
|
731
737
|
] });
|
|
732
|
-
},
|
|
738
|
+
}, ze = ({
|
|
733
739
|
channel: t,
|
|
734
740
|
onBack: s,
|
|
735
741
|
showBackButton: n = !1,
|
|
736
|
-
renderMessageInputActions:
|
|
742
|
+
renderMessageInputActions: o,
|
|
737
743
|
onLeaveConversation: i,
|
|
738
744
|
onBlockParticipant: c,
|
|
739
745
|
className: a,
|
|
740
|
-
CustomChannelEmptyState:
|
|
746
|
+
CustomChannelEmptyState: l
|
|
741
747
|
}) => /* @__PURE__ */ e(
|
|
742
748
|
"div",
|
|
743
749
|
{
|
|
@@ -745,25 +751,25 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
745
751
|
"messaging-channel-view h-full flex flex-col",
|
|
746
752
|
a
|
|
747
753
|
),
|
|
748
|
-
children: /* @__PURE__ */ e(
|
|
749
|
-
|
|
754
|
+
children: /* @__PURE__ */ e(ke, { channel: t, children: /* @__PURE__ */ e(
|
|
755
|
+
We,
|
|
750
756
|
{
|
|
751
757
|
onBack: s,
|
|
752
758
|
showBackButton: n,
|
|
753
|
-
renderMessageInputActions:
|
|
759
|
+
renderMessageInputActions: o,
|
|
754
760
|
onLeaveConversation: i,
|
|
755
761
|
onBlockParticipant: c,
|
|
756
|
-
CustomChannelEmptyState:
|
|
762
|
+
CustomChannelEmptyState: l
|
|
757
763
|
}
|
|
758
764
|
) })
|
|
759
765
|
}
|
|
760
766
|
);
|
|
761
|
-
function
|
|
767
|
+
function qe({
|
|
762
768
|
searchQuery: t,
|
|
763
769
|
setSearchQuery: s,
|
|
764
770
|
placeholder: n
|
|
765
771
|
}) {
|
|
766
|
-
const
|
|
772
|
+
const o = H(null);
|
|
767
773
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
768
774
|
/* @__PURE__ */ e(
|
|
769
775
|
pe,
|
|
@@ -775,7 +781,7 @@ function We({
|
|
|
775
781
|
/* @__PURE__ */ e(
|
|
776
782
|
"input",
|
|
777
783
|
{
|
|
778
|
-
ref:
|
|
784
|
+
ref: o,
|
|
779
785
|
type: "text",
|
|
780
786
|
placeholder: n,
|
|
781
787
|
value: t,
|
|
@@ -789,43 +795,43 @@ function We({
|
|
|
789
795
|
label: "Clear search",
|
|
790
796
|
onClick: () => {
|
|
791
797
|
var i;
|
|
792
|
-
s(""), (i =
|
|
798
|
+
s(""), (i = o.current) == null || i.focus();
|
|
793
799
|
},
|
|
794
800
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
795
|
-
children: /* @__PURE__ */ e(
|
|
801
|
+
children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
|
|
796
802
|
}
|
|
797
803
|
)
|
|
798
804
|
] });
|
|
799
805
|
}
|
|
800
|
-
const
|
|
806
|
+
const Xe = ({
|
|
801
807
|
participantSource: t,
|
|
802
808
|
onSelectParticipant: s,
|
|
803
809
|
onClose: n,
|
|
804
|
-
existingParticipantIds:
|
|
810
|
+
existingParticipantIds: o = /* @__PURE__ */ new Set(),
|
|
805
811
|
participantLabel: i = "participants",
|
|
806
812
|
searchPlaceholder: c = "Search participants...",
|
|
807
813
|
className: a
|
|
808
814
|
}) => {
|
|
809
|
-
const { debug:
|
|
815
|
+
const { debug: l } = se(), [r, b] = E(""), [u, g] = E([]), [m, I] = E(!1), [N, h] = E(null), [v, S] = E(
|
|
810
816
|
null
|
|
811
|
-
),
|
|
817
|
+
), M = H(!1);
|
|
812
818
|
G(() => {
|
|
813
819
|
if (t.loading) {
|
|
814
|
-
|
|
820
|
+
l && console.log(
|
|
815
821
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
816
822
|
);
|
|
817
823
|
return;
|
|
818
824
|
}
|
|
819
|
-
if (
|
|
825
|
+
if (M.current) return;
|
|
820
826
|
(async () => {
|
|
821
|
-
|
|
827
|
+
l && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), h(null);
|
|
822
828
|
try {
|
|
823
829
|
const x = await t.loadParticipants({
|
|
824
830
|
search: "",
|
|
825
831
|
// Load all participants initially
|
|
826
832
|
limit: 100
|
|
827
833
|
});
|
|
828
|
-
g(x.participants),
|
|
834
|
+
g(x.participants), M.current = !0, l && console.log(
|
|
829
835
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
830
836
|
x.participants.length
|
|
831
837
|
);
|
|
@@ -836,13 +842,13 @@ const ze = ({
|
|
|
836
842
|
I(!1);
|
|
837
843
|
}
|
|
838
844
|
})();
|
|
839
|
-
}, [t.loading,
|
|
840
|
-
const y = u.filter((f) => !
|
|
845
|
+
}, [t.loading, l]);
|
|
846
|
+
const y = u.filter((f) => !o.has(f.id)).filter((f) => {
|
|
841
847
|
var w;
|
|
842
848
|
if (!r) return !0;
|
|
843
849
|
const x = r.toLowerCase();
|
|
844
850
|
return f.name.toLowerCase().includes(x) || ((w = f.email) == null ? void 0 : w.toLowerCase().includes(x)) || !1;
|
|
845
|
-
}), k =
|
|
851
|
+
}), k = F(
|
|
846
852
|
async (f) => {
|
|
847
853
|
if (!v) {
|
|
848
854
|
S(f.id);
|
|
@@ -861,7 +867,7 @@ const ze = ({
|
|
|
861
867
|
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
862
868
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
|
|
863
869
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
864
|
-
/* @__PURE__ */ e(
|
|
870
|
+
/* @__PURE__ */ e(ge, { onClick: n })
|
|
865
871
|
] }),
|
|
866
872
|
/* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
|
|
867
873
|
"Select a ",
|
|
@@ -872,7 +878,7 @@ const ze = ({
|
|
|
872
878
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${i} total`
|
|
873
879
|
] }),
|
|
874
880
|
/* @__PURE__ */ e(
|
|
875
|
-
|
|
881
|
+
qe,
|
|
876
882
|
{
|
|
877
883
|
searchQuery: r,
|
|
878
884
|
setSearchQuery: b,
|
|
@@ -905,12 +911,12 @@ const ze = ({
|
|
|
905
911
|
{
|
|
906
912
|
type: "button",
|
|
907
913
|
onClick: () => k(f),
|
|
908
|
-
onKeyDown: (
|
|
914
|
+
onKeyDown: (O) => T(O, f),
|
|
909
915
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
|
|
910
916
|
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
911
917
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
912
918
|
/* @__PURE__ */ e(
|
|
913
|
-
|
|
919
|
+
J,
|
|
914
920
|
{
|
|
915
921
|
id: f.id,
|
|
916
922
|
name: x,
|
|
@@ -934,26 +940,26 @@ const ze = ({
|
|
|
934
940
|
] }) })
|
|
935
941
|
] }) })
|
|
936
942
|
] });
|
|
937
|
-
},
|
|
943
|
+
}, Qe = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
938
944
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "๐ฌ" }) }),
|
|
939
945
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
940
946
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(oe, { children: [
|
|
941
947
|
"Choose a conversation from the list or",
|
|
942
948
|
" ",
|
|
943
|
-
s && /* @__PURE__ */ d(
|
|
949
|
+
s && /* @__PURE__ */ d(ue, { onClick: s, children: [
|
|
944
950
|
"start a new conversation with a ",
|
|
945
951
|
n.slice(0, -1),
|
|
946
952
|
"."
|
|
947
953
|
] })
|
|
948
954
|
] }) : s && /* @__PURE__ */ d(oe, { children: [
|
|
949
|
-
/* @__PURE__ */ d(
|
|
955
|
+
/* @__PURE__ */ d(ue, { onClick: s, children: [
|
|
950
956
|
"Start a new conversation with one of your ",
|
|
951
957
|
n
|
|
952
958
|
] }),
|
|
953
959
|
" ",
|
|
954
960
|
"to begin messaging."
|
|
955
961
|
] }) })
|
|
956
|
-
] }) }),
|
|
962
|
+
] }) }), ue = ({
|
|
957
963
|
onClick: t,
|
|
958
964
|
children: s
|
|
959
965
|
}) => /* @__PURE__ */ e(
|
|
@@ -977,7 +983,7 @@ const ze = ({
|
|
|
977
983
|
children: "Go Back"
|
|
978
984
|
}
|
|
979
985
|
)
|
|
980
|
-
] }) }),
|
|
986
|
+
] }) }), Ze = ({ className: t, message: s }) => /* @__PURE__ */ d(
|
|
981
987
|
"div",
|
|
982
988
|
{
|
|
983
989
|
className: D("flex items-center justify-center h-full", t),
|
|
@@ -1020,18 +1026,18 @@ const ze = ({
|
|
|
1020
1026
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1021
1027
|
]
|
|
1022
1028
|
}
|
|
1023
|
-
),
|
|
1024
|
-
/* @__PURE__ */ e(
|
|
1029
|
+
), Je = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1030
|
+
/* @__PURE__ */ e(Ze, { className: "w-6 h-6" }),
|
|
1025
1031
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1026
|
-
] }) }),
|
|
1032
|
+
] }) }), os = ({
|
|
1027
1033
|
capabilities: t = {},
|
|
1028
1034
|
className: s,
|
|
1029
1035
|
renderMessageInputActions: n,
|
|
1030
|
-
onChannelSelect:
|
|
1036
|
+
onChannelSelect: o,
|
|
1031
1037
|
onParticipantSelect: i,
|
|
1032
1038
|
initialParticipantFilter: c,
|
|
1033
1039
|
initialParticipantData: a,
|
|
1034
|
-
CustomChannelEmptyState:
|
|
1040
|
+
CustomChannelEmptyState: l,
|
|
1035
1041
|
showChannelList: r = !0
|
|
1036
1042
|
}) => {
|
|
1037
1043
|
const {
|
|
@@ -1042,11 +1048,11 @@ const ze = ({
|
|
|
1042
1048
|
error: I,
|
|
1043
1049
|
refreshConnection: N,
|
|
1044
1050
|
debug: h
|
|
1045
|
-
} =
|
|
1051
|
+
} = je(), [v, S] = E(null), [M, y] = E(!1), [k, T] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, O] = E(0), [L, p] = E(!1), [$, _] = E(null), V = H(null), {
|
|
1046
1052
|
showStartConversation: Q = !1,
|
|
1047
1053
|
participantSource: W,
|
|
1048
1054
|
participantLabel: z = "participants"
|
|
1049
|
-
} = t, R = H(null), P =
|
|
1055
|
+
} = t, R = H(null), P = F(async () => {
|
|
1050
1056
|
if (!u || !g) return;
|
|
1051
1057
|
const C = u.userID;
|
|
1052
1058
|
if (C)
|
|
@@ -1059,17 +1065,17 @@ const ze = ({
|
|
|
1059
1065
|
},
|
|
1060
1066
|
{},
|
|
1061
1067
|
{ limit: 100 }
|
|
1062
|
-
),
|
|
1068
|
+
), U = /* @__PURE__ */ new Set();
|
|
1063
1069
|
j.forEach((B) => {
|
|
1064
|
-
const
|
|
1065
|
-
Object.values(
|
|
1070
|
+
const Ce = B.state.members;
|
|
1071
|
+
Object.values(Ce).forEach((ve) => {
|
|
1066
1072
|
var ae;
|
|
1067
|
-
const re = (ae =
|
|
1068
|
-
re && re !== C &&
|
|
1073
|
+
const re = (ae = ve.user) == null ? void 0 : ae.id;
|
|
1074
|
+
re && re !== C && U.add(re);
|
|
1069
1075
|
});
|
|
1070
|
-
}), x(
|
|
1076
|
+
}), x(U), y(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1071
1077
|
channelCount: j.length,
|
|
1072
|
-
memberCount:
|
|
1078
|
+
memberCount: U.size
|
|
1073
1079
|
});
|
|
1074
1080
|
} catch (j) {
|
|
1075
1081
|
console.error("[MessagingShell] Failed to sync channels:", j);
|
|
@@ -1089,7 +1095,7 @@ const ze = ({
|
|
|
1089
1095
|
"[MessagingShell] Loading initial conversation with:",
|
|
1090
1096
|
c
|
|
1091
1097
|
);
|
|
1092
|
-
const
|
|
1098
|
+
const U = await u.queryChannels(
|
|
1093
1099
|
{
|
|
1094
1100
|
type: "messaging",
|
|
1095
1101
|
members: { $eq: [j, c] }
|
|
@@ -1097,10 +1103,10 @@ const ze = ({
|
|
|
1097
1103
|
{},
|
|
1098
1104
|
{ limit: 1 }
|
|
1099
1105
|
);
|
|
1100
|
-
if (
|
|
1101
|
-
S(
|
|
1106
|
+
if (U.length > 0)
|
|
1107
|
+
S(U[0]), p(!0), _(null), o && o(U[0]), h && console.log(
|
|
1102
1108
|
"[MessagingShell] Initial conversation loaded:",
|
|
1103
|
-
|
|
1109
|
+
U[0].id
|
|
1104
1110
|
);
|
|
1105
1111
|
else if (a && b) {
|
|
1106
1112
|
h && console.log(
|
|
@@ -1114,7 +1120,7 @@ const ze = ({
|
|
|
1114
1120
|
email: a.email,
|
|
1115
1121
|
phone: a.phone
|
|
1116
1122
|
});
|
|
1117
|
-
S(B),
|
|
1123
|
+
S(B), p(!0), _(null), o && o(B), h && console.log(
|
|
1118
1124
|
"[MessagingShell] Channel created and loaded:",
|
|
1119
1125
|
B.id
|
|
1120
1126
|
);
|
|
@@ -1131,10 +1137,10 @@ const ze = ({
|
|
|
1131
1137
|
"[MessagingShell] No conversation found for:",
|
|
1132
1138
|
c
|
|
1133
1139
|
);
|
|
1134
|
-
} catch (
|
|
1140
|
+
} catch (U) {
|
|
1135
1141
|
console.error(
|
|
1136
1142
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1137
|
-
|
|
1143
|
+
U
|
|
1138
1144
|
), _("Failed to load conversation");
|
|
1139
1145
|
}
|
|
1140
1146
|
})();
|
|
@@ -1145,19 +1151,19 @@ const ze = ({
|
|
|
1145
1151
|
g,
|
|
1146
1152
|
b,
|
|
1147
1153
|
h,
|
|
1148
|
-
|
|
1154
|
+
o
|
|
1149
1155
|
]);
|
|
1150
|
-
const A =
|
|
1156
|
+
const A = F(
|
|
1151
1157
|
(C) => {
|
|
1152
|
-
S(C),
|
|
1158
|
+
S(C), o == null || o(C);
|
|
1153
1159
|
},
|
|
1154
|
-
[
|
|
1155
|
-
), q =
|
|
1156
|
-
|
|
1157
|
-
}, [
|
|
1160
|
+
[o]
|
|
1161
|
+
), q = F(() => {
|
|
1162
|
+
L || S(null);
|
|
1163
|
+
}, [L]), Z = F(() => {
|
|
1158
1164
|
var C;
|
|
1159
|
-
W && (
|
|
1160
|
-
}, [W]),
|
|
1165
|
+
W && (O((j) => j + 1), T(!0), (C = V.current) == null || C.showModal());
|
|
1166
|
+
}, [W]), xe = F(
|
|
1161
1167
|
async (C) => {
|
|
1162
1168
|
var j;
|
|
1163
1169
|
if (b)
|
|
@@ -1166,38 +1172,38 @@ const ze = ({
|
|
|
1166
1172
|
"[MessagingShell] Starting conversation with:",
|
|
1167
1173
|
C.id
|
|
1168
1174
|
);
|
|
1169
|
-
const
|
|
1175
|
+
const U = await b.startChannelWithParticipant({
|
|
1170
1176
|
id: C.id,
|
|
1171
1177
|
name: C.name,
|
|
1172
1178
|
email: C.email,
|
|
1173
1179
|
phone: C.phone
|
|
1174
1180
|
});
|
|
1175
1181
|
try {
|
|
1176
|
-
await
|
|
1182
|
+
await U.show();
|
|
1177
1183
|
} catch (B) {
|
|
1178
1184
|
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1179
1185
|
}
|
|
1180
|
-
S(
|
|
1181
|
-
} catch (
|
|
1182
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1186
|
+
S(U), T(!1), (j = V.current) == null || j.close(), i == null || i(C);
|
|
1187
|
+
} catch (U) {
|
|
1188
|
+
console.error("[MessagingShell] Failed to start conversation:", U);
|
|
1183
1189
|
}
|
|
1184
1190
|
},
|
|
1185
1191
|
[b, i, h]
|
|
1186
|
-
), te =
|
|
1192
|
+
), te = F(() => {
|
|
1187
1193
|
var C;
|
|
1188
1194
|
T(!1), (C = V.current) == null || C.close();
|
|
1189
|
-
}, []),
|
|
1195
|
+
}, []), Ne = F(
|
|
1190
1196
|
async (C) => {
|
|
1191
|
-
h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null),
|
|
1197
|
+
h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), p(!1), R.current = null, await P();
|
|
1192
1198
|
},
|
|
1193
1199
|
[P, h]
|
|
1194
|
-
),
|
|
1200
|
+
), be = F(
|
|
1195
1201
|
async (C) => {
|
|
1196
|
-
h && console.log("[MessagingShell] Blocking participant:", C), S(null),
|
|
1202
|
+
h && console.log("[MessagingShell] Blocking participant:", C), S(null), p(!1), R.current = null, await P();
|
|
1197
1203
|
},
|
|
1198
1204
|
[P, h]
|
|
1199
|
-
),
|
|
1200
|
-
return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1205
|
+
), Y = !!v;
|
|
1206
|
+
return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Je, {}) }) : I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1201
1207
|
le,
|
|
1202
1208
|
{
|
|
1203
1209
|
message: "Not connected to messaging service",
|
|
@@ -1219,15 +1225,15 @@ const ze = ({
|
|
|
1219
1225
|
"messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
|
|
1220
1226
|
{
|
|
1221
1227
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1222
|
-
"!hidden": r === !1 ||
|
|
1228
|
+
"!hidden": r === !1 || L,
|
|
1223
1229
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1224
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !
|
|
1230
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !L && Y,
|
|
1225
1231
|
// Normal mode: show when no channel selected
|
|
1226
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !
|
|
1232
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !L && !Y
|
|
1227
1233
|
}
|
|
1228
1234
|
),
|
|
1229
1235
|
children: /* @__PURE__ */ e(
|
|
1230
|
-
|
|
1236
|
+
Ge,
|
|
1231
1237
|
{
|
|
1232
1238
|
onChannelSelect: A,
|
|
1233
1239
|
selectedChannel: v || void 0,
|
|
@@ -1245,27 +1251,27 @@ const ze = ({
|
|
|
1245
1251
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1246
1252
|
{
|
|
1247
1253
|
// In direct conversation mode, always show (full width)
|
|
1248
|
-
flex:
|
|
1254
|
+
flex: L || Y,
|
|
1249
1255
|
// Normal mode: hide on mobile when no channel selected
|
|
1250
|
-
"hidden lg:flex": !
|
|
1256
|
+
"hidden lg:flex": !L && !Y
|
|
1251
1257
|
}
|
|
1252
1258
|
),
|
|
1253
1259
|
children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1254
|
-
|
|
1260
|
+
ze,
|
|
1255
1261
|
{
|
|
1256
1262
|
channel: v,
|
|
1257
1263
|
onBack: q,
|
|
1258
|
-
showBackButton: !
|
|
1264
|
+
showBackButton: !L,
|
|
1259
1265
|
renderMessageInputActions: n,
|
|
1260
|
-
onLeaveConversation:
|
|
1261
|
-
onBlockParticipant:
|
|
1262
|
-
CustomChannelEmptyState:
|
|
1266
|
+
onLeaveConversation: Ne,
|
|
1267
|
+
onBlockParticipant: be,
|
|
1268
|
+
CustomChannelEmptyState: l
|
|
1263
1269
|
},
|
|
1264
1270
|
v.id
|
|
1265
1271
|
) }) : /* @__PURE__ */ e(
|
|
1266
|
-
|
|
1272
|
+
Qe,
|
|
1267
1273
|
{
|
|
1268
|
-
hasChannels:
|
|
1274
|
+
hasChannels: M,
|
|
1269
1275
|
onStartConversation: Q ? Z : void 0,
|
|
1270
1276
|
participantLabel: z
|
|
1271
1277
|
}
|
|
@@ -1284,10 +1290,10 @@ const ze = ({
|
|
|
1284
1290
|
},
|
|
1285
1291
|
onClose: te,
|
|
1286
1292
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1287
|
-
|
|
1293
|
+
Xe,
|
|
1288
1294
|
{
|
|
1289
1295
|
participantSource: W,
|
|
1290
|
-
onSelectParticipant:
|
|
1296
|
+
onSelectParticipant: xe,
|
|
1291
1297
|
onClose: te,
|
|
1292
1298
|
existingParticipantIds: f,
|
|
1293
1299
|
participantLabel: z,
|
|
@@ -1300,11 +1306,11 @@ const ze = ({
|
|
|
1300
1306
|
]
|
|
1301
1307
|
}
|
|
1302
1308
|
);
|
|
1303
|
-
},
|
|
1309
|
+
}, Ye = ({
|
|
1304
1310
|
question: t,
|
|
1305
1311
|
onClick: s,
|
|
1306
1312
|
loading: n = !1,
|
|
1307
|
-
className:
|
|
1313
|
+
className: o
|
|
1308
1314
|
}) => /* @__PURE__ */ e(
|
|
1309
1315
|
"button",
|
|
1310
1316
|
{
|
|
@@ -1318,23 +1324,23 @@ const ze = ({
|
|
|
1318
1324
|
"hover:brightness-95 active:brightness-90": !n,
|
|
1319
1325
|
"opacity-50 cursor-not-allowed": n
|
|
1320
1326
|
},
|
|
1321
|
-
|
|
1327
|
+
o
|
|
1322
1328
|
),
|
|
1323
1329
|
children: t
|
|
1324
1330
|
}
|
|
1325
|
-
),
|
|
1331
|
+
), as = ({
|
|
1326
1332
|
faqs: t,
|
|
1327
1333
|
onFaqClick: s,
|
|
1328
1334
|
loadingFaqId: n,
|
|
1329
|
-
headerText:
|
|
1335
|
+
headerText: o,
|
|
1330
1336
|
className: i,
|
|
1331
1337
|
avatarImage: c,
|
|
1332
1338
|
avatarName: a
|
|
1333
1339
|
}) => {
|
|
1334
|
-
const
|
|
1335
|
-
return
|
|
1340
|
+
const l = t.filter((r) => r.enabled).sort((r, b) => (r.order ?? 0) - (b.order ?? 0));
|
|
1341
|
+
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", i), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
1336
1342
|
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1337
|
-
|
|
1343
|
+
J,
|
|
1338
1344
|
{
|
|
1339
1345
|
id: a || "account",
|
|
1340
1346
|
name: a || "Account",
|
|
@@ -1348,9 +1354,9 @@ const ze = ({
|
|
|
1348
1354
|
className: "flex-1 rounded-lg p-4 space-y-3",
|
|
1349
1355
|
style: { backgroundColor: "#F1F0EE" },
|
|
1350
1356
|
children: [
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1357
|
+
o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
|
|
1358
|
+
l.map((r) => /* @__PURE__ */ e(
|
|
1359
|
+
Ye,
|
|
1354
1360
|
{
|
|
1355
1361
|
question: r.question,
|
|
1356
1362
|
onClick: () => s(r.id),
|
|
@@ -1362,15 +1368,15 @@ const ze = ({
|
|
|
1362
1368
|
}
|
|
1363
1369
|
)
|
|
1364
1370
|
] }) });
|
|
1365
|
-
},
|
|
1366
|
-
const { initialSearch: n = "", pageSize:
|
|
1371
|
+
}, is = (t, s = {}) => {
|
|
1372
|
+
const { initialSearch: n = "", pageSize: o = 20 } = s, [i, c] = E([]), [a, l] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, I] = E(!0), [N, h] = E(), v = F(async (k = !1, T) => {
|
|
1367
1373
|
if (a) return;
|
|
1368
1374
|
const f = T !== void 0 ? T : u;
|
|
1369
|
-
|
|
1375
|
+
l(!0), b(null);
|
|
1370
1376
|
try {
|
|
1371
1377
|
const x = await t.loadParticipants({
|
|
1372
1378
|
search: f || void 0,
|
|
1373
|
-
limit:
|
|
1379
|
+
limit: o,
|
|
1374
1380
|
cursor: k ? void 0 : N
|
|
1375
1381
|
});
|
|
1376
1382
|
c(
|
|
@@ -1380,13 +1386,13 @@ const ze = ({
|
|
|
1380
1386
|
const w = x instanceof Error ? x.message : "Failed to load participants";
|
|
1381
1387
|
b(w), console.error("[useParticipants] Load error:", x);
|
|
1382
1388
|
} finally {
|
|
1383
|
-
|
|
1389
|
+
l(!1);
|
|
1384
1390
|
}
|
|
1385
|
-
}, [t, u, N,
|
|
1391
|
+
}, [t, u, N, o, a]), S = F(() => {
|
|
1386
1392
|
m && !a && v(!1);
|
|
1387
|
-
}, [m, a, v]),
|
|
1393
|
+
}, [m, a, v]), M = F((k) => {
|
|
1388
1394
|
g(k), h(void 0), v(!0, k);
|
|
1389
|
-
}, [v]), y =
|
|
1395
|
+
}, [v]), y = F(() => {
|
|
1390
1396
|
h(void 0), v(!0);
|
|
1391
1397
|
}, [v]);
|
|
1392
1398
|
return G(() => {
|
|
@@ -1399,20 +1405,20 @@ const ze = ({
|
|
|
1399
1405
|
hasMore: m,
|
|
1400
1406
|
totalCount: t.totalCount,
|
|
1401
1407
|
loadMore: S,
|
|
1402
|
-
search:
|
|
1408
|
+
search: M,
|
|
1403
1409
|
refresh: y
|
|
1404
1410
|
};
|
|
1405
1411
|
};
|
|
1406
1412
|
export {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1413
|
+
J as Avatar,
|
|
1414
|
+
Ge as ChannelList,
|
|
1415
|
+
ze as ChannelView,
|
|
1416
|
+
as as FaqList,
|
|
1417
|
+
Ye as FaqListItem,
|
|
1418
|
+
ls as MessagingProvider,
|
|
1419
|
+
os as MessagingShell,
|
|
1420
|
+
Xe as ParticipantPicker,
|
|
1421
|
+
je as useMessaging,
|
|
1422
|
+
is as useParticipants
|
|
1417
1423
|
};
|
|
1418
1424
|
//# sourceMappingURL=index.js.map
|