@linktr.ee/messaging-react 1.11.2 โ 1.11.4
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 +725 -580
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/CustomChannelPreview.tsx +1 -1
- package/src/components/ChannelView.tsx +8 -15
- package/src/components/MessagingShell/ChannelEmptyState.tsx +1 -12
- package/src/components/MessagingShell/EmptyState.tsx +105 -12
- package/src/components/MessagingShell/index.tsx +2 -2
- package/src/providers/MessagingProvider.tsx +9 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as pe, ChannelList as
|
|
6
|
-
import { XIcon as le, ArrowUpIcon as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import Z, { createContext as Ie, useContext as Se, useCallback as F, useState as v, useRef as z, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as ke } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as pe, ChannelList as Re, useMessageComposer as De, useStateStore as _e, MessageInput as Me, useMessageInputContext as Fe, useMessageComposerHasSendableData as Te, SimpleAttachmentSelector as Pe, QuotedMessagePreview as Le, AttachmentPreviewList as Ue, TextareaComposer as Oe, MessageTimestamp as je, Channel as Ae, useChannelStateContext as fe, Window as Be, MessageList as ze } from "stream-chat-react";
|
|
6
|
+
import { XIcon as le, ArrowUpIcon as Ge, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as He, ProhibitInsetIcon as ce, FlagIcon as $e, MagnifyingGlassIcon as Ve, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as ue } from "stream-chat";
|
|
8
|
-
const ge =
|
|
8
|
+
const ge = Ie({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,214 +15,223 @@ const ge = Se({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), se = () =>
|
|
18
|
+
}), se = () => Se(ge), Is = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
22
|
+
apiKey: r,
|
|
23
23
|
capabilities: o = {},
|
|
24
24
|
debug: a = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
(u, ...
|
|
28
|
-
a && console.log(`๐ฅ [MessagingProvider] ${u}`, ...
|
|
26
|
+
const l = F(
|
|
27
|
+
(u, ...x) => {
|
|
28
|
+
a && console.log(`๐ฅ [MessagingProvider] ${u}`, ...x);
|
|
29
29
|
},
|
|
30
30
|
[a]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
l("๐ RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
|
-
apiKey: (
|
|
34
|
+
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [c, m] = v(null), [g, E] = v(null), [h, f] = v(!1), [k, b] = v(!1), [w, y] = v(null), N = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
|
-
apiKey:
|
|
40
|
+
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: o
|
|
43
|
-
}), S =
|
|
44
|
-
S.current++,
|
|
43
|
+
}), S = z(0);
|
|
44
|
+
S.current++, l("๐ RENDER INFO", {
|
|
45
45
|
renderCount: S.current,
|
|
46
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
46
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
-
apiKeyChanged: I.current.apiKey !==
|
|
49
|
+
apiKeyChanged: I.current.apiKey !== r,
|
|
50
50
|
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
51
|
capabilitiesChanged: I.current.capabilities !== o
|
|
52
52
|
}
|
|
53
53
|
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
|
-
apiKey:
|
|
55
|
+
apiKey: r,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: o
|
|
58
|
-
},
|
|
58
|
+
}, G(() => {
|
|
59
59
|
const u = S.current;
|
|
60
|
-
if (
|
|
60
|
+
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
62
|
-
apiKey: !!
|
|
62
|
+
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
65
|
-
apiKey: (
|
|
65
|
+
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
67
|
serviceConfigStable: I.current.serviceConfig === n,
|
|
68
|
-
apiKeyStable: I.current.apiKey ===
|
|
68
|
+
apiKeyStable: I.current.apiKey === r
|
|
69
69
|
}
|
|
70
|
-
}), !
|
|
71
|
-
|
|
70
|
+
}), !r || !n) {
|
|
71
|
+
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
72
|
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
l("๐ CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: u,
|
|
79
|
-
apiKey: (
|
|
79
|
+
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const x = new ke({
|
|
83
83
|
...n,
|
|
84
|
-
apiKey:
|
|
84
|
+
apiKey: r,
|
|
85
85
|
debug: a
|
|
86
86
|
});
|
|
87
|
-
return m(
|
|
87
|
+
return m(x), l("โ
SERVICE SET", {
|
|
88
88
|
renderCount: u,
|
|
89
|
-
serviceInstance: !!
|
|
89
|
+
serviceInstance: !!x
|
|
90
90
|
}), () => {
|
|
91
|
-
|
|
91
|
+
l("๐งน SERVICE CLEANUP", {
|
|
92
92
|
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), x.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
hasService: !!
|
|
96
|
+
}, [r, n, a, l]);
|
|
97
|
+
const R = z(null);
|
|
98
|
+
G(() => {
|
|
99
|
+
var x, j;
|
|
100
|
+
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!c,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
104
|
+
isConnecting: N.current,
|
|
105
105
|
isConnected: h,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
108
|
-
|
|
106
|
+
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !c || !s) {
|
|
108
|
+
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
111
|
+
if (N.current) {
|
|
112
|
+
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
116
|
-
|
|
115
|
+
if (((x = R.current) == null ? void 0 : x.serviceId) === c && ((j = R.current) == null ? void 0 : j.userId) === s.id) {
|
|
116
|
+
l(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
119
119
|
);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
|
|
123
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), N.current = !0, b(!0), y(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
const A = await
|
|
127
|
-
|
|
125
|
+
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const A = await c.connectUser(s);
|
|
127
|
+
E(A), f(!0), R.current = { serviceId: c, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: A.userID
|
|
130
130
|
});
|
|
131
131
|
} catch (A) {
|
|
132
132
|
const W = A instanceof Error ? A.message : "Connection failed";
|
|
133
|
-
|
|
133
|
+
y(W), l("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
135
|
error: W
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
b(!1), N.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: h
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [c, s, l, h]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!c,
|
|
146
146
|
isConnected: h
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
c && h ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
151
|
+
), R.current = null, c.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!c,
|
|
153
153
|
isConnected: h
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
hasService: !!
|
|
155
|
+
}), [c, h, l]);
|
|
156
|
+
const _ = F(async () => {
|
|
157
|
+
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!c,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
161
|
-
|
|
160
|
+
}), !c || !s) {
|
|
161
|
+
l("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
|
|
165
165
|
try {
|
|
166
|
-
|
|
167
|
-
const u = await
|
|
168
|
-
|
|
166
|
+
l("๐ DISCONNECTING FOR REFRESH"), await c.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const u = await c.connectUser(s);
|
|
168
|
+
E(u), f(!0), y(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const x = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
+
y(x), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: x
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
b(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
180
|
-
hasClient: !!
|
|
178
|
+
}, [c, s, l]), d = Z.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!c,
|
|
180
|
+
hasClient: !!g,
|
|
181
181
|
isConnected: h,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
182
|
+
isLoading: k,
|
|
183
|
+
hasError: !!w,
|
|
184
184
|
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
187
|
-
client:
|
|
186
|
+
service: c,
|
|
187
|
+
client: g,
|
|
188
188
|
isConnected: h,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
189
|
+
isLoading: k,
|
|
190
|
+
error: w,
|
|
191
191
|
capabilities: o,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: _,
|
|
193
193
|
debug: a
|
|
194
194
|
}), [
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
c,
|
|
196
|
+
g,
|
|
197
197
|
h,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
k,
|
|
199
|
+
w,
|
|
200
200
|
o,
|
|
201
|
-
|
|
201
|
+
_,
|
|
202
202
|
a,
|
|
203
|
-
|
|
203
|
+
l
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
205
|
+
return l("๐ RENDER END", {
|
|
206
206
|
renderCount: S.current,
|
|
207
|
-
willRenderChat: !!(
|
|
207
|
+
willRenderChat: !!(g && h),
|
|
208
208
|
contextValueReady: !!d
|
|
209
|
-
}), /* @__PURE__ */ e(ge.Provider, { value: d, children:
|
|
210
|
-
|
|
209
|
+
}), /* @__PURE__ */ e(ge.Provider, { value: d, children: g && h ? /* @__PURE__ */ e(
|
|
210
|
+
pe,
|
|
211
|
+
{
|
|
212
|
+
client: g,
|
|
213
|
+
customClasses: {
|
|
214
|
+
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
|
+
},
|
|
216
|
+
children: t
|
|
217
|
+
}
|
|
218
|
+
) : t });
|
|
219
|
+
}, We = () => se(), Ze = (t, s) => {
|
|
211
220
|
const n = new Date(
|
|
212
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
213
222
|
), o = new Date(
|
|
214
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
215
224
|
).getTime() - n.getTime();
|
|
216
225
|
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
217
|
-
},
|
|
226
|
+
}, qe = (t) => {
|
|
218
227
|
const s = /* @__PURE__ */ new Date();
|
|
219
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
220
229
|
return "Just now";
|
|
221
|
-
const
|
|
222
|
-
return
|
|
230
|
+
const r = Ze(t, s);
|
|
231
|
+
return r === 0 ? t.toLocaleTimeString([], {
|
|
223
232
|
hour: "numeric",
|
|
224
233
|
minute: "2-digit"
|
|
225
|
-
}) :
|
|
234
|
+
}) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
|
|
226
235
|
month: "numeric",
|
|
227
236
|
day: "numeric",
|
|
228
237
|
year: "2-digit"
|
|
@@ -255,33 +264,33 @@ const ge = Se({
|
|
|
255
264
|
"๐"
|
|
256
265
|
// Melon
|
|
257
266
|
];
|
|
258
|
-
function
|
|
267
|
+
function Ye(t) {
|
|
259
268
|
let s = 0;
|
|
260
269
|
for (let n = 0; n < t.length; n++) {
|
|
261
|
-
const
|
|
262
|
-
s = (s << 5) - s +
|
|
270
|
+
const r = t.charCodeAt(n);
|
|
271
|
+
s = (s << 5) - s + r, s = s & s;
|
|
263
272
|
}
|
|
264
273
|
return Math.abs(s);
|
|
265
274
|
}
|
|
266
|
-
function
|
|
267
|
-
const n =
|
|
275
|
+
function Je(t) {
|
|
276
|
+
const n = Ye(t) % me.length;
|
|
268
277
|
return me[n];
|
|
269
278
|
}
|
|
270
|
-
const
|
|
279
|
+
const q = ({
|
|
271
280
|
id: t,
|
|
272
281
|
image: s,
|
|
273
282
|
size: n = 40,
|
|
274
|
-
className:
|
|
283
|
+
className: r,
|
|
275
284
|
shape: o = "squircle"
|
|
276
285
|
}) => {
|
|
277
|
-
const a =
|
|
286
|
+
const a = Je(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
|
|
278
287
|
borderRadius: "33%",
|
|
279
288
|
"corner-shape": "superellipse(1.3)"
|
|
280
289
|
};
|
|
281
290
|
return /* @__PURE__ */ e(
|
|
282
291
|
"div",
|
|
283
292
|
{
|
|
284
|
-
className:
|
|
293
|
+
className: p("flex-shrink-0 overflow-hidden", r),
|
|
285
294
|
style: {
|
|
286
295
|
width: `${n}px`,
|
|
287
296
|
height: `${n}px`,
|
|
@@ -298,124 +307,124 @@ const Y = ({
|
|
|
298
307
|
"div",
|
|
299
308
|
{
|
|
300
309
|
"aria-hidden": "true",
|
|
301
|
-
className:
|
|
310
|
+
className: p(
|
|
302
311
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
303
|
-
|
|
312
|
+
c
|
|
304
313
|
),
|
|
305
314
|
children: a
|
|
306
315
|
}
|
|
307
316
|
)
|
|
308
317
|
}
|
|
309
318
|
);
|
|
310
|
-
},
|
|
311
|
-
var
|
|
312
|
-
const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id),
|
|
319
|
+
}, Qe = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
|
|
320
|
+
var y, N, I, S, R, _;
|
|
321
|
+
const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
313
322
|
t && n(t);
|
|
314
|
-
}, m = Object.values(((
|
|
323
|
+
}, m = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
|
|
315
324
|
(d) => {
|
|
316
|
-
var u,
|
|
317
|
-
return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((
|
|
325
|
+
var u, x;
|
|
326
|
+
return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
|
|
318
327
|
}
|
|
319
|
-
),
|
|
328
|
+
), g = ((N = m == null ? void 0 : m.user) == null ? void 0 : N.name) || "Conversation", E = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : R[t.state.messages.length - 1], k = (() => {
|
|
320
329
|
var u;
|
|
321
330
|
if (h != null && h.text) return h.text;
|
|
322
331
|
const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
|
|
323
332
|
return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
|
|
324
|
-
})(),
|
|
325
|
-
return
|
|
333
|
+
})(), b = h != null && h.created_at ? qe(new Date(h.created_at)) : "", w = o ?? 0;
|
|
334
|
+
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
326
335
|
channelId: t == null ? void 0 : t.id,
|
|
327
336
|
isSelected: a,
|
|
328
|
-
participantName:
|
|
329
|
-
unreadCount:
|
|
330
|
-
hasTimestamp: !!
|
|
337
|
+
participantName: g,
|
|
338
|
+
unreadCount: w,
|
|
339
|
+
hasTimestamp: !!b
|
|
331
340
|
}), /* @__PURE__ */ e(
|
|
332
341
|
"button",
|
|
333
342
|
{
|
|
334
343
|
type: "button",
|
|
335
|
-
onClick:
|
|
336
|
-
className:
|
|
337
|
-
"group w-full px-4 py-3 transition-colors
|
|
344
|
+
onClick: l,
|
|
345
|
+
className: p(
|
|
346
|
+
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
338
347
|
{
|
|
339
348
|
"bg-primary-alt/10 border-l-4 border-l-primary": a,
|
|
340
349
|
"hover:bg-sand": !a
|
|
341
350
|
}
|
|
342
351
|
),
|
|
343
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
344
353
|
/* @__PURE__ */ e(
|
|
345
|
-
|
|
354
|
+
q,
|
|
346
355
|
{
|
|
347
|
-
id: ((
|
|
348
|
-
name:
|
|
349
|
-
image:
|
|
356
|
+
id: ((_ = m == null ? void 0 : m.user) == null ? void 0 : _.id) || t.id || "unknown",
|
|
357
|
+
name: g,
|
|
358
|
+
image: E,
|
|
350
359
|
size: 44,
|
|
351
360
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
352
361
|
}
|
|
353
362
|
),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
364
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
356
365
|
/* @__PURE__ */ e(
|
|
357
366
|
"h3",
|
|
358
367
|
{
|
|
359
|
-
className:
|
|
368
|
+
className: p(
|
|
360
369
|
"text-sm font-medium truncate",
|
|
361
370
|
a ? "text-primary" : "text-charcoal"
|
|
362
371
|
),
|
|
363
|
-
children:
|
|
372
|
+
children: g
|
|
364
373
|
}
|
|
365
374
|
),
|
|
366
|
-
|
|
375
|
+
b && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: b })
|
|
367
376
|
] }),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
370
|
-
|
|
377
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
378
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: k }),
|
|
379
|
+
w > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: w > 99 ? "99+" : w })
|
|
371
380
|
] })
|
|
372
381
|
] })
|
|
373
382
|
] })
|
|
374
383
|
}
|
|
375
384
|
);
|
|
376
|
-
},
|
|
385
|
+
}, Xe = ({
|
|
377
386
|
onChannelSelect: t,
|
|
378
387
|
selectedChannel: s,
|
|
379
388
|
filters: n,
|
|
380
|
-
className:
|
|
389
|
+
className: r,
|
|
381
390
|
customEmptyStateIndicator: o
|
|
382
391
|
}) => {
|
|
383
|
-
const a =
|
|
392
|
+
const a = Z.useRef(0);
|
|
384
393
|
a.current++;
|
|
385
|
-
const { debug:
|
|
386
|
-
return
|
|
394
|
+
const { debug: l = !1 } = se();
|
|
395
|
+
return l && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
387
396
|
renderCount: a.current,
|
|
388
397
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
389
398
|
filters: n
|
|
390
399
|
}), /* @__PURE__ */ e(
|
|
391
400
|
"div",
|
|
392
401
|
{
|
|
393
|
-
className:
|
|
402
|
+
className: p(
|
|
394
403
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
395
|
-
|
|
404
|
+
r
|
|
396
405
|
),
|
|
397
|
-
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (
|
|
406
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (l && console.log("๐บ [ChannelList] ๐ฌ RENDERING STREAM CHANNEL LIST", {
|
|
398
407
|
renderCount: a.current,
|
|
399
408
|
filters: n
|
|
400
409
|
}), /* @__PURE__ */ e(
|
|
401
|
-
|
|
410
|
+
Re,
|
|
402
411
|
{
|
|
403
412
|
filters: n,
|
|
404
413
|
sort: { last_message_at: -1 },
|
|
405
414
|
options: { limit: 30 },
|
|
406
|
-
Preview: (
|
|
407
|
-
var m,
|
|
408
|
-
return
|
|
409
|
-
channelId: (m =
|
|
415
|
+
Preview: (c) => {
|
|
416
|
+
var m, g;
|
|
417
|
+
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
418
|
+
channelId: (m = c.channel) == null ? void 0 : m.id,
|
|
410
419
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
411
|
-
isSelected: (s == null ? void 0 : s.id) === ((
|
|
420
|
+
isSelected: (s == null ? void 0 : s.id) === ((g = c.channel) == null ? void 0 : g.id)
|
|
412
421
|
}), /* @__PURE__ */ e(
|
|
413
|
-
|
|
422
|
+
Qe,
|
|
414
423
|
{
|
|
415
|
-
...
|
|
424
|
+
...c,
|
|
416
425
|
selectedChannel: s,
|
|
417
426
|
onChannelSelect: t,
|
|
418
|
-
debug:
|
|
427
|
+
debug: l
|
|
419
428
|
}
|
|
420
429
|
);
|
|
421
430
|
},
|
|
@@ -429,34 +438,34 @@ const Y = ({
|
|
|
429
438
|
variant: t = "default",
|
|
430
439
|
className: s,
|
|
431
440
|
children: n,
|
|
432
|
-
...
|
|
441
|
+
...r
|
|
433
442
|
}) => /* @__PURE__ */ e(
|
|
434
443
|
"button",
|
|
435
444
|
{
|
|
436
445
|
type: "button",
|
|
437
|
-
className:
|
|
446
|
+
className: p(
|
|
438
447
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
439
448
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
440
449
|
s
|
|
441
450
|
),
|
|
442
|
-
...
|
|
451
|
+
...r,
|
|
443
452
|
children: n
|
|
444
453
|
}
|
|
445
454
|
);
|
|
446
|
-
function xe({ label: t, className: s, children: n, ...
|
|
447
|
-
return /* @__PURE__ */
|
|
455
|
+
function xe({ label: t, className: s, children: n, ...r }) {
|
|
456
|
+
return /* @__PURE__ */ i(
|
|
448
457
|
"button",
|
|
449
458
|
{
|
|
450
459
|
type: "button",
|
|
451
|
-
className:
|
|
460
|
+
className: p(
|
|
452
461
|
"rounded-full p-2 transition-colors focus-ring",
|
|
453
462
|
{
|
|
454
|
-
"cursor-not-allowed opacity-50":
|
|
455
|
-
"hover:bg-sand": !
|
|
463
|
+
"cursor-not-allowed opacity-50": r.disabled,
|
|
464
|
+
"hover:bg-sand": !r.disabled
|
|
456
465
|
},
|
|
457
466
|
s
|
|
458
467
|
),
|
|
459
|
-
...
|
|
468
|
+
...r,
|
|
460
469
|
children: [
|
|
461
470
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
462
471
|
n
|
|
@@ -464,19 +473,19 @@ function xe({ label: t, className: s, children: n, ...l }) {
|
|
|
464
473
|
}
|
|
465
474
|
);
|
|
466
475
|
}
|
|
467
|
-
function
|
|
476
|
+
function Ce({ onClick: t }) {
|
|
468
477
|
return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
469
478
|
}
|
|
470
|
-
const
|
|
479
|
+
const Ke = (t) => ({
|
|
471
480
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
472
481
|
(s) => ue.previewIsLoaded(s) || ue.previewIsLoading(s)
|
|
473
482
|
)
|
|
474
|
-
}),
|
|
483
|
+
}), es = ({
|
|
475
484
|
link: t,
|
|
476
485
|
onDismiss: s
|
|
477
486
|
}) => {
|
|
478
|
-
const { og_scrape_url: n, title:
|
|
479
|
-
return /* @__PURE__ */
|
|
487
|
+
const { og_scrape_url: n, title: r, image_url: o } = t;
|
|
488
|
+
return /* @__PURE__ */ i(
|
|
480
489
|
"a",
|
|
481
490
|
{
|
|
482
491
|
href: n,
|
|
@@ -488,7 +497,7 @@ const es = (t) => ({
|
|
|
488
497
|
"img",
|
|
489
498
|
{
|
|
490
499
|
src: o,
|
|
491
|
-
alt:
|
|
500
|
+
alt: r || "",
|
|
492
501
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
493
502
|
}
|
|
494
503
|
),
|
|
@@ -496,47 +505,47 @@ const es = (t) => ({
|
|
|
496
505
|
"button",
|
|
497
506
|
{
|
|
498
507
|
type: "button",
|
|
499
|
-
onClick: (
|
|
500
|
-
|
|
508
|
+
onClick: (l) => {
|
|
509
|
+
l.preventDefault(), s(n);
|
|
501
510
|
},
|
|
502
511
|
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
|
|
503
512
|
"aria-label": "Close link preview",
|
|
504
513
|
children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
|
|
505
514
|
}
|
|
506
515
|
),
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
|
|
516
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
517
|
+
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
509
518
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
510
519
|
] })
|
|
511
520
|
]
|
|
512
521
|
}
|
|
513
522
|
);
|
|
514
|
-
},
|
|
515
|
-
const { linkPreviewsManager: t } =
|
|
523
|
+
}, ss = () => {
|
|
524
|
+
const { linkPreviewsManager: t } = De(), { linkPreviews: s } = _e(
|
|
516
525
|
t.state,
|
|
517
|
-
|
|
526
|
+
Ke
|
|
518
527
|
), n = (o) => {
|
|
519
528
|
t.dismissPreview(o);
|
|
520
529
|
};
|
|
521
530
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
522
|
-
|
|
531
|
+
es,
|
|
523
532
|
{
|
|
524
533
|
link: o,
|
|
525
534
|
onDismiss: n
|
|
526
535
|
},
|
|
527
536
|
o.og_scrape_url
|
|
528
537
|
)) }) : null;
|
|
529
|
-
},
|
|
530
|
-
const { handleSubmit: t } =
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
533
|
-
/* @__PURE__ */
|
|
538
|
+
}, ts = () => {
|
|
539
|
+
const { handleSubmit: t } = Fe(), s = Te();
|
|
540
|
+
return /* @__PURE__ */ i(he, { children: [
|
|
541
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Pe, {}) }),
|
|
542
|
+
/* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
543
|
+
/* @__PURE__ */ e(Le, {}),
|
|
544
|
+
/* @__PURE__ */ e(ss, {}),
|
|
534
545
|
/* @__PURE__ */ e(Ue, {}),
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */ e(Oe, {}),
|
|
537
|
-
/* @__PURE__ */ c("div", { className: "flex", children: [
|
|
546
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
538
547
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
539
|
-
|
|
548
|
+
Oe,
|
|
540
549
|
{
|
|
541
550
|
className: "w-full resize-none outline-none leading-6",
|
|
542
551
|
maxRows: 4
|
|
@@ -551,44 +560,41 @@ const es = (t) => ({
|
|
|
551
560
|
disabled: !s,
|
|
552
561
|
onClick: t,
|
|
553
562
|
type: "button",
|
|
554
|
-
children: /* @__PURE__ */ e(
|
|
563
|
+
children: /* @__PURE__ */ e(Ge, { className: "size-4" })
|
|
555
564
|
}
|
|
556
565
|
)
|
|
557
566
|
] })
|
|
558
567
|
] })
|
|
559
568
|
] });
|
|
560
|
-
},
|
|
569
|
+
}, ns = ({
|
|
561
570
|
renderActions: t
|
|
562
|
-
}) => /* @__PURE__ */
|
|
571
|
+
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
563
572
|
t && (t == null ? void 0 : t()),
|
|
564
|
-
/* @__PURE__ */ e(
|
|
565
|
-
] }),
|
|
573
|
+
/* @__PURE__ */ e(Me, { Input: ts })
|
|
574
|
+
] }), rs = (t) => {
|
|
566
575
|
const s = t.message.hide_date === !0;
|
|
567
|
-
return /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
577
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
569
578
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
570
579
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
571
580
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
572
581
|
] }),
|
|
573
|
-
!s && /* @__PURE__ */ e(
|
|
582
|
+
!s && /* @__PURE__ */ e(je, { message: t.message })
|
|
574
583
|
] });
|
|
575
|
-
},
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
(g) => {
|
|
582
|
-
var C;
|
|
583
|
-
return ((C = g.user) == null ? void 0 : C.id) && g.user.id !== o._client.userID;
|
|
584
|
+
}, ls = () => null, os = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
585
|
+
var m, g, E, h, f;
|
|
586
|
+
const { channel: o } = fe(), a = Z.useMemo(() => Object.values(o.state.members || {}).find(
|
|
587
|
+
(b) => {
|
|
588
|
+
var w;
|
|
589
|
+
return ((w = b.user) == null ? void 0 : w.id) && b.user.id !== o._client.userID;
|
|
584
590
|
}
|
|
585
|
-
), [o._client.userID, o.state.members]),
|
|
586
|
-
return /* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
591
|
+
), [o._client.userID, o.state.members]), l = ((m = a == null ? void 0 : a.user) == null ? void 0 : m.name) || ((g = a == null ? void 0 : a.user) == null ? void 0 : g.id) || "Unknown member", c = (E = a == null ? void 0 : a.user) == null ? void 0 : E.image;
|
|
592
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
593
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
588
594
|
/* @__PURE__ */ e(
|
|
589
595
|
"button",
|
|
590
596
|
{
|
|
591
|
-
className:
|
|
597
|
+
className: p(
|
|
592
598
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
593
599
|
!s && "invisible"
|
|
594
600
|
),
|
|
@@ -597,22 +603,22 @@ const es = (t) => ({
|
|
|
597
603
|
children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
|
|
598
604
|
}
|
|
599
605
|
),
|
|
600
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
601
607
|
/* @__PURE__ */ e(
|
|
602
|
-
|
|
608
|
+
q,
|
|
603
609
|
{
|
|
604
610
|
id: ((h = a == null ? void 0 : a.user) == null ? void 0 : h.id) || o.id || "unknown",
|
|
605
|
-
name:
|
|
606
|
-
image:
|
|
611
|
+
name: l,
|
|
612
|
+
image: c,
|
|
607
613
|
size: 40
|
|
608
614
|
}
|
|
609
615
|
),
|
|
610
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
616
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: l })
|
|
611
617
|
] }),
|
|
612
618
|
/* @__PURE__ */ e(
|
|
613
619
|
"button",
|
|
614
620
|
{
|
|
615
|
-
className:
|
|
621
|
+
className: p(
|
|
616
622
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
617
623
|
),
|
|
618
624
|
onClick: n || (() => {
|
|
@@ -621,8 +627,8 @@ const es = (t) => ({
|
|
|
621
627
|
}
|
|
622
628
|
)
|
|
623
629
|
] }),
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
631
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
626
632
|
s && t && /* @__PURE__ */ e(
|
|
627
633
|
"button",
|
|
628
634
|
{
|
|
@@ -634,20 +640,20 @@ const es = (t) => ({
|
|
|
634
640
|
}
|
|
635
641
|
),
|
|
636
642
|
/* @__PURE__ */ e(
|
|
637
|
-
|
|
643
|
+
q,
|
|
638
644
|
{
|
|
639
645
|
id: ((f = a == null ? void 0 : a.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
640
|
-
name:
|
|
641
|
-
image:
|
|
646
|
+
name: l,
|
|
647
|
+
image: c,
|
|
642
648
|
size: 40
|
|
643
649
|
}
|
|
644
650
|
),
|
|
645
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
651
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: l }) })
|
|
646
652
|
] }),
|
|
647
|
-
|
|
653
|
+
r && n && /* @__PURE__ */ e(
|
|
648
654
|
"button",
|
|
649
655
|
{
|
|
650
|
-
className:
|
|
656
|
+
className: p(
|
|
651
657
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
652
658
|
),
|
|
653
659
|
onClick: n,
|
|
@@ -660,76 +666,76 @@ const es = (t) => ({
|
|
|
660
666
|
isOpen: t,
|
|
661
667
|
onClose: s,
|
|
662
668
|
participant: n,
|
|
663
|
-
channel:
|
|
669
|
+
channel: r,
|
|
664
670
|
followerStatusLabel: o,
|
|
665
671
|
onLeaveConversation: a,
|
|
666
|
-
onBlockParticipant:
|
|
672
|
+
onBlockParticipant: l
|
|
667
673
|
}) => {
|
|
668
|
-
var W, O,
|
|
669
|
-
const { service:
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
674
|
+
var W, O, $, Y, H, V, J;
|
|
675
|
+
const { service: c, debug: m } = se(), g = z(null), [E, h] = v(!1), [f, k] = v(!1), [b, w] = v(!1);
|
|
676
|
+
G(() => {
|
|
677
|
+
const D = g.current;
|
|
678
|
+
D && (t ? D.showModal() : D.close());
|
|
673
679
|
}, [t]);
|
|
674
|
-
const
|
|
675
|
-
var
|
|
676
|
-
if (!(!
|
|
680
|
+
const y = F(async () => {
|
|
681
|
+
var D;
|
|
682
|
+
if (!(!c || !((D = n == null ? void 0 : n.user) != null && D.id)))
|
|
677
683
|
try {
|
|
678
|
-
const P = (await
|
|
684
|
+
const P = (await c.getBlockedUsers()).some(
|
|
679
685
|
(L) => {
|
|
680
|
-
var
|
|
681
|
-
return L.blocked_user_id === ((
|
|
686
|
+
var Q;
|
|
687
|
+
return L.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
|
|
682
688
|
}
|
|
683
689
|
);
|
|
684
690
|
h(P);
|
|
685
|
-
} catch (
|
|
691
|
+
} catch (T) {
|
|
686
692
|
console.error(
|
|
687
693
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
688
|
-
|
|
694
|
+
T
|
|
689
695
|
);
|
|
690
696
|
}
|
|
691
|
-
}, [
|
|
692
|
-
|
|
693
|
-
t &&
|
|
694
|
-
}, [t,
|
|
695
|
-
const
|
|
696
|
-
var
|
|
697
|
+
}, [c, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
|
|
698
|
+
G(() => {
|
|
699
|
+
t && y();
|
|
700
|
+
}, [t, y]);
|
|
701
|
+
const N = async () => {
|
|
702
|
+
var D;
|
|
697
703
|
if (!f) {
|
|
698
|
-
m && console.log("[ChannelInfoDialog] Leave conversation",
|
|
704
|
+
m && console.log("[ChannelInfoDialog] Leave conversation", r.cid), k(!0);
|
|
699
705
|
try {
|
|
700
|
-
const
|
|
701
|
-
await
|
|
702
|
-
} catch (
|
|
703
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
706
|
+
const T = ((D = r._client) == null ? void 0 : D.userID) ?? null;
|
|
707
|
+
await r.hide(T, !1), a && await a(r), s();
|
|
708
|
+
} catch (T) {
|
|
709
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
704
710
|
} finally {
|
|
705
|
-
|
|
711
|
+
k(!1);
|
|
706
712
|
}
|
|
707
713
|
}
|
|
708
714
|
}, I = async () => {
|
|
709
|
-
var
|
|
710
|
-
if (!(
|
|
711
|
-
m && console.log("[ChannelInfoDialog] Block member", (
|
|
715
|
+
var D, T, P;
|
|
716
|
+
if (!(b || !c)) {
|
|
717
|
+
m && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), w(!0);
|
|
712
718
|
try {
|
|
713
|
-
await
|
|
719
|
+
await c.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
714
720
|
} catch (L) {
|
|
715
721
|
console.error("[ChannelInfoDialog] Failed to block member", L);
|
|
716
722
|
} finally {
|
|
717
|
-
|
|
723
|
+
w(!1);
|
|
718
724
|
}
|
|
719
725
|
}
|
|
720
726
|
}, S = async () => {
|
|
721
|
-
var
|
|
722
|
-
if (!(
|
|
723
|
-
m && console.log("[ChannelInfoDialog] Unblock member", (
|
|
727
|
+
var D, T, P;
|
|
728
|
+
if (!(b || !c)) {
|
|
729
|
+
m && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), w(!0);
|
|
724
730
|
try {
|
|
725
|
-
await
|
|
731
|
+
await c.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
726
732
|
} catch (L) {
|
|
727
733
|
console.error("[ChannelInfoDialog] Failed to unblock member", L);
|
|
728
734
|
} finally {
|
|
729
|
-
|
|
735
|
+
w(!1);
|
|
730
736
|
}
|
|
731
737
|
}
|
|
732
|
-
},
|
|
738
|
+
}, R = () => {
|
|
733
739
|
s(), window.open(
|
|
734
740
|
"https://linktr.ee/s/about/trust-center/report",
|
|
735
741
|
"_blank",
|
|
@@ -737,42 +743,42 @@ const es = (t) => ({
|
|
|
737
743
|
);
|
|
738
744
|
};
|
|
739
745
|
if (!n) return null;
|
|
740
|
-
const
|
|
746
|
+
const _ = ((O = n.user) == null ? void 0 : O.name) || (($ = n.user) == null ? void 0 : $.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, x = (V = n.user) == null ? void 0 : V.username, j = u || (x ? `linktr.ee/${x}` : void 0), A = ((J = n.user) == null ? void 0 : J.id) || "unknown";
|
|
741
747
|
return (
|
|
742
748
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
743
749
|
/* @__PURE__ */ e(
|
|
744
750
|
"dialog",
|
|
745
751
|
{
|
|
746
|
-
ref:
|
|
747
|
-
className: "mes-dialog",
|
|
752
|
+
ref: g,
|
|
753
|
+
className: "mes-dialog group",
|
|
748
754
|
onClose: s,
|
|
749
|
-
onClick: (
|
|
750
|
-
|
|
755
|
+
onClick: (D) => {
|
|
756
|
+
D.target === g.current && s();
|
|
751
757
|
},
|
|
752
|
-
children: /* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
758
|
+
children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
759
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
754
760
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
755
|
-
/* @__PURE__ */ e(
|
|
761
|
+
/* @__PURE__ */ e(Ce, { onClick: s })
|
|
756
762
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
758
764
|
/* @__PURE__ */ e(
|
|
759
765
|
"div",
|
|
760
766
|
{
|
|
761
767
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
762
768
|
style: { backgroundColor: "#FBFAF9" },
|
|
763
|
-
children: /* @__PURE__ */
|
|
769
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
764
770
|
/* @__PURE__ */ e(
|
|
765
|
-
|
|
771
|
+
q,
|
|
766
772
|
{
|
|
767
773
|
id: A,
|
|
768
|
-
name:
|
|
774
|
+
name: _,
|
|
769
775
|
image: d,
|
|
770
776
|
size: 88,
|
|
771
777
|
shape: "circle"
|
|
772
778
|
}
|
|
773
779
|
),
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
780
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
781
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: _ }),
|
|
776
782
|
j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
|
|
777
783
|
o && /* @__PURE__ */ e(
|
|
778
784
|
"span",
|
|
@@ -792,44 +798,44 @@ const es = (t) => ({
|
|
|
792
798
|
] })
|
|
793
799
|
}
|
|
794
800
|
),
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
802
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
797
803
|
K,
|
|
798
804
|
{
|
|
799
|
-
onClick:
|
|
805
|
+
onClick: N,
|
|
800
806
|
disabled: f,
|
|
801
807
|
"aria-busy": f,
|
|
802
808
|
children: [
|
|
803
|
-
f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
809
|
+
f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-5 w-5" }),
|
|
804
810
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
805
811
|
]
|
|
806
812
|
}
|
|
807
813
|
) }),
|
|
808
|
-
/* @__PURE__ */ e("li", { children:
|
|
814
|
+
/* @__PURE__ */ e("li", { children: E ? /* @__PURE__ */ i(
|
|
809
815
|
K,
|
|
810
816
|
{
|
|
811
817
|
onClick: S,
|
|
812
|
-
disabled:
|
|
813
|
-
"aria-busy":
|
|
818
|
+
disabled: b,
|
|
819
|
+
"aria-busy": b,
|
|
814
820
|
children: [
|
|
815
|
-
|
|
821
|
+
b ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
|
|
816
822
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
817
823
|
]
|
|
818
824
|
}
|
|
819
|
-
) : /* @__PURE__ */
|
|
825
|
+
) : /* @__PURE__ */ i(
|
|
820
826
|
K,
|
|
821
827
|
{
|
|
822
828
|
onClick: I,
|
|
823
|
-
disabled:
|
|
824
|
-
"aria-busy":
|
|
829
|
+
disabled: b,
|
|
830
|
+
"aria-busy": b,
|
|
825
831
|
children: [
|
|
826
|
-
|
|
832
|
+
b ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
|
|
827
833
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
828
834
|
]
|
|
829
835
|
}
|
|
830
836
|
) }),
|
|
831
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
832
|
-
/* @__PURE__ */ e(
|
|
837
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(K, { variant: "danger", onClick: R, children: [
|
|
838
|
+
/* @__PURE__ */ e($e, { className: "h-5 w-5" }),
|
|
833
839
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
834
840
|
] }) })
|
|
835
841
|
] })
|
|
@@ -842,61 +848,56 @@ const es = (t) => ({
|
|
|
842
848
|
onBack: t,
|
|
843
849
|
showBackButton: s,
|
|
844
850
|
renderMessageInputActions: n,
|
|
845
|
-
onLeaveConversation:
|
|
846
|
-
onBlockParticipant: o
|
|
847
|
-
CustomChannelEmptyState: a = be
|
|
851
|
+
onLeaveConversation: r,
|
|
852
|
+
onBlockParticipant: o
|
|
848
853
|
}) => {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
return ((w = C.user) == null ? void 0 : w.id) && C.user.id !== r._client.userID;
|
|
854
|
+
const { channel: a } = fe(), [l, c] = v(!1), m = Z.useMemo(() => Object.values(a.state.members || {}).find(
|
|
855
|
+
(h) => {
|
|
856
|
+
var f;
|
|
857
|
+
return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== a._client.userID;
|
|
854
858
|
}
|
|
855
|
-
), [
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
858
|
-
return String(
|
|
859
|
-
if (
|
|
860
|
-
return
|
|
861
|
-
}, [
|
|
862
|
-
return /* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
859
|
+
), [a._client.userID, a.state.members]), g = Z.useMemo(() => {
|
|
860
|
+
const E = a.data ?? {};
|
|
861
|
+
if (E.followerStatus)
|
|
862
|
+
return String(E.followerStatus);
|
|
863
|
+
if (E.isFollower !== void 0)
|
|
864
|
+
return E.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
865
|
+
}, [a.data]);
|
|
866
|
+
return /* @__PURE__ */ i(he, { children: [
|
|
867
|
+
/* @__PURE__ */ i(Be, { children: [
|
|
864
868
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
865
869
|
os,
|
|
866
870
|
{
|
|
867
871
|
onBack: t,
|
|
868
872
|
showBackButton: s,
|
|
869
|
-
onShowInfo: () =>
|
|
870
|
-
canShowInfo: !!
|
|
873
|
+
onShowInfo: () => c(!0),
|
|
874
|
+
canShowInfo: !!m
|
|
875
|
+
}
|
|
876
|
+
) }),
|
|
877
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
878
|
+
ze,
|
|
879
|
+
{
|
|
880
|
+
hideDeletedMessages: !0,
|
|
881
|
+
hideNewMessageSeparator: !1,
|
|
882
|
+
messageActions: []
|
|
871
883
|
}
|
|
872
884
|
) }),
|
|
873
|
-
/* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
874
|
-
/* @__PURE__ */ e(
|
|
875
|
-
He,
|
|
876
|
-
{
|
|
877
|
-
hideDeletedMessages: !0,
|
|
878
|
-
hideNewMessageSeparator: !1,
|
|
879
|
-
messageActions: []
|
|
880
|
-
}
|
|
881
|
-
),
|
|
882
|
-
!x && a && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(a, {}) })
|
|
883
|
-
] }),
|
|
884
885
|
/* @__PURE__ */ e(
|
|
885
|
-
|
|
886
|
+
ns,
|
|
886
887
|
{
|
|
887
|
-
renderActions: () => n == null ? void 0 : n(
|
|
888
|
+
renderActions: () => n == null ? void 0 : n(a)
|
|
888
889
|
}
|
|
889
890
|
)
|
|
890
891
|
] }),
|
|
891
892
|
/* @__PURE__ */ e(
|
|
892
893
|
as,
|
|
893
894
|
{
|
|
894
|
-
isOpen:
|
|
895
|
-
onClose: () =>
|
|
896
|
-
participant:
|
|
897
|
-
channel:
|
|
898
|
-
followerStatusLabel:
|
|
899
|
-
onLeaveConversation:
|
|
895
|
+
isOpen: l,
|
|
896
|
+
onClose: () => c(!1),
|
|
897
|
+
participant: m,
|
|
898
|
+
channel: a,
|
|
899
|
+
followerStatusLabel: g,
|
|
900
|
+
onLeaveConversation: r,
|
|
900
901
|
onBlockParticipant: o
|
|
901
902
|
}
|
|
902
903
|
)
|
|
@@ -905,29 +906,37 @@ const es = (t) => ({
|
|
|
905
906
|
channel: t,
|
|
906
907
|
onBack: s,
|
|
907
908
|
showBackButton: n = !1,
|
|
908
|
-
renderMessageInputActions:
|
|
909
|
+
renderMessageInputActions: r,
|
|
909
910
|
onLeaveConversation: o,
|
|
910
911
|
onBlockParticipant: a,
|
|
911
|
-
className:
|
|
912
|
-
CustomChannelEmptyState:
|
|
912
|
+
className: l,
|
|
913
|
+
CustomChannelEmptyState: c = ls
|
|
913
914
|
}) => /* @__PURE__ */ e(
|
|
914
915
|
"div",
|
|
915
916
|
{
|
|
916
|
-
className:
|
|
917
|
-
"messaging-channel-view h-full flex flex-col
|
|
918
|
-
|
|
917
|
+
className: p(
|
|
918
|
+
"messaging-channel-view h-full flex flex-col",
|
|
919
|
+
l
|
|
919
920
|
),
|
|
920
|
-
children: /* @__PURE__ */ e(
|
|
921
|
-
|
|
921
|
+
children: /* @__PURE__ */ e(
|
|
922
|
+
Ae,
|
|
922
923
|
{
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
924
|
+
channel: t,
|
|
925
|
+
MessageSystem: rs,
|
|
926
|
+
EmptyStateIndicator: c,
|
|
927
|
+
children: /* @__PURE__ */ e(
|
|
928
|
+
is,
|
|
929
|
+
{
|
|
930
|
+
onBack: s,
|
|
931
|
+
showBackButton: n,
|
|
932
|
+
renderMessageInputActions: r,
|
|
933
|
+
onLeaveConversation: o,
|
|
934
|
+
onBlockParticipant: a,
|
|
935
|
+
CustomChannelEmptyState: c
|
|
936
|
+
}
|
|
937
|
+
)
|
|
929
938
|
}
|
|
930
|
-
)
|
|
939
|
+
)
|
|
931
940
|
}
|
|
932
941
|
);
|
|
933
942
|
function ds({
|
|
@@ -935,10 +944,10 @@ function ds({
|
|
|
935
944
|
setSearchQuery: s,
|
|
936
945
|
placeholder: n
|
|
937
946
|
}) {
|
|
938
|
-
const
|
|
939
|
-
return /* @__PURE__ */
|
|
947
|
+
const r = z(null);
|
|
948
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
940
949
|
/* @__PURE__ */ e(
|
|
941
|
-
|
|
950
|
+
Ve,
|
|
942
951
|
{
|
|
943
952
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
944
953
|
weight: "bold"
|
|
@@ -947,7 +956,7 @@ function ds({
|
|
|
947
956
|
/* @__PURE__ */ e(
|
|
948
957
|
"input",
|
|
949
958
|
{
|
|
950
|
-
ref:
|
|
959
|
+
ref: r,
|
|
951
960
|
type: "text",
|
|
952
961
|
placeholder: n,
|
|
953
962
|
value: t,
|
|
@@ -961,7 +970,7 @@ function ds({
|
|
|
961
970
|
label: "Clear search",
|
|
962
971
|
onClick: () => {
|
|
963
972
|
var o;
|
|
964
|
-
s(""), (o =
|
|
973
|
+
s(""), (o = r.current) == null || o.focus();
|
|
965
974
|
},
|
|
966
975
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
967
976
|
children: /* @__PURE__ */ e(le, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -973,69 +982,69 @@ const us = ({
|
|
|
973
982
|
participantSource: t,
|
|
974
983
|
onSelectParticipant: s,
|
|
975
984
|
onClose: n,
|
|
976
|
-
existingParticipantIds:
|
|
985
|
+
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
977
986
|
participantLabel: o = "participants",
|
|
978
987
|
searchPlaceholder: a = "Search participants...",
|
|
979
|
-
className:
|
|
988
|
+
className: l
|
|
980
989
|
}) => {
|
|
981
|
-
const { debug:
|
|
990
|
+
const { debug: c } = se(), [m, g] = v(""), [E, h] = v([]), [f, k] = v(!1), [b, w] = v(null), [y, N] = v(
|
|
982
991
|
null
|
|
983
|
-
), I =
|
|
984
|
-
|
|
992
|
+
), I = z(!1);
|
|
993
|
+
G(() => {
|
|
985
994
|
if (t.loading) {
|
|
986
|
-
|
|
995
|
+
c && console.log(
|
|
987
996
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
988
997
|
);
|
|
989
998
|
return;
|
|
990
999
|
}
|
|
991
1000
|
if (I.current) return;
|
|
992
1001
|
(async () => {
|
|
993
|
-
|
|
1002
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), k(!0), w(null);
|
|
994
1003
|
try {
|
|
995
1004
|
const u = await t.loadParticipants({
|
|
996
1005
|
search: "",
|
|
997
1006
|
// Load all participants initially
|
|
998
1007
|
limit: 100
|
|
999
1008
|
});
|
|
1000
|
-
h(u.participants), I.current = !0,
|
|
1009
|
+
h(u.participants), I.current = !0, c && console.log(
|
|
1001
1010
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1002
1011
|
u.participants.length
|
|
1003
1012
|
);
|
|
1004
1013
|
} catch (u) {
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1014
|
+
const x = u instanceof Error ? u.message : "Failed to load participants";
|
|
1015
|
+
w(x), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1007
1016
|
} finally {
|
|
1008
|
-
|
|
1017
|
+
k(!1);
|
|
1009
1018
|
}
|
|
1010
1019
|
})();
|
|
1011
|
-
}, [t.loading,
|
|
1012
|
-
const S =
|
|
1013
|
-
var
|
|
1020
|
+
}, [t.loading, c]);
|
|
1021
|
+
const S = E.filter((d) => !r.has(d.id)).filter((d) => {
|
|
1022
|
+
var x;
|
|
1014
1023
|
if (!m) return !0;
|
|
1015
1024
|
const u = m.toLowerCase();
|
|
1016
|
-
return d.name.toLowerCase().includes(u) || ((
|
|
1017
|
-
}),
|
|
1025
|
+
return d.name.toLowerCase().includes(u) || ((x = d.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
|
|
1026
|
+
}), R = F(
|
|
1018
1027
|
async (d) => {
|
|
1019
|
-
if (!
|
|
1020
|
-
|
|
1028
|
+
if (!y) {
|
|
1029
|
+
N(d.id);
|
|
1021
1030
|
try {
|
|
1022
1031
|
await s(d);
|
|
1023
1032
|
} catch (u) {
|
|
1024
|
-
console.error("[ParticipantPicker] Failed to start chat:", u),
|
|
1033
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), N(null);
|
|
1025
1034
|
}
|
|
1026
1035
|
}
|
|
1027
1036
|
},
|
|
1028
|
-
[s,
|
|
1029
|
-
),
|
|
1030
|
-
(d.key === "Enter" || d.key === " ") && (d.preventDefault(),
|
|
1037
|
+
[s, y]
|
|
1038
|
+
), _ = (d, u) => {
|
|
1039
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), R(u));
|
|
1031
1040
|
};
|
|
1032
|
-
return /* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1041
|
+
return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
|
|
1042
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1043
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1035
1044
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1036
|
-
/* @__PURE__ */ e(
|
|
1045
|
+
/* @__PURE__ */ e(Ce, { onClick: n })
|
|
1037
1046
|
] }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1039
1048
|
"Select a ",
|
|
1040
1049
|
o.slice(0, -1),
|
|
1041
1050
|
" to start messaging (",
|
|
@@ -1047,42 +1056,42 @@ const us = ({
|
|
|
1047
1056
|
ds,
|
|
1048
1057
|
{
|
|
1049
1058
|
searchQuery: m,
|
|
1050
|
-
setSearchQuery:
|
|
1059
|
+
setSearchQuery: g,
|
|
1051
1060
|
placeholder: a
|
|
1052
1061
|
}
|
|
1053
1062
|
)
|
|
1054
1063
|
] }),
|
|
1055
|
-
|
|
1064
|
+
b && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1056
1065
|
"Error loading ",
|
|
1057
1066
|
o,
|
|
1058
1067
|
": ",
|
|
1059
|
-
|
|
1068
|
+
b
|
|
1060
1069
|
] }),
|
|
1061
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1062
1071
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1063
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1064
1073
|
"Loading ",
|
|
1065
1074
|
o,
|
|
1066
1075
|
"..."
|
|
1067
1076
|
] })
|
|
1068
|
-
] }) }) : S.length === 0 ? /* @__PURE__ */
|
|
1077
|
+
] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1069
1078
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1070
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` :
|
|
1071
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" :
|
|
1072
|
-
] }) : /* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` : E.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1080
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : E.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1081
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1073
1082
|
S.map((d) => {
|
|
1074
|
-
const u = d.name || d.email || d.id,
|
|
1083
|
+
const u = d.name || d.email || d.id, x = d.email && d.name ? d.email : d.phone;
|
|
1075
1084
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1076
1085
|
"button",
|
|
1077
1086
|
{
|
|
1078
1087
|
type: "button",
|
|
1079
|
-
onClick: () =>
|
|
1080
|
-
onKeyDown: (j) =>
|
|
1088
|
+
onClick: () => R(d),
|
|
1089
|
+
onKeyDown: (j) => _(j, d),
|
|
1081
1090
|
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",
|
|
1082
|
-
children: /* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1091
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1092
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1084
1093
|
/* @__PURE__ */ e(
|
|
1085
|
-
|
|
1094
|
+
q,
|
|
1086
1095
|
{
|
|
1087
1096
|
id: d.id,
|
|
1088
1097
|
name: u,
|
|
@@ -1090,27 +1099,163 @@ const us = ({
|
|
|
1090
1099
|
size: 40
|
|
1091
1100
|
}
|
|
1092
1101
|
),
|
|
1093
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1094
1103
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1095
|
-
|
|
1104
|
+
x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
|
|
1096
1105
|
] })
|
|
1097
1106
|
] }),
|
|
1098
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1107
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: y === d.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
|
|
1099
1108
|
] })
|
|
1100
1109
|
}
|
|
1101
1110
|
) }, d.id);
|
|
1102
1111
|
}),
|
|
1103
|
-
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1112
|
+
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1104
1113
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1105
1114
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1106
1115
|
] }) })
|
|
1107
1116
|
] }) })
|
|
1108
1117
|
] });
|
|
1109
|
-
}, ms = ({
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1118
|
+
}, ms = ({ className: t }) => /* @__PURE__ */ i(
|
|
1119
|
+
"svg",
|
|
1120
|
+
{
|
|
1121
|
+
width: "140",
|
|
1122
|
+
height: "120",
|
|
1123
|
+
viewBox: "44 -2 144 126",
|
|
1124
|
+
fill: "none",
|
|
1125
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1126
|
+
className: t,
|
|
1127
|
+
children: [
|
|
1128
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1129
|
+
/* @__PURE__ */ e(
|
|
1130
|
+
"path",
|
|
1131
|
+
{
|
|
1132
|
+
d: "M123.68 82.1932C123.383 103.675 105.839 121 84.2417 121C77.4724 121 71.0986 119.297 65.5327 116.299L52.5873 119.687L53.8036 106.673C48.1776 99.8701 44.7994 91.1453 44.7994 81.6356C44.7994 59.8965 62.4554 42.2754 84.2374 42.2754C89.1328 42.2754 93.8175 43.1633 98.1413 44.789",
|
|
1133
|
+
fill: "#D7D4CE"
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ e(
|
|
1137
|
+
"path",
|
|
1138
|
+
{
|
|
1139
|
+
d: "M84.2458 86.0364C82.2851 86.0364 80.6957 84.4501 80.6957 82.4933C80.6957 80.5365 82.2851 78.9502 84.2458 78.9502C86.2065 78.9502 87.7959 80.5365 87.7959 82.4933C87.7959 84.4501 86.2065 86.0364 84.2458 86.0364Z",
|
|
1140
|
+
fill: "white"
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ e(
|
|
1144
|
+
"path",
|
|
1145
|
+
{
|
|
1146
|
+
d: "M68.3044 86.0364C66.3437 86.0364 64.7543 84.4501 64.7543 82.4933C64.7543 80.5365 66.3437 78.9502 68.3044 78.9502C70.2651 78.9502 71.8545 80.5365 71.8545 82.4933C71.8545 84.4501 70.2651 86.0364 68.3044 86.0364Z",
|
|
1147
|
+
fill: "white"
|
|
1148
|
+
}
|
|
1149
|
+
),
|
|
1150
|
+
/* @__PURE__ */ e(
|
|
1151
|
+
"path",
|
|
1152
|
+
{
|
|
1153
|
+
d: "M100.183 86.0364C98.2226 86.0364 96.6332 84.4501 96.6332 82.4933C96.6332 80.5365 98.2226 78.9502 100.183 78.9502C102.144 78.9502 103.733 80.5365 103.733 82.4933C103.733 84.4501 102.144 86.0364 100.183 86.0364Z",
|
|
1154
|
+
fill: "white"
|
|
1155
|
+
}
|
|
1156
|
+
),
|
|
1157
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1158
|
+
/* @__PURE__ */ e(
|
|
1159
|
+
"path",
|
|
1160
|
+
{
|
|
1161
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1162
|
+
fill: "white"
|
|
1163
|
+
}
|
|
1164
|
+
),
|
|
1165
|
+
/* @__PURE__ */ e(
|
|
1166
|
+
"path",
|
|
1167
|
+
{
|
|
1168
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1169
|
+
stroke: "#D7D4CE",
|
|
1170
|
+
strokeWidth: "2",
|
|
1171
|
+
strokeMiterlimit: "10"
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
] }),
|
|
1175
|
+
/* @__PURE__ */ e(
|
|
1176
|
+
"path",
|
|
1177
|
+
{
|
|
1178
|
+
d: "M139.502 45.5431C137.541 45.5431 135.952 43.9568 135.952 42C135.952 40.0432 137.541 38.4569 139.502 38.4569C141.462 38.4569 143.052 40.0432 143.052 42C143.052 43.9568 141.462 45.5431 139.502 45.5431Z",
|
|
1179
|
+
fill: "#D7D4CE"
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
/* @__PURE__ */ e(
|
|
1183
|
+
"path",
|
|
1184
|
+
{
|
|
1185
|
+
d: "M123.561 45.5431C121.601 45.5431 120.011 43.9568 120.011 42C120.011 40.0432 121.601 38.4569 123.561 38.4569C125.522 38.4569 127.111 40.0432 127.111 42C127.111 43.9568 125.522 45.5431 123.561 45.5431Z",
|
|
1186
|
+
fill: "#D7D4CE"
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ e(
|
|
1190
|
+
"path",
|
|
1191
|
+
{
|
|
1192
|
+
d: "M155.439 45.5431C153.478 45.5431 151.889 43.9568 151.889 42C151.889 40.0432 153.478 38.4569 155.439 38.4569C157.4 38.4569 158.989 40.0432 158.989 42C158.989 43.9568 157.4 45.5431 155.439 45.5431Z",
|
|
1193
|
+
fill: "#D7D4CE"
|
|
1194
|
+
}
|
|
1195
|
+
)
|
|
1196
|
+
] }),
|
|
1197
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1198
|
+
/* @__PURE__ */ i(
|
|
1199
|
+
"filter",
|
|
1200
|
+
{
|
|
1201
|
+
id: "filter0_empty_state",
|
|
1202
|
+
x: "97",
|
|
1203
|
+
y: "-1",
|
|
1204
|
+
width: "89",
|
|
1205
|
+
height: "90",
|
|
1206
|
+
filterUnits: "userSpaceOnUse",
|
|
1207
|
+
colorInterpolationFilters: "sRGB",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ e("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
1210
|
+
/* @__PURE__ */ e(
|
|
1211
|
+
"feColorMatrix",
|
|
1212
|
+
{
|
|
1213
|
+
in: "SourceAlpha",
|
|
1214
|
+
type: "matrix",
|
|
1215
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
1216
|
+
result: "hardAlpha"
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ e("feOffset", { dx: "4", dy: "4" }),
|
|
1220
|
+
/* @__PURE__ */ e("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
1221
|
+
/* @__PURE__ */ e(
|
|
1222
|
+
"feColorMatrix",
|
|
1223
|
+
{
|
|
1224
|
+
type: "matrix",
|
|
1225
|
+
values: "0 0 0 0 0.8428 0 0 0 0 0.830064 0 0 0 0 0.8095 0 0 0 1 0"
|
|
1226
|
+
}
|
|
1227
|
+
),
|
|
1228
|
+
/* @__PURE__ */ e(
|
|
1229
|
+
"feBlend",
|
|
1230
|
+
{
|
|
1231
|
+
mode: "normal",
|
|
1232
|
+
in2: "BackgroundImageFix",
|
|
1233
|
+
result: "effect1_dropShadow"
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ e(
|
|
1237
|
+
"feBlend",
|
|
1238
|
+
{
|
|
1239
|
+
mode: "normal",
|
|
1240
|
+
in: "SourceGraphic",
|
|
1241
|
+
in2: "effect1_dropShadow",
|
|
1242
|
+
result: "shape"
|
|
1243
|
+
}
|
|
1244
|
+
)
|
|
1245
|
+
]
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ e("clipPath", { id: "clip0_empty_state", children: /* @__PURE__ */ e("rect", { width: "233", height: "233", fill: "white" }) })
|
|
1249
|
+
] })
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
), hs = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1253
|
+
/* @__PURE__ */ e(ms, {}),
|
|
1254
|
+
!t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1255
|
+
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1256
|
+
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1257
|
+
] })
|
|
1258
|
+
] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
|
|
1114
1259
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "โ ๏ธ" }) }),
|
|
1115
1260
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1116
1261
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1123,12 +1268,12 @@ const us = ({
|
|
|
1123
1268
|
children: "Go Back"
|
|
1124
1269
|
}
|
|
1125
1270
|
)
|
|
1126
|
-
] }) }),
|
|
1271
|
+
] }) }), fs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1127
1272
|
"div",
|
|
1128
1273
|
{
|
|
1129
|
-
className:
|
|
1274
|
+
className: p("flex items-center justify-center h-full", t),
|
|
1130
1275
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1132
1277
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1133
1278
|
"animateTransform",
|
|
1134
1279
|
{
|
|
@@ -1166,87 +1311,87 @@ const us = ({
|
|
|
1166
1311
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1167
1312
|
]
|
|
1168
1313
|
}
|
|
1169
|
-
),
|
|
1170
|
-
/* @__PURE__ */ e(
|
|
1314
|
+
), gs = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1315
|
+
/* @__PURE__ */ e(fs, { className: "w-6 h-6" }),
|
|
1171
1316
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1172
|
-
] }) }),
|
|
1317
|
+
] }) }), Ss = ({
|
|
1173
1318
|
capabilities: t = {},
|
|
1174
1319
|
className: s,
|
|
1175
1320
|
renderMessageInputActions: n,
|
|
1176
|
-
onChannelSelect:
|
|
1321
|
+
onChannelSelect: r,
|
|
1177
1322
|
onParticipantSelect: o,
|
|
1178
1323
|
initialParticipantFilter: a,
|
|
1179
|
-
initialParticipantData:
|
|
1180
|
-
CustomChannelEmptyState:
|
|
1324
|
+
initialParticipantData: l,
|
|
1325
|
+
CustomChannelEmptyState: c,
|
|
1181
1326
|
showChannelList: m = !0,
|
|
1182
|
-
filters:
|
|
1183
|
-
channelListCustomEmptyStateIndicator:
|
|
1327
|
+
filters: g,
|
|
1328
|
+
channelListCustomEmptyStateIndicator: E
|
|
1184
1329
|
}) => {
|
|
1185
1330
|
const {
|
|
1186
1331
|
service: h,
|
|
1187
1332
|
client: f,
|
|
1188
|
-
isConnected:
|
|
1189
|
-
isLoading:
|
|
1190
|
-
error:
|
|
1191
|
-
refreshConnection:
|
|
1192
|
-
debug:
|
|
1193
|
-
} =
|
|
1194
|
-
const
|
|
1333
|
+
isConnected: k,
|
|
1334
|
+
isLoading: b,
|
|
1335
|
+
error: w,
|
|
1336
|
+
refreshConnection: y,
|
|
1337
|
+
debug: N
|
|
1338
|
+
} = We(), [I, S] = v(null), [R, _] = v(!1), [d, u] = v(!1), [x, j] = v(/* @__PURE__ */ new Set()), [A, W] = v(0), [O, $] = v(!1), [Y, H] = v(null), V = z(null), { participantSource: J, participantLabel: D = "participants" } = t, T = Z.useMemo(() => {
|
|
1339
|
+
const C = f == null ? void 0 : f.userID;
|
|
1195
1340
|
return {
|
|
1196
1341
|
...{
|
|
1197
1342
|
type: "messaging",
|
|
1198
1343
|
last_message_at: { $exists: !0 },
|
|
1199
|
-
...
|
|
1200
|
-
members: { $in: [
|
|
1344
|
+
...C && {
|
|
1345
|
+
members: { $in: [C] },
|
|
1201
1346
|
hidden: !1
|
|
1202
1347
|
}
|
|
1203
1348
|
},
|
|
1204
|
-
...
|
|
1349
|
+
...g
|
|
1205
1350
|
};
|
|
1206
|
-
}, [
|
|
1207
|
-
if (!f || !
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1351
|
+
}, [g, f == null ? void 0 : f.userID]), P = z(null), L = F(async () => {
|
|
1352
|
+
if (!f || !k) return;
|
|
1353
|
+
const C = f.userID;
|
|
1354
|
+
if (C)
|
|
1210
1355
|
try {
|
|
1211
|
-
|
|
1356
|
+
N && console.log("[MessagingShell] Syncing channels for user:", C);
|
|
1212
1357
|
const U = await f.queryChannels(
|
|
1213
1358
|
{
|
|
1214
1359
|
type: "messaging",
|
|
1215
|
-
members: { $in: [
|
|
1360
|
+
members: { $in: [C] }
|
|
1216
1361
|
},
|
|
1217
1362
|
{},
|
|
1218
1363
|
{ limit: 100 }
|
|
1219
|
-
),
|
|
1220
|
-
U.forEach((
|
|
1221
|
-
const
|
|
1222
|
-
Object.values(
|
|
1364
|
+
), M = /* @__PURE__ */ new Set();
|
|
1365
|
+
U.forEach((B) => {
|
|
1366
|
+
const Ee = B.state.members;
|
|
1367
|
+
Object.values(Ee).forEach((ye) => {
|
|
1223
1368
|
var oe;
|
|
1224
|
-
const ne = (oe =
|
|
1225
|
-
ne && ne !==
|
|
1369
|
+
const ne = (oe = ye.user) == null ? void 0 : oe.id;
|
|
1370
|
+
ne && ne !== C && M.add(ne);
|
|
1226
1371
|
});
|
|
1227
|
-
}), j(
|
|
1372
|
+
}), j(M), _(U.length > 0), P.current = C, N && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1228
1373
|
channelCount: U.length,
|
|
1229
|
-
memberCount:
|
|
1374
|
+
memberCount: M.size
|
|
1230
1375
|
});
|
|
1231
1376
|
} catch (U) {
|
|
1232
1377
|
console.error("[MessagingShell] Failed to sync channels:", U);
|
|
1233
1378
|
}
|
|
1234
|
-
}, [f,
|
|
1235
|
-
|
|
1236
|
-
if (!f || !
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
}, [f,
|
|
1240
|
-
if (!a || !f || !
|
|
1379
|
+
}, [f, k, N]);
|
|
1380
|
+
G(() => {
|
|
1381
|
+
if (!f || !k) return;
|
|
1382
|
+
const C = f.userID;
|
|
1383
|
+
C && P.current !== C && L();
|
|
1384
|
+
}, [f, k, L]), G(() => {
|
|
1385
|
+
if (!a || !f || !k) return;
|
|
1241
1386
|
(async () => {
|
|
1242
1387
|
const U = f.userID;
|
|
1243
1388
|
if (U)
|
|
1244
1389
|
try {
|
|
1245
|
-
|
|
1390
|
+
N && console.log(
|
|
1246
1391
|
"[MessagingShell] Loading initial conversation with:",
|
|
1247
1392
|
a
|
|
1248
1393
|
);
|
|
1249
|
-
const
|
|
1394
|
+
const M = await f.queryChannels(
|
|
1250
1395
|
{
|
|
1251
1396
|
type: "messaging",
|
|
1252
1397
|
members: { $eq: [U, a] }
|
|
@@ -1254,139 +1399,139 @@ const us = ({
|
|
|
1254
1399
|
{},
|
|
1255
1400
|
{ limit: 1 }
|
|
1256
1401
|
);
|
|
1257
|
-
if (
|
|
1258
|
-
S(
|
|
1402
|
+
if (M.length > 0)
|
|
1403
|
+
S(M[0]), $(!0), H(null), r && r(M[0]), N && console.log(
|
|
1259
1404
|
"[MessagingShell] Initial conversation loaded:",
|
|
1260
|
-
|
|
1405
|
+
M[0].id
|
|
1261
1406
|
);
|
|
1262
|
-
else if (
|
|
1263
|
-
|
|
1407
|
+
else if (l && h) {
|
|
1408
|
+
N && console.log(
|
|
1264
1409
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1265
|
-
|
|
1410
|
+
l
|
|
1266
1411
|
);
|
|
1267
1412
|
try {
|
|
1268
|
-
const
|
|
1269
|
-
id:
|
|
1270
|
-
name:
|
|
1271
|
-
email:
|
|
1272
|
-
phone:
|
|
1413
|
+
const B = await h.startChannelWithParticipant({
|
|
1414
|
+
id: l.id,
|
|
1415
|
+
name: l.name,
|
|
1416
|
+
email: l.email,
|
|
1417
|
+
phone: l.phone
|
|
1273
1418
|
});
|
|
1274
|
-
S(
|
|
1419
|
+
S(B), $(!0), H(null), r && r(B), N && console.log(
|
|
1275
1420
|
"[MessagingShell] Channel created and loaded:",
|
|
1276
|
-
|
|
1421
|
+
B.id
|
|
1277
1422
|
);
|
|
1278
|
-
} catch (
|
|
1423
|
+
} catch (B) {
|
|
1279
1424
|
console.error(
|
|
1280
1425
|
"[MessagingShell] Failed to create conversation:",
|
|
1281
|
-
|
|
1282
|
-
),
|
|
1426
|
+
B
|
|
1427
|
+
), H("Failed to create conversation");
|
|
1283
1428
|
}
|
|
1284
1429
|
} else
|
|
1285
|
-
|
|
1430
|
+
H(
|
|
1286
1431
|
"No conversation found with this account"
|
|
1287
|
-
),
|
|
1432
|
+
), N && console.log(
|
|
1288
1433
|
"[MessagingShell] No conversation found for:",
|
|
1289
1434
|
a
|
|
1290
1435
|
);
|
|
1291
|
-
} catch (
|
|
1436
|
+
} catch (M) {
|
|
1292
1437
|
console.error(
|
|
1293
1438
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1294
|
-
|
|
1295
|
-
),
|
|
1439
|
+
M
|
|
1440
|
+
), H("Failed to load conversation");
|
|
1296
1441
|
}
|
|
1297
1442
|
})();
|
|
1298
1443
|
}, [
|
|
1299
1444
|
a,
|
|
1300
|
-
|
|
1445
|
+
l,
|
|
1301
1446
|
f,
|
|
1302
|
-
|
|
1447
|
+
k,
|
|
1303
1448
|
h,
|
|
1304
|
-
|
|
1305
|
-
|
|
1449
|
+
N,
|
|
1450
|
+
r
|
|
1306
1451
|
]);
|
|
1307
|
-
const
|
|
1308
|
-
(
|
|
1309
|
-
S(
|
|
1452
|
+
const Q = F(
|
|
1453
|
+
(C) => {
|
|
1454
|
+
S(C), r == null || r(C);
|
|
1310
1455
|
},
|
|
1311
|
-
[
|
|
1312
|
-
),
|
|
1456
|
+
[r]
|
|
1457
|
+
), Ne = F(() => {
|
|
1313
1458
|
O || S(null);
|
|
1314
|
-
}, [O]),
|
|
1315
|
-
async (
|
|
1459
|
+
}, [O]), be = F(
|
|
1460
|
+
async (C) => {
|
|
1316
1461
|
var U;
|
|
1317
1462
|
if (h)
|
|
1318
1463
|
try {
|
|
1319
|
-
|
|
1464
|
+
N && console.log(
|
|
1320
1465
|
"[MessagingShell] Starting conversation with:",
|
|
1321
|
-
|
|
1466
|
+
C.id
|
|
1322
1467
|
);
|
|
1323
|
-
const
|
|
1324
|
-
id:
|
|
1325
|
-
name:
|
|
1326
|
-
email:
|
|
1327
|
-
phone:
|
|
1468
|
+
const M = await h.startChannelWithParticipant({
|
|
1469
|
+
id: C.id,
|
|
1470
|
+
name: C.name,
|
|
1471
|
+
email: C.email,
|
|
1472
|
+
phone: C.phone
|
|
1328
1473
|
});
|
|
1329
1474
|
try {
|
|
1330
|
-
await
|
|
1331
|
-
} catch (
|
|
1332
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1475
|
+
await M.show();
|
|
1476
|
+
} catch (B) {
|
|
1477
|
+
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1333
1478
|
}
|
|
1334
|
-
S(
|
|
1335
|
-
} catch (
|
|
1336
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1479
|
+
S(M), u(!1), (U = V.current) == null || U.close(), o == null || o(C);
|
|
1480
|
+
} catch (M) {
|
|
1481
|
+
console.error("[MessagingShell] Failed to start conversation:", M);
|
|
1337
1482
|
}
|
|
1338
1483
|
},
|
|
1339
|
-
[h, o,
|
|
1340
|
-
), te =
|
|
1341
|
-
var
|
|
1342
|
-
u(!1), (
|
|
1343
|
-
}, []),
|
|
1344
|
-
async (
|
|
1345
|
-
|
|
1484
|
+
[h, o, N]
|
|
1485
|
+
), te = F(() => {
|
|
1486
|
+
var C;
|
|
1487
|
+
u(!1), (C = V.current) == null || C.close();
|
|
1488
|
+
}, []), ve = F(
|
|
1489
|
+
async (C) => {
|
|
1490
|
+
N && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), $(!1), P.current = null, await L();
|
|
1346
1491
|
},
|
|
1347
|
-
[L,
|
|
1348
|
-
),
|
|
1349
|
-
async (
|
|
1350
|
-
|
|
1492
|
+
[L, N]
|
|
1493
|
+
), we = F(
|
|
1494
|
+
async (C) => {
|
|
1495
|
+
N && console.log("[MessagingShell] Blocking participant:", C), S(null), $(!1), P.current = null, await L();
|
|
1351
1496
|
},
|
|
1352
|
-
[L,
|
|
1353
|
-
),
|
|
1354
|
-
return
|
|
1497
|
+
[L, N]
|
|
1498
|
+
), X = !!I;
|
|
1499
|
+
return b ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(gs, {}) }) : w ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: w, onBack: y }) }) : !k || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
|
|
1355
1500
|
re,
|
|
1356
1501
|
{
|
|
1357
1502
|
message: "Not connected to messaging service",
|
|
1358
|
-
onBack:
|
|
1503
|
+
onBack: y
|
|
1359
1504
|
}
|
|
1360
|
-
) }) :
|
|
1505
|
+
) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ i(
|
|
1361
1506
|
"div",
|
|
1362
1507
|
{
|
|
1363
|
-
className:
|
|
1364
|
-
"messaging-shell h-full bg-
|
|
1508
|
+
className: p(
|
|
1509
|
+
"messaging-shell h-full bg-background-secondary overflow-hidden",
|
|
1365
1510
|
s
|
|
1366
1511
|
),
|
|
1367
1512
|
children: [
|
|
1368
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1369
1514
|
/* @__PURE__ */ e(
|
|
1370
1515
|
"div",
|
|
1371
1516
|
{
|
|
1372
|
-
className:
|
|
1373
|
-
"messaging-channel-list-sidebar min-h-0 min-w-0
|
|
1517
|
+
className: p(
|
|
1518
|
+
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1374
1519
|
{
|
|
1375
1520
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1376
1521
|
"!hidden": m === !1 || O,
|
|
1377
1522
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1378
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O &&
|
|
1523
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O && X,
|
|
1379
1524
|
// Normal mode: show when no channel selected
|
|
1380
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !
|
|
1525
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !X
|
|
1381
1526
|
}
|
|
1382
1527
|
),
|
|
1383
1528
|
children: /* @__PURE__ */ e(
|
|
1384
|
-
|
|
1529
|
+
Xe,
|
|
1385
1530
|
{
|
|
1386
|
-
onChannelSelect:
|
|
1531
|
+
onChannelSelect: Q,
|
|
1387
1532
|
selectedChannel: I || void 0,
|
|
1388
|
-
filters:
|
|
1389
|
-
customEmptyStateIndicator:
|
|
1533
|
+
filters: T,
|
|
1534
|
+
customEmptyStateIndicator: E
|
|
1390
1535
|
}
|
|
1391
1536
|
)
|
|
1392
1537
|
}
|
|
@@ -1394,50 +1539,50 @@ const us = ({
|
|
|
1394
1539
|
/* @__PURE__ */ e(
|
|
1395
1540
|
"div",
|
|
1396
1541
|
{
|
|
1397
|
-
className:
|
|
1542
|
+
className: p(
|
|
1398
1543
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1399
1544
|
{
|
|
1400
1545
|
// In direct conversation mode, always show (full width)
|
|
1401
|
-
flex: O ||
|
|
1546
|
+
flex: O || X,
|
|
1402
1547
|
// Normal mode: hide on mobile when no channel selected
|
|
1403
|
-
"hidden lg:flex": !O && !
|
|
1548
|
+
"hidden lg:flex": !O && !X
|
|
1404
1549
|
}
|
|
1405
1550
|
),
|
|
1406
1551
|
children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1407
1552
|
cs,
|
|
1408
1553
|
{
|
|
1409
1554
|
channel: I,
|
|
1410
|
-
onBack:
|
|
1555
|
+
onBack: Ne,
|
|
1411
1556
|
showBackButton: !O,
|
|
1412
1557
|
renderMessageInputActions: n,
|
|
1413
|
-
onLeaveConversation:
|
|
1414
|
-
onBlockParticipant:
|
|
1415
|
-
CustomChannelEmptyState:
|
|
1558
|
+
onLeaveConversation: ve,
|
|
1559
|
+
onBlockParticipant: we,
|
|
1560
|
+
CustomChannelEmptyState: c
|
|
1416
1561
|
},
|
|
1417
1562
|
I.id
|
|
1418
|
-
) }) : /* @__PURE__ */ e(
|
|
1563
|
+
) }) : /* @__PURE__ */ e(hs, { hasChannels: R })
|
|
1419
1564
|
}
|
|
1420
1565
|
)
|
|
1421
1566
|
] }),
|
|
1422
|
-
|
|
1567
|
+
J && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1423
1568
|
/* @__PURE__ */ e(
|
|
1424
1569
|
"dialog",
|
|
1425
1570
|
{
|
|
1426
1571
|
ref: V,
|
|
1427
1572
|
className: "mes-dialog",
|
|
1428
|
-
onClick: (
|
|
1429
|
-
|
|
1573
|
+
onClick: (C) => {
|
|
1574
|
+
C.target === V.current && te();
|
|
1430
1575
|
},
|
|
1431
1576
|
onClose: te,
|
|
1432
1577
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1433
1578
|
us,
|
|
1434
1579
|
{
|
|
1435
|
-
participantSource:
|
|
1436
|
-
onSelectParticipant:
|
|
1580
|
+
participantSource: J,
|
|
1581
|
+
onSelectParticipant: be,
|
|
1437
1582
|
onClose: te,
|
|
1438
|
-
existingParticipantIds:
|
|
1439
|
-
participantLabel:
|
|
1440
|
-
searchPlaceholder: `Search ${
|
|
1583
|
+
existingParticipantIds: x,
|
|
1584
|
+
participantLabel: D,
|
|
1585
|
+
searchPlaceholder: `Search ${D}...`
|
|
1441
1586
|
},
|
|
1442
1587
|
A
|
|
1443
1588
|
) })
|
|
@@ -1446,11 +1591,11 @@ const us = ({
|
|
|
1446
1591
|
]
|
|
1447
1592
|
}
|
|
1448
1593
|
);
|
|
1449
|
-
},
|
|
1594
|
+
}, xs = ({
|
|
1450
1595
|
question: t,
|
|
1451
1596
|
onClick: s,
|
|
1452
1597
|
loading: n = !1,
|
|
1453
|
-
className:
|
|
1598
|
+
className: r
|
|
1454
1599
|
}) => /* @__PURE__ */ e(
|
|
1455
1600
|
"button",
|
|
1456
1601
|
{
|
|
@@ -1458,46 +1603,46 @@ const us = ({
|
|
|
1458
1603
|
onClick: s,
|
|
1459
1604
|
disabled: n,
|
|
1460
1605
|
style: { backgroundColor: "#E6E5E3" },
|
|
1461
|
-
className:
|
|
1606
|
+
className: p(
|
|
1462
1607
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1463
1608
|
{
|
|
1464
1609
|
"hover:brightness-95 active:brightness-90": !n,
|
|
1465
1610
|
"opacity-50 cursor-not-allowed": n
|
|
1466
1611
|
},
|
|
1467
|
-
|
|
1612
|
+
r
|
|
1468
1613
|
),
|
|
1469
1614
|
children: t
|
|
1470
1615
|
}
|
|
1471
|
-
),
|
|
1616
|
+
), ks = ({
|
|
1472
1617
|
faqs: t,
|
|
1473
1618
|
onFaqClick: s,
|
|
1474
1619
|
loadingFaqId: n,
|
|
1475
|
-
headerText:
|
|
1620
|
+
headerText: r,
|
|
1476
1621
|
className: o,
|
|
1477
1622
|
avatarImage: a,
|
|
1478
|
-
avatarName:
|
|
1623
|
+
avatarName: l
|
|
1479
1624
|
}) => {
|
|
1480
|
-
const
|
|
1481
|
-
return
|
|
1482
|
-
(a ||
|
|
1483
|
-
|
|
1625
|
+
const c = t.filter((m) => m.enabled).sort((m, g) => (m.order ?? 0) - (g.order ?? 0));
|
|
1626
|
+
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1627
|
+
(a || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1628
|
+
q,
|
|
1484
1629
|
{
|
|
1485
|
-
id:
|
|
1486
|
-
name:
|
|
1630
|
+
id: l || "account",
|
|
1631
|
+
name: l || "Account",
|
|
1487
1632
|
image: a,
|
|
1488
1633
|
size: 24,
|
|
1489
1634
|
shape: "circle"
|
|
1490
1635
|
}
|
|
1491
1636
|
) }),
|
|
1492
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ i(
|
|
1493
1638
|
"div",
|
|
1494
1639
|
{
|
|
1495
1640
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1496
1641
|
style: { backgroundColor: "#F1F0EE" },
|
|
1497
1642
|
children: [
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1643
|
+
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1644
|
+
c.map((m) => /* @__PURE__ */ e(
|
|
1645
|
+
xs,
|
|
1501
1646
|
{
|
|
1502
1647
|
question: m.question,
|
|
1503
1648
|
onClick: () => s(m.id),
|
|
@@ -1509,59 +1654,59 @@ const us = ({
|
|
|
1509
1654
|
}
|
|
1510
1655
|
)
|
|
1511
1656
|
] }) });
|
|
1512
|
-
},
|
|
1513
|
-
const { initialSearch: n = "", pageSize:
|
|
1514
|
-
if (
|
|
1515
|
-
const d =
|
|
1516
|
-
|
|
1657
|
+
}, ps = (t, s = {}) => {
|
|
1658
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, a] = v([]), [l, c] = v(!1), [m, g] = v(null), [E, h] = v(n), [f, k] = v(!0), [b, w] = v(), y = F(async (R = !1, _) => {
|
|
1659
|
+
if (l) return;
|
|
1660
|
+
const d = _ !== void 0 ? _ : E;
|
|
1661
|
+
c(!0), g(null);
|
|
1517
1662
|
try {
|
|
1518
1663
|
const u = await t.loadParticipants({
|
|
1519
1664
|
search: d || void 0,
|
|
1520
|
-
limit:
|
|
1521
|
-
cursor:
|
|
1665
|
+
limit: r,
|
|
1666
|
+
cursor: R ? void 0 : b
|
|
1522
1667
|
});
|
|
1523
1668
|
a(
|
|
1524
|
-
(
|
|
1525
|
-
),
|
|
1669
|
+
(x) => R ? u.participants : [...x, ...u.participants]
|
|
1670
|
+
), k(u.hasMore), w(u.nextCursor);
|
|
1526
1671
|
} catch (u) {
|
|
1527
|
-
const
|
|
1528
|
-
x
|
|
1672
|
+
const x = u instanceof Error ? u.message : "Failed to load participants";
|
|
1673
|
+
g(x), console.error("[useParticipants] Load error:", u);
|
|
1529
1674
|
} finally {
|
|
1530
|
-
|
|
1675
|
+
c(!1);
|
|
1531
1676
|
}
|
|
1532
|
-
}, [t,
|
|
1533
|
-
f && !
|
|
1534
|
-
}, [f,
|
|
1535
|
-
h(
|
|
1536
|
-
}, [
|
|
1537
|
-
|
|
1538
|
-
}, [
|
|
1539
|
-
return
|
|
1540
|
-
|
|
1677
|
+
}, [t, E, b, r, l]), N = F(() => {
|
|
1678
|
+
f && !l && y(!1);
|
|
1679
|
+
}, [f, l, y]), I = F((R) => {
|
|
1680
|
+
h(R), w(void 0), y(!0, R);
|
|
1681
|
+
}, [y]), S = F(() => {
|
|
1682
|
+
w(void 0), y(!0);
|
|
1683
|
+
}, [y]);
|
|
1684
|
+
return G(() => {
|
|
1685
|
+
y(!0);
|
|
1541
1686
|
}, [t.loadParticipants]), {
|
|
1542
1687
|
participants: o,
|
|
1543
|
-
loading:
|
|
1688
|
+
loading: l,
|
|
1544
1689
|
error: m,
|
|
1545
|
-
searchQuery:
|
|
1690
|
+
searchQuery: E,
|
|
1546
1691
|
hasMore: f,
|
|
1547
1692
|
totalCount: t.totalCount,
|
|
1548
|
-
loadMore:
|
|
1693
|
+
loadMore: N,
|
|
1549
1694
|
search: I,
|
|
1550
1695
|
refresh: S
|
|
1551
1696
|
};
|
|
1552
1697
|
};
|
|
1553
1698
|
export {
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1699
|
+
q as Avatar,
|
|
1700
|
+
ls as ChannelEmptyState,
|
|
1701
|
+
Xe as ChannelList,
|
|
1557
1702
|
cs as ChannelView,
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1703
|
+
ks as FaqList,
|
|
1704
|
+
xs as FaqListItem,
|
|
1705
|
+
Is as MessagingProvider,
|
|
1706
|
+
Ss as MessagingShell,
|
|
1562
1707
|
us as ParticipantPicker,
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1708
|
+
qe as formatRelativeTime,
|
|
1709
|
+
We as useMessaging,
|
|
1710
|
+
ps as useParticipants
|
|
1566
1711
|
};
|
|
1567
1712
|
//# sourceMappingURL=index.js.map
|