@linktr.ee/messaging-react 1.11.3 → 1.11.5-rc-1765005296
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.d.ts +2 -2
- package/dist/index.js +690 -676
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/CustomChannelPreview.tsx +109 -106
- package/src/components/ChannelList/index.tsx +55 -66
- package/src/components/ChannelView.tsx +37 -41
- package/src/components/MessagingShell/ChannelEmptyState.tsx +1 -12
- package/src/components/MessagingShell/EmptyState.tsx +4 -4
- package/src/components/MessagingShell/ErrorState.tsx +8 -5
- package/src/components/MessagingShell/LoadingState.tsx +5 -2
- package/src/components/MessagingShell/index.tsx +20 -6
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as fe } from "react/jsx-runtime";
|
|
2
2
|
import p from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
3
|
+
import L, { createContext as De, useContext as Me, useCallback as M, useState as v, useRef as $, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as Fe } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Pe, ChannelList as Te, useMessageComposer as Le, useStateStore as Ue, MessageInput as Oe, useMessageInputContext as je, useMessageComposerHasSendableData as Be, SimpleAttachmentSelector as Ae, QuotedMessagePreview as ze, AttachmentPreviewList as $e, TextareaComposer as Ge, MessageTimestamp as He, Channel as Ve, useChannelStateContext as ge, Window as We, MessageList as Ze } from "stream-chat-react";
|
|
6
|
+
import { XIcon as ae, ArrowUpIcon as qe, ArrowLeftIcon as ie, DotsThreeIcon as ce, SpinnerGapIcon as se, SignOutIcon as Ye, ProhibitInsetIcon as de, FlagIcon as Je, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as ue } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as me } from "stream-chat";
|
|
8
|
+
const xe = De({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,228 +15,228 @@ const ge = Se({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), ne = () => Me(xe), ks = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
22
|
+
apiKey: r,
|
|
23
23
|
capabilities: a = {},
|
|
24
|
-
debug:
|
|
24
|
+
debug: o = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
(u, ...
|
|
28
|
-
|
|
26
|
+
const l = M(
|
|
27
|
+
(u, ...x) => {
|
|
28
|
+
o && console.log(`🔥 [MessagingProvider] ${u}`, ...x);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[o]
|
|
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(a)
|
|
37
37
|
});
|
|
38
|
-
const [c, m] =
|
|
38
|
+
const [c, m] = v(null), [g, y] = v(null), [h, f] = v(!1), [S, b] = v(!1), [w, E] = v(null), N = $(!1), I = $({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
|
-
apiKey:
|
|
40
|
+
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: a
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
46
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
43
|
+
}), k = $(0);
|
|
44
|
+
k.current++, l("📊 RENDER INFO", {
|
|
45
|
+
renderCount: k.current,
|
|
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 !== a
|
|
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: a
|
|
58
58
|
}, G(() => {
|
|
59
|
-
const u =
|
|
60
|
-
if (
|
|
59
|
+
const u = k.current;
|
|
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 Fe({
|
|
83
83
|
...n,
|
|
84
|
-
apiKey:
|
|
85
|
-
debug:
|
|
84
|
+
apiKey: r,
|
|
85
|
+
debug: o
|
|
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 R =
|
|
96
|
+
}, [r, n, o, l]);
|
|
97
|
+
const R = $(null);
|
|
98
98
|
G(() => {
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
99
|
+
var x, A;
|
|
100
|
+
if (l("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
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
106
|
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !c || !s) {
|
|
108
|
-
|
|
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 && ((A = R.current) == null ? void 0 : A.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), E(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
125
|
+
l("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const z = await c.connectUser(s);
|
|
127
|
+
y(z), f(!0), R.current = { serviceId: c, userId: s.id }, l("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: z.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
|
|
131
|
+
} catch (z) {
|
|
132
|
+
const Z = z instanceof Error ? z.message : "Connection failed";
|
|
133
|
+
E(Z), l("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: Z
|
|
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
|
-
}, [c, s,
|
|
144
|
+
}, [c, s, l, h]), G(() => (l("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!c,
|
|
146
146
|
isConnected: h
|
|
147
147
|
}), () => {
|
|
148
|
-
c && h ? (
|
|
148
|
+
c && h ? (l(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
), R.current = null, c.disconnectUser().catch(console.error)) :
|
|
151
|
+
), R.current = null, c.disconnectUser().catch(console.error)) : l("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!c,
|
|
153
153
|
isConnected: h
|
|
154
154
|
});
|
|
155
|
-
}), [c, h,
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
155
|
+
}), [c, h, l]);
|
|
156
|
+
const F = M(async () => {
|
|
157
|
+
if (l("🔄 REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!c,
|
|
159
159
|
hasUser: !!s
|
|
160
160
|
}), !c || !s) {
|
|
161
|
-
|
|
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
|
-
|
|
166
|
+
l("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), l("📞 RECONNECTING FOR REFRESH");
|
|
167
167
|
const u = await c.connectUser(s);
|
|
168
|
-
|
|
168
|
+
y(u), f(!0), E(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
|
+
E(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
|
-
}, [c, s,
|
|
178
|
+
}, [c, s, l]), d = L.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!c,
|
|
180
|
-
hasClient: !!
|
|
180
|
+
hasClient: !!g,
|
|
181
181
|
isConnected: h,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
182
|
+
isLoading: S,
|
|
183
|
+
hasError: !!w,
|
|
184
184
|
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
186
|
service: c,
|
|
187
|
-
client:
|
|
187
|
+
client: g,
|
|
188
188
|
isConnected: h,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
189
|
+
isLoading: S,
|
|
190
|
+
error: w,
|
|
191
191
|
capabilities: a,
|
|
192
|
-
refreshConnection:
|
|
193
|
-
debug:
|
|
192
|
+
refreshConnection: F,
|
|
193
|
+
debug: o
|
|
194
194
|
}), [
|
|
195
195
|
c,
|
|
196
|
-
|
|
196
|
+
g,
|
|
197
197
|
h,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
S,
|
|
199
|
+
w,
|
|
200
200
|
a,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
F,
|
|
202
|
+
o,
|
|
203
|
+
l
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
205
|
+
return l("🔄 RENDER END", {
|
|
206
|
+
renderCount: k.current,
|
|
207
|
+
willRenderChat: !!(g && h),
|
|
208
208
|
contextValueReady: !!d
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
209
|
+
}), /* @__PURE__ */ e(xe.Provider, { value: d, children: g && h ? /* @__PURE__ */ e(
|
|
210
|
+
Pe,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: g,
|
|
213
213
|
customClasses: {
|
|
214
214
|
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
215
|
},
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Xe = () => ne(), Ke = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
222
|
), a = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
225
|
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
226
|
+
}, es = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const
|
|
231
|
-
return
|
|
230
|
+
const r = Ke(t, s);
|
|
231
|
+
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit"
|
|
234
|
-
}) :
|
|
234
|
+
}) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
|
|
235
235
|
month: "numeric",
|
|
236
236
|
day: "numeric",
|
|
237
237
|
year: "2-digit"
|
|
238
238
|
});
|
|
239
|
-
},
|
|
239
|
+
}, he = [
|
|
240
240
|
"🍎",
|
|
241
241
|
// Apple
|
|
242
242
|
"🍌",
|
|
@@ -264,33 +264,33 @@ const ge = Se({
|
|
|
264
264
|
"🍈"
|
|
265
265
|
// Melon
|
|
266
266
|
];
|
|
267
|
-
function
|
|
267
|
+
function ss(t) {
|
|
268
268
|
let s = 0;
|
|
269
269
|
for (let n = 0; n < t.length; n++) {
|
|
270
|
-
const
|
|
271
|
-
s = (s << 5) - s +
|
|
270
|
+
const r = t.charCodeAt(n);
|
|
271
|
+
s = (s << 5) - s + r, s = s & s;
|
|
272
272
|
}
|
|
273
273
|
return Math.abs(s);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
const n =
|
|
277
|
-
return
|
|
275
|
+
function ts(t) {
|
|
276
|
+
const n = ss(t) % he.length;
|
|
277
|
+
return he[n];
|
|
278
278
|
}
|
|
279
279
|
const q = ({
|
|
280
280
|
id: t,
|
|
281
281
|
image: s,
|
|
282
282
|
size: n = 40,
|
|
283
|
-
className:
|
|
283
|
+
className: r,
|
|
284
284
|
shape: a = "squircle"
|
|
285
285
|
}) => {
|
|
286
|
-
const
|
|
286
|
+
const o = ts(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = a === "circle" ? { borderRadius: "50%" } : {
|
|
287
287
|
borderRadius: "33%",
|
|
288
288
|
"corner-shape": "superellipse(1.3)"
|
|
289
289
|
};
|
|
290
290
|
return /* @__PURE__ */ e(
|
|
291
291
|
"div",
|
|
292
292
|
{
|
|
293
|
-
className: p("flex-shrink-0 overflow-hidden",
|
|
293
|
+
className: p("flex-shrink-0 overflow-hidden", r),
|
|
294
294
|
style: {
|
|
295
295
|
width: `${n}px`,
|
|
296
296
|
height: `${n}px`,
|
|
@@ -311,134 +311,134 @@ const q = ({
|
|
|
311
311
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
312
312
|
c
|
|
313
313
|
),
|
|
314
|
-
children:
|
|
314
|
+
children: o
|
|
315
315
|
}
|
|
316
316
|
)
|
|
317
317
|
}
|
|
318
318
|
);
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
"bg-primary-alt/10 border-l-4 border-l-primary": i,
|
|
349
|
-
"hover:bg-sand": !i
|
|
350
|
-
}
|
|
351
|
-
),
|
|
352
|
-
children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
|
|
353
|
-
/* @__PURE__ */ e(
|
|
354
|
-
q,
|
|
319
|
+
}, Ce = L.memo(
|
|
320
|
+
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
321
|
+
var E, N, I, k, R, F;
|
|
322
|
+
const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
323
|
+
t && n(t);
|
|
324
|
+
}, m = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
|
|
325
|
+
(d) => {
|
|
326
|
+
var u, x;
|
|
327
|
+
return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
|
|
328
|
+
}
|
|
329
|
+
), g = ((N = m == null ? void 0 : m.user) == null ? void 0 : N.name) || "Conversation", y = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : R[t.state.messages.length - 1], S = (() => {
|
|
330
|
+
var u;
|
|
331
|
+
if (h != null && h.text) return h.text;
|
|
332
|
+
const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
|
|
333
|
+
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";
|
|
334
|
+
})(), b = h != null && h.created_at ? es(new Date(h.created_at)) : "", w = a ?? 0;
|
|
335
|
+
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
336
|
+
channelId: t == null ? void 0 : t.id,
|
|
337
|
+
isSelected: o,
|
|
338
|
+
participantName: g,
|
|
339
|
+
unreadCount: w,
|
|
340
|
+
hasTimestamp: !!b
|
|
341
|
+
}), /* @__PURE__ */ e(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
type: "button",
|
|
345
|
+
onClick: l,
|
|
346
|
+
className: p(
|
|
347
|
+
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
355
348
|
{
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
image: k,
|
|
359
|
-
size: 44,
|
|
360
|
-
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
349
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": o,
|
|
350
|
+
"hover:bg-sand": !o
|
|
361
351
|
}
|
|
362
352
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
353
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
354
|
+
/* @__PURE__ */ e(
|
|
355
|
+
q,
|
|
356
|
+
{
|
|
357
|
+
id: ((F = m == null ? void 0 : m.user) == null ? void 0 : F.id) || t.id || "unknown",
|
|
358
|
+
name: g,
|
|
359
|
+
image: y,
|
|
360
|
+
size: 44,
|
|
361
|
+
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
365
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
366
|
+
/* @__PURE__ */ e(
|
|
367
|
+
"h3",
|
|
368
|
+
{
|
|
369
|
+
className: p(
|
|
370
|
+
"text-sm font-medium truncate",
|
|
371
|
+
o ? "text-primary" : "text-charcoal"
|
|
372
|
+
),
|
|
373
|
+
children: g
|
|
374
|
+
}
|
|
375
|
+
),
|
|
376
|
+
b && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: b })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
379
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
|
|
380
|
+
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 })
|
|
381
|
+
] })
|
|
380
382
|
] })
|
|
381
383
|
] })
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
debug: r
|
|
428
|
-
}
|
|
429
|
-
);
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
Ce.displayName = "CustomChannelPreview";
|
|
389
|
+
const Ne = L.memo(
|
|
390
|
+
({
|
|
391
|
+
onChannelSelect: t,
|
|
392
|
+
selectedChannel: s,
|
|
393
|
+
filters: n,
|
|
394
|
+
className: r,
|
|
395
|
+
customEmptyStateIndicator: a
|
|
396
|
+
}) => {
|
|
397
|
+
const o = L.useRef(0);
|
|
398
|
+
o.current++;
|
|
399
|
+
const { debug: l = !1 } = ne();
|
|
400
|
+
l && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
401
|
+
renderCount: o.current,
|
|
402
|
+
selectedChannelId: s == null ? void 0 : s.id,
|
|
403
|
+
filters: n
|
|
404
|
+
});
|
|
405
|
+
const c = L.useMemo(() => (g) => /* @__PURE__ */ e(
|
|
406
|
+
Ce,
|
|
407
|
+
{
|
|
408
|
+
...g,
|
|
409
|
+
selectedChannel: s,
|
|
410
|
+
onChannelSelect: t,
|
|
411
|
+
debug: l
|
|
412
|
+
}
|
|
413
|
+
), [s, t, l]);
|
|
414
|
+
return /* @__PURE__ */ e(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: p(
|
|
418
|
+
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
419
|
+
r
|
|
420
|
+
),
|
|
421
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
422
|
+
Te,
|
|
423
|
+
{
|
|
424
|
+
filters: n,
|
|
425
|
+
sort: { last_message_at: -1 },
|
|
426
|
+
options: { limit: 30 },
|
|
427
|
+
Preview: c,
|
|
428
|
+
EmptyStateIndicator: a
|
|
430
429
|
},
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
JSON.stringify(n)
|
|
431
|
+
) })
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
Ne.displayName = "ChannelList";
|
|
437
|
+
const ee = ({
|
|
438
438
|
variant: t = "default",
|
|
439
439
|
className: s,
|
|
440
440
|
children: n,
|
|
441
|
-
...
|
|
441
|
+
...r
|
|
442
442
|
}) => /* @__PURE__ */ e(
|
|
443
443
|
"button",
|
|
444
444
|
{
|
|
@@ -448,24 +448,24 @@ const q = ({
|
|
|
448
448
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
449
449
|
s
|
|
450
450
|
),
|
|
451
|
-
...
|
|
451
|
+
...r,
|
|
452
452
|
children: n
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
|
-
function
|
|
456
|
-
return /* @__PURE__ */
|
|
455
|
+
function be({ label: t, className: s, children: n, ...r }) {
|
|
456
|
+
return /* @__PURE__ */ i(
|
|
457
457
|
"button",
|
|
458
458
|
{
|
|
459
459
|
type: "button",
|
|
460
460
|
className: p(
|
|
461
461
|
"rounded-full p-2 transition-colors focus-ring",
|
|
462
462
|
{
|
|
463
|
-
"cursor-not-allowed opacity-50":
|
|
464
|
-
"hover:bg-sand": !
|
|
463
|
+
"cursor-not-allowed opacity-50": r.disabled,
|
|
464
|
+
"hover:bg-sand": !r.disabled
|
|
465
465
|
},
|
|
466
466
|
s
|
|
467
467
|
),
|
|
468
|
-
...
|
|
468
|
+
...r,
|
|
469
469
|
children: [
|
|
470
470
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
471
471
|
n
|
|
@@ -473,19 +473,19 @@ function xe({ label: t, className: s, children: n, ...l }) {
|
|
|
473
473
|
}
|
|
474
474
|
);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */ e(
|
|
476
|
+
function ve({ onClick: t }) {
|
|
477
|
+
return /* @__PURE__ */ e(be, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ae, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
478
478
|
}
|
|
479
|
-
const
|
|
479
|
+
const ns = (t) => ({
|
|
480
480
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
481
|
-
(s) =>
|
|
481
|
+
(s) => me.previewIsLoaded(s) || me.previewIsLoading(s)
|
|
482
482
|
)
|
|
483
|
-
}),
|
|
483
|
+
}), rs = ({
|
|
484
484
|
link: t,
|
|
485
485
|
onDismiss: s
|
|
486
486
|
}) => {
|
|
487
|
-
const { og_scrape_url: n, title:
|
|
488
|
-
return /* @__PURE__ */
|
|
487
|
+
const { og_scrape_url: n, title: r, image_url: a } = t;
|
|
488
|
+
return /* @__PURE__ */ i(
|
|
489
489
|
"a",
|
|
490
490
|
{
|
|
491
491
|
href: n,
|
|
@@ -497,7 +497,7 @@ const es = (t) => ({
|
|
|
497
497
|
"img",
|
|
498
498
|
{
|
|
499
499
|
src: a,
|
|
500
|
-
alt:
|
|
500
|
+
alt: r || "",
|
|
501
501
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
502
502
|
}
|
|
503
503
|
),
|
|
@@ -505,47 +505,47 @@ const es = (t) => ({
|
|
|
505
505
|
"button",
|
|
506
506
|
{
|
|
507
507
|
type: "button",
|
|
508
|
-
onClick: (
|
|
509
|
-
|
|
508
|
+
onClick: (l) => {
|
|
509
|
+
l.preventDefault(), s(n);
|
|
510
510
|
},
|
|
511
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",
|
|
512
512
|
"aria-label": "Close link preview",
|
|
513
|
-
children: /* @__PURE__ */ e(
|
|
513
|
+
children: /* @__PURE__ */ e(ae, { className: "size-4 text-black/90" })
|
|
514
514
|
}
|
|
515
515
|
),
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
|
|
516
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
517
|
+
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
518
518
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
519
519
|
] })
|
|
520
520
|
]
|
|
521
521
|
}
|
|
522
522
|
);
|
|
523
|
-
},
|
|
524
|
-
const { linkPreviewsManager: t } =
|
|
523
|
+
}, ls = () => {
|
|
524
|
+
const { linkPreviewsManager: t } = Le(), { linkPreviews: s } = Ue(
|
|
525
525
|
t.state,
|
|
526
|
-
|
|
526
|
+
ns
|
|
527
527
|
), n = (a) => {
|
|
528
528
|
t.dismissPreview(a);
|
|
529
529
|
};
|
|
530
530
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
|
|
531
|
-
|
|
531
|
+
rs,
|
|
532
532
|
{
|
|
533
533
|
link: a,
|
|
534
534
|
onDismiss: n
|
|
535
535
|
},
|
|
536
536
|
a.og_scrape_url
|
|
537
537
|
)) }) : null;
|
|
538
|
-
},
|
|
539
|
-
const { handleSubmit: t } =
|
|
540
|
-
return /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */ e(
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
-
/* @__PURE__ */ e(
|
|
546
|
-
/* @__PURE__ */
|
|
538
|
+
}, as = () => {
|
|
539
|
+
const { handleSubmit: t } = je(), s = Be();
|
|
540
|
+
return /* @__PURE__ */ i(fe, { children: [
|
|
541
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ae, {}) }),
|
|
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(ze, {}),
|
|
544
|
+
/* @__PURE__ */ e(ls, {}),
|
|
545
|
+
/* @__PURE__ */ e($e, {}),
|
|
546
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
547
547
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
548
|
-
|
|
548
|
+
Ge,
|
|
549
549
|
{
|
|
550
550
|
className: "w-full resize-none outline-none leading-6",
|
|
551
551
|
maxRows: 4
|
|
@@ -560,40 +560,37 @@ const es = (t) => ({
|
|
|
560
560
|
disabled: !s,
|
|
561
561
|
onClick: t,
|
|
562
562
|
type: "button",
|
|
563
|
-
children: /* @__PURE__ */ e(
|
|
563
|
+
children: /* @__PURE__ */ e(qe, { className: "size-4" })
|
|
564
564
|
}
|
|
565
565
|
)
|
|
566
566
|
] })
|
|
567
567
|
] })
|
|
568
568
|
] });
|
|
569
|
-
},
|
|
569
|
+
}, os = ({
|
|
570
570
|
renderActions: t
|
|
571
|
-
}) => /* @__PURE__ */
|
|
571
|
+
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
572
572
|
t && (t == null ? void 0 : t()),
|
|
573
|
-
/* @__PURE__ */ e(
|
|
574
|
-
] }),
|
|
573
|
+
/* @__PURE__ */ e(Oe, { Input: as })
|
|
574
|
+
] }), is = (t) => {
|
|
575
575
|
const s = t.message.hide_date === !0;
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
/* @__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: [
|
|
578
578
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
579
579
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
580
580
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
581
581
|
] }),
|
|
582
|
-
!s && /* @__PURE__ */ e(
|
|
582
|
+
!s && /* @__PURE__ */ e(He, { message: t.message })
|
|
583
583
|
] });
|
|
584
|
-
},
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
(g) => {
|
|
591
|
-
var v;
|
|
592
|
-
return ((v = g.user) == null ? void 0 : v.id) && g.user.id !== a._client.userID;
|
|
584
|
+
}, cs = () => null, ds = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
585
|
+
var m, g, y, h, f;
|
|
586
|
+
const { channel: a } = ge(), o = L.useMemo(() => Object.values(a.state.members || {}).find(
|
|
587
|
+
(b) => {
|
|
588
|
+
var w;
|
|
589
|
+
return ((w = b.user) == null ? void 0 : w.id) && b.user.id !== a._client.userID;
|
|
593
590
|
}
|
|
594
|
-
), [a._client.userID, a.state.members]),
|
|
595
|
-
return /* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
591
|
+
), [a._client.userID, a.state.members]), l = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", c = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image;
|
|
592
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
593
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
597
594
|
/* @__PURE__ */ e(
|
|
598
595
|
"button",
|
|
599
596
|
{
|
|
@@ -603,20 +600,20 @@ const es = (t) => ({
|
|
|
603
600
|
),
|
|
604
601
|
onClick: t || (() => {
|
|
605
602
|
}),
|
|
606
|
-
children: /* @__PURE__ */ e(
|
|
603
|
+
children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
|
|
607
604
|
}
|
|
608
605
|
),
|
|
609
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
610
607
|
/* @__PURE__ */ e(
|
|
611
608
|
q,
|
|
612
609
|
{
|
|
613
|
-
id: ((h =
|
|
614
|
-
name:
|
|
610
|
+
id: ((h = o == null ? void 0 : o.user) == null ? void 0 : h.id) || a.id || "unknown",
|
|
611
|
+
name: l,
|
|
615
612
|
image: c,
|
|
616
613
|
size: 40
|
|
617
614
|
}
|
|
618
615
|
),
|
|
619
|
-
/* @__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 })
|
|
620
617
|
] }),
|
|
621
618
|
/* @__PURE__ */ e(
|
|
622
619
|
"button",
|
|
@@ -626,12 +623,12 @@ const es = (t) => ({
|
|
|
626
623
|
),
|
|
627
624
|
onClick: n || (() => {
|
|
628
625
|
}),
|
|
629
|
-
children: /* @__PURE__ */ e(
|
|
626
|
+
children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
|
|
630
627
|
}
|
|
631
628
|
)
|
|
632
629
|
] }),
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__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: [
|
|
635
632
|
s && t && /* @__PURE__ */ e(
|
|
636
633
|
"button",
|
|
637
634
|
{
|
|
@@ -639,103 +636,103 @@ const es = (t) => ({
|
|
|
639
636
|
onClick: t,
|
|
640
637
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
641
638
|
"aria-label": "Back to conversations",
|
|
642
|
-
children: /* @__PURE__ */ e(
|
|
639
|
+
children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
|
|
643
640
|
}
|
|
644
641
|
),
|
|
645
642
|
/* @__PURE__ */ e(
|
|
646
643
|
q,
|
|
647
644
|
{
|
|
648
|
-
id: ((f =
|
|
649
|
-
name:
|
|
645
|
+
id: ((f = o == null ? void 0 : o.user) == null ? void 0 : f.id) || a.id || "unknown",
|
|
646
|
+
name: l,
|
|
650
647
|
image: c,
|
|
651
648
|
size: 40
|
|
652
649
|
}
|
|
653
650
|
),
|
|
654
|
-
/* @__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 }) })
|
|
655
652
|
] }),
|
|
656
|
-
|
|
653
|
+
r && n && /* @__PURE__ */ e(
|
|
657
654
|
"button",
|
|
658
655
|
{
|
|
659
656
|
className: p(
|
|
660
657
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
661
658
|
),
|
|
662
659
|
onClick: n,
|
|
663
|
-
children: /* @__PURE__ */ e(
|
|
660
|
+
children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
|
|
664
661
|
}
|
|
665
662
|
)
|
|
666
663
|
] })
|
|
667
664
|
] });
|
|
668
|
-
},
|
|
665
|
+
}, us = ({
|
|
669
666
|
isOpen: t,
|
|
670
667
|
onClose: s,
|
|
671
668
|
participant: n,
|
|
672
|
-
channel:
|
|
669
|
+
channel: r,
|
|
673
670
|
followerStatusLabel: a,
|
|
674
|
-
onLeaveConversation:
|
|
675
|
-
onBlockParticipant:
|
|
671
|
+
onLeaveConversation: o,
|
|
672
|
+
onBlockParticipant: l
|
|
676
673
|
}) => {
|
|
677
|
-
var
|
|
678
|
-
const { service: c, debug: m } =
|
|
674
|
+
var Z, B, V, Y, H, W, J;
|
|
675
|
+
const { service: c, debug: m } = ne(), g = $(null), [y, h] = v(!1), [f, S] = v(!1), [b, w] = v(!1);
|
|
679
676
|
G(() => {
|
|
680
|
-
const
|
|
681
|
-
|
|
677
|
+
const _ = g.current;
|
|
678
|
+
_ && (t ? _.showModal() : _.close());
|
|
682
679
|
}, [t]);
|
|
683
|
-
const
|
|
684
|
-
var
|
|
685
|
-
if (!(!c || !((
|
|
680
|
+
const E = M(async () => {
|
|
681
|
+
var _;
|
|
682
|
+
if (!(!c || !((_ = n == null ? void 0 : n.user) != null && _.id)))
|
|
686
683
|
try {
|
|
687
|
-
const
|
|
688
|
-
(
|
|
684
|
+
const U = (await c.getBlockedUsers()).some(
|
|
685
|
+
(O) => {
|
|
689
686
|
var Q;
|
|
690
|
-
return
|
|
687
|
+
return O.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
|
|
691
688
|
}
|
|
692
689
|
);
|
|
693
|
-
h(
|
|
694
|
-
} catch (
|
|
690
|
+
h(U);
|
|
691
|
+
} catch (P) {
|
|
695
692
|
console.error(
|
|
696
693
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
697
|
-
|
|
694
|
+
P
|
|
698
695
|
);
|
|
699
696
|
}
|
|
700
|
-
}, [c, (
|
|
697
|
+
}, [c, (Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id]);
|
|
701
698
|
G(() => {
|
|
702
|
-
t &&
|
|
703
|
-
}, [t,
|
|
704
|
-
const
|
|
705
|
-
var
|
|
699
|
+
t && E();
|
|
700
|
+
}, [t, E]);
|
|
701
|
+
const N = async () => {
|
|
702
|
+
var _;
|
|
706
703
|
if (!f) {
|
|
707
|
-
m && console.log("[ChannelInfoDialog] Leave conversation",
|
|
704
|
+
m && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
|
|
708
705
|
try {
|
|
709
|
-
const
|
|
710
|
-
await
|
|
711
|
-
} catch (
|
|
712
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
706
|
+
const P = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
|
|
707
|
+
await r.hide(P, !1), o && await o(r), s();
|
|
708
|
+
} catch (P) {
|
|
709
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", P);
|
|
713
710
|
} finally {
|
|
714
|
-
|
|
711
|
+
S(!1);
|
|
715
712
|
}
|
|
716
713
|
}
|
|
717
714
|
}, I = async () => {
|
|
718
|
-
var
|
|
719
|
-
if (!(
|
|
720
|
-
m && console.log("[ChannelInfoDialog] Block member", (
|
|
715
|
+
var _, P, U;
|
|
716
|
+
if (!(b || !c)) {
|
|
717
|
+
m && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
|
|
721
718
|
try {
|
|
722
|
-
await c.blockUser((
|
|
723
|
-
} catch (
|
|
724
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
719
|
+
await c.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
720
|
+
} catch (O) {
|
|
721
|
+
console.error("[ChannelInfoDialog] Failed to block member", O);
|
|
725
722
|
} finally {
|
|
726
|
-
|
|
723
|
+
w(!1);
|
|
727
724
|
}
|
|
728
725
|
}
|
|
729
|
-
},
|
|
730
|
-
var
|
|
731
|
-
if (!(
|
|
732
|
-
m && console.log("[ChannelInfoDialog] Unblock member", (
|
|
726
|
+
}, k = async () => {
|
|
727
|
+
var _, P, U;
|
|
728
|
+
if (!(b || !c)) {
|
|
729
|
+
m && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
|
|
733
730
|
try {
|
|
734
|
-
await c.unBlockUser((
|
|
735
|
-
} catch (
|
|
736
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
731
|
+
await c.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
732
|
+
} catch (O) {
|
|
733
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", O);
|
|
737
734
|
} finally {
|
|
738
|
-
|
|
735
|
+
w(!1);
|
|
739
736
|
}
|
|
740
737
|
}
|
|
741
738
|
}, R = () => {
|
|
@@ -746,43 +743,43 @@ const es = (t) => ({
|
|
|
746
743
|
);
|
|
747
744
|
};
|
|
748
745
|
if (!n) return null;
|
|
749
|
-
const
|
|
746
|
+
const F = ((B = n.user) == null ? void 0 : B.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, x = (W = n.user) == null ? void 0 : W.username, A = u || (x ? `linktr.ee/${x}` : void 0), z = ((J = n.user) == null ? void 0 : J.id) || "unknown";
|
|
750
747
|
return (
|
|
751
748
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
752
749
|
/* @__PURE__ */ e(
|
|
753
750
|
"dialog",
|
|
754
751
|
{
|
|
755
|
-
ref:
|
|
752
|
+
ref: g,
|
|
756
753
|
className: "mes-dialog group",
|
|
757
754
|
onClose: s,
|
|
758
|
-
onClick: (
|
|
759
|
-
|
|
755
|
+
onClick: (_) => {
|
|
756
|
+
_.target === g.current && s();
|
|
760
757
|
},
|
|
761
|
-
children: /* @__PURE__ */
|
|
762
|
-
/* @__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: [
|
|
763
760
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
764
|
-
/* @__PURE__ */ e(
|
|
761
|
+
/* @__PURE__ */ e(ve, { onClick: s })
|
|
765
762
|
] }),
|
|
766
|
-
/* @__PURE__ */
|
|
763
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
767
764
|
/* @__PURE__ */ e(
|
|
768
765
|
"div",
|
|
769
766
|
{
|
|
770
767
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
771
768
|
style: { backgroundColor: "#FBFAF9" },
|
|
772
|
-
children: /* @__PURE__ */
|
|
769
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
773
770
|
/* @__PURE__ */ e(
|
|
774
771
|
q,
|
|
775
772
|
{
|
|
776
|
-
id:
|
|
777
|
-
name:
|
|
773
|
+
id: z,
|
|
774
|
+
name: F,
|
|
778
775
|
image: d,
|
|
779
776
|
size: 88,
|
|
780
777
|
shape: "circle"
|
|
781
778
|
}
|
|
782
779
|
),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
785
|
-
|
|
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: F }),
|
|
782
|
+
A && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: A }),
|
|
786
783
|
a && /* @__PURE__ */ e(
|
|
787
784
|
"span",
|
|
788
785
|
{
|
|
@@ -801,44 +798,44 @@ const es = (t) => ({
|
|
|
801
798
|
] })
|
|
802
799
|
}
|
|
803
800
|
),
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
806
|
-
|
|
801
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
802
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
803
|
+
ee,
|
|
807
804
|
{
|
|
808
|
-
onClick:
|
|
805
|
+
onClick: N,
|
|
809
806
|
disabled: f,
|
|
810
807
|
"aria-busy": f,
|
|
811
808
|
children: [
|
|
812
|
-
f ? /* @__PURE__ */ e(
|
|
809
|
+
f ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ye, { className: "h-5 w-5" }),
|
|
813
810
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
814
811
|
]
|
|
815
812
|
}
|
|
816
813
|
) }),
|
|
817
|
-
/* @__PURE__ */ e("li", { children:
|
|
818
|
-
|
|
814
|
+
/* @__PURE__ */ e("li", { children: y ? /* @__PURE__ */ i(
|
|
815
|
+
ee,
|
|
819
816
|
{
|
|
820
|
-
onClick:
|
|
821
|
-
disabled:
|
|
822
|
-
"aria-busy":
|
|
817
|
+
onClick: k,
|
|
818
|
+
disabled: b,
|
|
819
|
+
"aria-busy": b,
|
|
823
820
|
children: [
|
|
824
|
-
|
|
821
|
+
b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
|
|
825
822
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
826
823
|
]
|
|
827
824
|
}
|
|
828
|
-
) : /* @__PURE__ */
|
|
829
|
-
|
|
825
|
+
) : /* @__PURE__ */ i(
|
|
826
|
+
ee,
|
|
830
827
|
{
|
|
831
828
|
onClick: I,
|
|
832
|
-
disabled:
|
|
833
|
-
"aria-busy":
|
|
829
|
+
disabled: b,
|
|
830
|
+
"aria-busy": b,
|
|
834
831
|
children: [
|
|
835
|
-
|
|
832
|
+
b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
|
|
836
833
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
837
834
|
]
|
|
838
835
|
}
|
|
839
836
|
) }),
|
|
840
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */ e(
|
|
837
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ee, { variant: "danger", onClick: R, children: [
|
|
838
|
+
/* @__PURE__ */ e(Je, { className: "h-5 w-5" }),
|
|
842
839
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
843
840
|
] }) })
|
|
844
841
|
] })
|
|
@@ -847,107 +844,113 @@ const es = (t) => ({
|
|
|
847
844
|
}
|
|
848
845
|
)
|
|
849
846
|
);
|
|
850
|
-
},
|
|
847
|
+
}, ms = ({
|
|
851
848
|
onBack: t,
|
|
852
849
|
showBackButton: s,
|
|
853
850
|
renderMessageInputActions: n,
|
|
854
|
-
onLeaveConversation:
|
|
855
|
-
onBlockParticipant: a
|
|
856
|
-
CustomChannelEmptyState: i = Ce
|
|
851
|
+
onLeaveConversation: r,
|
|
852
|
+
onBlockParticipant: a
|
|
857
853
|
}) => {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return ((w = v.user) == null ? void 0 : w.id) && v.user.id !== r._client.userID;
|
|
854
|
+
const { channel: o } = ge(), [l, c] = v(!1), m = L.useMemo(() => Object.values(o.state.members || {}).find(
|
|
855
|
+
(h) => {
|
|
856
|
+
var f;
|
|
857
|
+
return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== o._client.userID;
|
|
863
858
|
}
|
|
864
|
-
), [
|
|
865
|
-
const
|
|
866
|
-
if (
|
|
867
|
-
return String(
|
|
868
|
-
if (
|
|
869
|
-
return
|
|
870
|
-
}, [
|
|
871
|
-
return /* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
859
|
+
), [o._client.userID, o.state.members]), g = L.useMemo(() => {
|
|
860
|
+
const y = o.data ?? {};
|
|
861
|
+
if (y.followerStatus)
|
|
862
|
+
return String(y.followerStatus);
|
|
863
|
+
if (y.isFollower !== void 0)
|
|
864
|
+
return y.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
865
|
+
}, [o.data]);
|
|
866
|
+
return /* @__PURE__ */ i(fe, { children: [
|
|
867
|
+
/* @__PURE__ */ i(We, { children: [
|
|
873
868
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
874
|
-
|
|
869
|
+
ds,
|
|
875
870
|
{
|
|
876
871
|
onBack: t,
|
|
877
872
|
showBackButton: s,
|
|
878
|
-
onShowInfo: () =>
|
|
879
|
-
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: []
|
|
880
883
|
}
|
|
881
884
|
) }),
|
|
882
|
-
/* @__PURE__ */ o("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
883
|
-
/* @__PURE__ */ e(
|
|
884
|
-
Ge,
|
|
885
|
-
{
|
|
886
|
-
hideDeletedMessages: !0,
|
|
887
|
-
hideNewMessageSeparator: !1,
|
|
888
|
-
messageActions: []
|
|
889
|
-
}
|
|
890
|
-
),
|
|
891
|
-
!x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
|
|
892
|
-
] }),
|
|
893
885
|
/* @__PURE__ */ e(
|
|
894
|
-
|
|
886
|
+
os,
|
|
895
887
|
{
|
|
896
|
-
renderActions: () => n == null ? void 0 : n(
|
|
888
|
+
renderActions: () => n == null ? void 0 : n(o)
|
|
897
889
|
}
|
|
898
890
|
)
|
|
899
891
|
] }),
|
|
900
892
|
/* @__PURE__ */ e(
|
|
901
|
-
|
|
893
|
+
us,
|
|
902
894
|
{
|
|
903
|
-
isOpen:
|
|
904
|
-
onClose: () =>
|
|
905
|
-
participant:
|
|
906
|
-
channel:
|
|
907
|
-
followerStatusLabel:
|
|
908
|
-
onLeaveConversation:
|
|
895
|
+
isOpen: l,
|
|
896
|
+
onClose: () => c(!1),
|
|
897
|
+
participant: m,
|
|
898
|
+
channel: o,
|
|
899
|
+
followerStatusLabel: g,
|
|
900
|
+
onLeaveConversation: r,
|
|
909
901
|
onBlockParticipant: a
|
|
910
902
|
}
|
|
911
903
|
)
|
|
912
904
|
] });
|
|
913
|
-
},
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
905
|
+
}, we = L.memo(
|
|
906
|
+
({
|
|
907
|
+
channel: t,
|
|
908
|
+
onBack: s,
|
|
909
|
+
showBackButton: n = !1,
|
|
910
|
+
renderMessageInputActions: r,
|
|
911
|
+
onLeaveConversation: a,
|
|
912
|
+
onBlockParticipant: o,
|
|
913
|
+
className: l,
|
|
914
|
+
CustomChannelEmptyState: c = cs
|
|
915
|
+
}) => /* @__PURE__ */ e(
|
|
916
|
+
"div",
|
|
917
|
+
{
|
|
918
|
+
className: p(
|
|
919
|
+
"messaging-channel-view h-full flex flex-col",
|
|
920
|
+
l
|
|
921
|
+
),
|
|
922
|
+
children: /* @__PURE__ */ e(
|
|
923
|
+
Ve,
|
|
924
|
+
{
|
|
925
|
+
channel: t,
|
|
926
|
+
MessageSystem: is,
|
|
927
|
+
EmptyStateIndicator: c,
|
|
928
|
+
children: /* @__PURE__ */ e(
|
|
929
|
+
ms,
|
|
930
|
+
{
|
|
931
|
+
onBack: s,
|
|
932
|
+
showBackButton: n,
|
|
933
|
+
renderMessageInputActions: r,
|
|
934
|
+
onLeaveConversation: a,
|
|
935
|
+
onBlockParticipant: o,
|
|
936
|
+
CustomChannelEmptyState: c
|
|
937
|
+
}
|
|
938
|
+
)
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
}
|
|
942
|
+
)
|
|
941
943
|
);
|
|
942
|
-
|
|
944
|
+
we.displayName = "ChannelView";
|
|
945
|
+
function hs({
|
|
943
946
|
searchQuery: t,
|
|
944
947
|
setSearchQuery: s,
|
|
945
948
|
placeholder: n
|
|
946
949
|
}) {
|
|
947
|
-
const
|
|
948
|
-
return /* @__PURE__ */
|
|
950
|
+
const r = $(null);
|
|
951
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
949
952
|
/* @__PURE__ */ e(
|
|
950
|
-
|
|
953
|
+
Qe,
|
|
951
954
|
{
|
|
952
955
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
953
956
|
weight: "bold"
|
|
@@ -956,7 +959,7 @@ function ds({
|
|
|
956
959
|
/* @__PURE__ */ e(
|
|
957
960
|
"input",
|
|
958
961
|
{
|
|
959
|
-
ref:
|
|
962
|
+
ref: r,
|
|
960
963
|
type: "text",
|
|
961
964
|
placeholder: n,
|
|
962
965
|
value: t,
|
|
@@ -965,31 +968,31 @@ function ds({
|
|
|
965
968
|
}
|
|
966
969
|
),
|
|
967
970
|
t && /* @__PURE__ */ e(
|
|
968
|
-
|
|
971
|
+
be,
|
|
969
972
|
{
|
|
970
973
|
label: "Clear search",
|
|
971
974
|
onClick: () => {
|
|
972
975
|
var a;
|
|
973
|
-
s(""), (a =
|
|
976
|
+
s(""), (a = r.current) == null || a.focus();
|
|
974
977
|
},
|
|
975
978
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
976
|
-
children: /* @__PURE__ */ e(
|
|
979
|
+
children: /* @__PURE__ */ e(ae, { className: "h-4 w-4", weight: "bold" })
|
|
977
980
|
}
|
|
978
981
|
)
|
|
979
982
|
] });
|
|
980
983
|
}
|
|
981
|
-
const
|
|
984
|
+
const fs = ({
|
|
982
985
|
participantSource: t,
|
|
983
986
|
onSelectParticipant: s,
|
|
984
987
|
onClose: n,
|
|
985
|
-
existingParticipantIds:
|
|
988
|
+
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
986
989
|
participantLabel: a = "participants",
|
|
987
|
-
searchPlaceholder:
|
|
988
|
-
className:
|
|
990
|
+
searchPlaceholder: o = "Search participants...",
|
|
991
|
+
className: l
|
|
989
992
|
}) => {
|
|
990
|
-
const { debug: c } =
|
|
993
|
+
const { debug: c } = ne(), [m, g] = v(""), [y, h] = v([]), [f, S] = v(!1), [b, w] = v(null), [E, N] = v(
|
|
991
994
|
null
|
|
992
|
-
), I =
|
|
995
|
+
), I = $(!1);
|
|
993
996
|
G(() => {
|
|
994
997
|
if (t.loading) {
|
|
995
998
|
c && console.log(
|
|
@@ -999,7 +1002,7 @@ const us = ({
|
|
|
999
1002
|
}
|
|
1000
1003
|
if (I.current) return;
|
|
1001
1004
|
(async () => {
|
|
1002
|
-
c && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1005
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), w(null);
|
|
1003
1006
|
try {
|
|
1004
1007
|
const u = await t.loadParticipants({
|
|
1005
1008
|
search: "",
|
|
@@ -1011,85 +1014,85 @@ const us = ({
|
|
|
1011
1014
|
u.participants.length
|
|
1012
1015
|
);
|
|
1013
1016
|
} catch (u) {
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1017
|
+
const x = u instanceof Error ? u.message : "Failed to load participants";
|
|
1018
|
+
w(x), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1016
1019
|
} finally {
|
|
1017
|
-
|
|
1020
|
+
S(!1);
|
|
1018
1021
|
}
|
|
1019
1022
|
})();
|
|
1020
1023
|
}, [t.loading, c]);
|
|
1021
|
-
const
|
|
1022
|
-
var
|
|
1024
|
+
const k = y.filter((d) => !r.has(d.id)).filter((d) => {
|
|
1025
|
+
var x;
|
|
1023
1026
|
if (!m) return !0;
|
|
1024
1027
|
const u = m.toLowerCase();
|
|
1025
|
-
return d.name.toLowerCase().includes(u) || ((
|
|
1026
|
-
}), R =
|
|
1028
|
+
return d.name.toLowerCase().includes(u) || ((x = d.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
|
|
1029
|
+
}), R = M(
|
|
1027
1030
|
async (d) => {
|
|
1028
|
-
if (!
|
|
1029
|
-
|
|
1031
|
+
if (!E) {
|
|
1032
|
+
N(d.id);
|
|
1030
1033
|
try {
|
|
1031
1034
|
await s(d);
|
|
1032
1035
|
} catch (u) {
|
|
1033
|
-
console.error("[ParticipantPicker] Failed to start chat:", u),
|
|
1036
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), N(null);
|
|
1034
1037
|
}
|
|
1035
1038
|
}
|
|
1036
1039
|
},
|
|
1037
|
-
[s,
|
|
1038
|
-
),
|
|
1040
|
+
[s, E]
|
|
1041
|
+
), F = (d, u) => {
|
|
1039
1042
|
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), R(u));
|
|
1040
1043
|
};
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
|
|
1045
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1046
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1044
1047
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1045
|
-
/* @__PURE__ */ e(
|
|
1048
|
+
/* @__PURE__ */ e(ve, { onClick: n })
|
|
1046
1049
|
] }),
|
|
1047
|
-
/* @__PURE__ */
|
|
1050
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1048
1051
|
"Select a ",
|
|
1049
1052
|
a.slice(0, -1),
|
|
1050
1053
|
" to start messaging (",
|
|
1051
|
-
|
|
1054
|
+
k.length,
|
|
1052
1055
|
" available)",
|
|
1053
1056
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
|
|
1054
1057
|
] }),
|
|
1055
1058
|
/* @__PURE__ */ e(
|
|
1056
|
-
|
|
1059
|
+
hs,
|
|
1057
1060
|
{
|
|
1058
1061
|
searchQuery: m,
|
|
1059
|
-
setSearchQuery:
|
|
1060
|
-
placeholder:
|
|
1062
|
+
setSearchQuery: g,
|
|
1063
|
+
placeholder: o
|
|
1061
1064
|
}
|
|
1062
1065
|
)
|
|
1063
1066
|
] }),
|
|
1064
|
-
|
|
1067
|
+
b && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1065
1068
|
"Error loading ",
|
|
1066
1069
|
a,
|
|
1067
1070
|
": ",
|
|
1068
|
-
|
|
1071
|
+
b
|
|
1069
1072
|
] }),
|
|
1070
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f &&
|
|
1073
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && k.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: [
|
|
1071
1074
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1072
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1073
1076
|
"Loading ",
|
|
1074
1077
|
a,
|
|
1075
1078
|
"..."
|
|
1076
1079
|
] })
|
|
1077
|
-
] }) }) :
|
|
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(
|
|
1079
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` :
|
|
1080
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" :
|
|
1081
|
-
] }) : /* @__PURE__ */
|
|
1082
|
-
|
|
1083
|
-
const u = d.name || d.email || d.id,
|
|
1080
|
+
] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1081
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ue, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1082
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` : y.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1083
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : y.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1084
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1085
|
+
k.map((d) => {
|
|
1086
|
+
const u = d.name || d.email || d.id, x = d.email && d.name ? d.email : d.phone;
|
|
1084
1087
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1085
1088
|
"button",
|
|
1086
1089
|
{
|
|
1087
1090
|
type: "button",
|
|
1088
1091
|
onClick: () => R(d),
|
|
1089
|
-
onKeyDown: (
|
|
1092
|
+
onKeyDown: (A) => F(A, d),
|
|
1090
1093
|
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",
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1092
|
-
/* @__PURE__ */
|
|
1094
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1095
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1093
1096
|
/* @__PURE__ */ e(
|
|
1094
1097
|
q,
|
|
1095
1098
|
{
|
|
@@ -1099,23 +1102,23 @@ const us = ({
|
|
|
1099
1102
|
size: 40
|
|
1100
1103
|
}
|
|
1101
1104
|
),
|
|
1102
|
-
/* @__PURE__ */
|
|
1105
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1103
1106
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1104
|
-
|
|
1107
|
+
x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
|
|
1105
1108
|
] })
|
|
1106
1109
|
] }),
|
|
1107
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1110
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === d.id ? /* @__PURE__ */ e(se, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone" }) })
|
|
1108
1111
|
] })
|
|
1109
1112
|
}
|
|
1110
1113
|
) }, d.id);
|
|
1111
1114
|
}),
|
|
1112
|
-
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1115
|
+
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1113
1116
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1114
1117
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1115
1118
|
] }) })
|
|
1116
1119
|
] }) })
|
|
1117
1120
|
] });
|
|
1118
|
-
},
|
|
1121
|
+
}, gs = ({ className: t }) => /* @__PURE__ */ i(
|
|
1119
1122
|
"svg",
|
|
1120
1123
|
{
|
|
1121
1124
|
width: "140",
|
|
@@ -1125,7 +1128,7 @@ const us = ({
|
|
|
1125
1128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1126
1129
|
className: t,
|
|
1127
1130
|
children: [
|
|
1128
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1129
1132
|
/* @__PURE__ */ e(
|
|
1130
1133
|
"path",
|
|
1131
1134
|
{
|
|
@@ -1154,7 +1157,7 @@ const us = ({
|
|
|
1154
1157
|
fill: "white"
|
|
1155
1158
|
}
|
|
1156
1159
|
),
|
|
1157
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1158
1161
|
/* @__PURE__ */ e(
|
|
1159
1162
|
"path",
|
|
1160
1163
|
{
|
|
@@ -1194,8 +1197,8 @@ const us = ({
|
|
|
1194
1197
|
}
|
|
1195
1198
|
)
|
|
1196
1199
|
] }),
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1201
|
+
/* @__PURE__ */ i(
|
|
1199
1202
|
"filter",
|
|
1200
1203
|
{
|
|
1201
1204
|
id: "filter0_empty_state",
|
|
@@ -1249,13 +1252,17 @@ const us = ({
|
|
|
1249
1252
|
] })
|
|
1250
1253
|
]
|
|
1251
1254
|
}
|
|
1252
|
-
),
|
|
1253
|
-
/* @__PURE__ */ e(
|
|
1254
|
-
|
|
1255
|
-
/* @__PURE__ */
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
] })
|
|
1255
|
+
), ye = L.memo(
|
|
1256
|
+
({ 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: [
|
|
1257
|
+
/* @__PURE__ */ e(gs, {}),
|
|
1258
|
+
!t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1259
|
+
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1260
|
+
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1261
|
+
] })
|
|
1262
|
+
] }) })
|
|
1263
|
+
);
|
|
1264
|
+
ye.displayName = "EmptyState";
|
|
1265
|
+
const te = L.memo(({ 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: [
|
|
1259
1266
|
/* @__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: "⚠️" }) }),
|
|
1260
1267
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1261
1268
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1268,12 +1275,14 @@ const us = ({
|
|
|
1268
1275
|
children: "Go Back"
|
|
1269
1276
|
}
|
|
1270
1277
|
)
|
|
1271
|
-
] }) })
|
|
1278
|
+
] }) }));
|
|
1279
|
+
te.displayName = "ErrorState";
|
|
1280
|
+
const xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1272
1281
|
"div",
|
|
1273
1282
|
{
|
|
1274
1283
|
className: p("flex items-center justify-center h-full", t),
|
|
1275
1284
|
children: [
|
|
1276
|
-
/* @__PURE__ */
|
|
1285
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1277
1286
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1278
1287
|
"animateTransform",
|
|
1279
1288
|
{
|
|
@@ -1311,31 +1320,33 @@ const us = ({
|
|
|
1311
1320
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1312
1321
|
]
|
|
1313
1322
|
}
|
|
1314
|
-
),
|
|
1315
|
-
/* @__PURE__ */ e(
|
|
1323
|
+
), Ee = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1324
|
+
/* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
|
|
1316
1325
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1317
|
-
] }) })
|
|
1326
|
+
] }) }));
|
|
1327
|
+
Ee.displayName = "LoadingState";
|
|
1328
|
+
const Ss = ({
|
|
1318
1329
|
capabilities: t = {},
|
|
1319
1330
|
className: s,
|
|
1320
1331
|
renderMessageInputActions: n,
|
|
1321
|
-
onChannelSelect:
|
|
1332
|
+
onChannelSelect: r,
|
|
1322
1333
|
onParticipantSelect: a,
|
|
1323
|
-
initialParticipantFilter:
|
|
1324
|
-
initialParticipantData:
|
|
1334
|
+
initialParticipantFilter: o,
|
|
1335
|
+
initialParticipantData: l,
|
|
1325
1336
|
CustomChannelEmptyState: c,
|
|
1326
1337
|
showChannelList: m = !0,
|
|
1327
|
-
filters:
|
|
1328
|
-
channelListCustomEmptyStateIndicator:
|
|
1338
|
+
filters: g,
|
|
1339
|
+
channelListCustomEmptyStateIndicator: y
|
|
1329
1340
|
}) => {
|
|
1330
1341
|
const {
|
|
1331
1342
|
service: h,
|
|
1332
1343
|
client: f,
|
|
1333
|
-
isConnected:
|
|
1334
|
-
isLoading:
|
|
1335
|
-
error:
|
|
1336
|
-
refreshConnection:
|
|
1337
|
-
debug:
|
|
1338
|
-
} =
|
|
1344
|
+
isConnected: S,
|
|
1345
|
+
isLoading: b,
|
|
1346
|
+
error: w,
|
|
1347
|
+
refreshConnection: E,
|
|
1348
|
+
debug: N
|
|
1349
|
+
} = Xe(), [I, k] = v(null), [R, F] = v(!1), [d, u] = v(!1), [x, A] = v(/* @__PURE__ */ new Set()), [z, Z] = v(0), [B, V] = v(!1), [Y, H] = v(null), W = $(null), { participantSource: J, participantLabel: _ = "participants" } = t, P = L.useMemo(() => {
|
|
1339
1350
|
const C = f == null ? void 0 : f.userID;
|
|
1340
1351
|
return {
|
|
1341
1352
|
...{
|
|
@@ -1346,163 +1357,168 @@ const us = ({
|
|
|
1346
1357
|
hidden: !1
|
|
1347
1358
|
}
|
|
1348
1359
|
},
|
|
1349
|
-
...
|
|
1360
|
+
...g
|
|
1350
1361
|
};
|
|
1351
|
-
}, [
|
|
1352
|
-
if (!f || !
|
|
1362
|
+
}, [g, f == null ? void 0 : f.userID]), U = $(null), O = M(async () => {
|
|
1363
|
+
if (!f || !S) return;
|
|
1353
1364
|
const C = f.userID;
|
|
1354
1365
|
if (C)
|
|
1355
1366
|
try {
|
|
1356
|
-
|
|
1357
|
-
const
|
|
1367
|
+
N && console.log("[MessagingShell] Syncing channels for user:", C);
|
|
1368
|
+
const j = await f.queryChannels(
|
|
1358
1369
|
{
|
|
1359
1370
|
type: "messaging",
|
|
1360
1371
|
members: { $in: [C] }
|
|
1361
1372
|
},
|
|
1362
1373
|
{},
|
|
1363
1374
|
{ limit: 100 }
|
|
1364
|
-
),
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
Object.values(
|
|
1368
|
-
var
|
|
1369
|
-
const
|
|
1370
|
-
|
|
1375
|
+
), D = /* @__PURE__ */ new Set();
|
|
1376
|
+
j.forEach((T) => {
|
|
1377
|
+
const re = T.state.members;
|
|
1378
|
+
Object.values(re).forEach((_e) => {
|
|
1379
|
+
var oe;
|
|
1380
|
+
const le = (oe = _e.user) == null ? void 0 : oe.id;
|
|
1381
|
+
le && le !== C && D.add(le);
|
|
1371
1382
|
});
|
|
1372
|
-
}),
|
|
1373
|
-
channelCount:
|
|
1374
|
-
memberCount:
|
|
1383
|
+
}), A((T) => T.size === D.size && [...T].every((re) => D.has(re)) ? T : D), F(j.length > 0), U.current = C, N && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1384
|
+
channelCount: j.length,
|
|
1385
|
+
memberCount: D.size
|
|
1375
1386
|
});
|
|
1376
|
-
} catch (
|
|
1377
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1387
|
+
} catch (j) {
|
|
1388
|
+
console.error("[MessagingShell] Failed to sync channels:", j);
|
|
1378
1389
|
}
|
|
1379
|
-
}, [f,
|
|
1390
|
+
}, [f, S, N]);
|
|
1380
1391
|
G(() => {
|
|
1381
|
-
if (!f || !
|
|
1392
|
+
if (!f || !S) return;
|
|
1382
1393
|
const C = f.userID;
|
|
1383
|
-
C &&
|
|
1384
|
-
}, [f,
|
|
1385
|
-
if (!
|
|
1394
|
+
C && U.current !== C && O();
|
|
1395
|
+
}, [f, S, O]), G(() => {
|
|
1396
|
+
if (!o || !f || !S) return;
|
|
1386
1397
|
(async () => {
|
|
1387
|
-
const
|
|
1388
|
-
if (
|
|
1398
|
+
const j = f.userID;
|
|
1399
|
+
if (j)
|
|
1389
1400
|
try {
|
|
1390
|
-
|
|
1401
|
+
N && console.log(
|
|
1391
1402
|
"[MessagingShell] Loading initial conversation with:",
|
|
1392
|
-
|
|
1403
|
+
o
|
|
1393
1404
|
);
|
|
1394
|
-
const
|
|
1405
|
+
const D = await f.queryChannels(
|
|
1395
1406
|
{
|
|
1396
1407
|
type: "messaging",
|
|
1397
|
-
members: { $eq: [
|
|
1408
|
+
members: { $eq: [j, o] }
|
|
1398
1409
|
},
|
|
1399
1410
|
{},
|
|
1400
1411
|
{ limit: 1 }
|
|
1401
1412
|
);
|
|
1402
|
-
if (
|
|
1403
|
-
|
|
1413
|
+
if (D.length > 0)
|
|
1414
|
+
k(D[0]), V(!0), H(null), r && r(D[0]), N && console.log(
|
|
1404
1415
|
"[MessagingShell] Initial conversation loaded:",
|
|
1405
|
-
|
|
1416
|
+
D[0].id
|
|
1406
1417
|
);
|
|
1407
|
-
else if (
|
|
1408
|
-
|
|
1418
|
+
else if (l && h) {
|
|
1419
|
+
N && console.log(
|
|
1409
1420
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1410
|
-
|
|
1421
|
+
l
|
|
1411
1422
|
);
|
|
1412
1423
|
try {
|
|
1413
|
-
const
|
|
1414
|
-
id:
|
|
1415
|
-
name:
|
|
1416
|
-
email:
|
|
1417
|
-
phone:
|
|
1424
|
+
const T = await h.startChannelWithParticipant({
|
|
1425
|
+
id: l.id,
|
|
1426
|
+
name: l.name,
|
|
1427
|
+
email: l.email,
|
|
1428
|
+
phone: l.phone
|
|
1418
1429
|
});
|
|
1419
|
-
|
|
1430
|
+
k(T), V(!0), H(null), r && r(T), N && console.log(
|
|
1420
1431
|
"[MessagingShell] Channel created and loaded:",
|
|
1421
|
-
|
|
1432
|
+
T.id
|
|
1422
1433
|
);
|
|
1423
|
-
} catch (
|
|
1434
|
+
} catch (T) {
|
|
1424
1435
|
console.error(
|
|
1425
1436
|
"[MessagingShell] Failed to create conversation:",
|
|
1426
|
-
|
|
1437
|
+
T
|
|
1427
1438
|
), H("Failed to create conversation");
|
|
1428
1439
|
}
|
|
1429
1440
|
} else
|
|
1430
1441
|
H(
|
|
1431
1442
|
"No conversation found with this account"
|
|
1432
|
-
),
|
|
1443
|
+
), N && console.log(
|
|
1433
1444
|
"[MessagingShell] No conversation found for:",
|
|
1434
|
-
|
|
1445
|
+
o
|
|
1435
1446
|
);
|
|
1436
|
-
} catch (
|
|
1447
|
+
} catch (D) {
|
|
1437
1448
|
console.error(
|
|
1438
1449
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1439
|
-
|
|
1450
|
+
D
|
|
1440
1451
|
), H("Failed to load conversation");
|
|
1441
1452
|
}
|
|
1442
1453
|
})();
|
|
1443
1454
|
}, [
|
|
1444
|
-
|
|
1445
|
-
|
|
1455
|
+
o,
|
|
1456
|
+
l,
|
|
1446
1457
|
f,
|
|
1447
|
-
|
|
1458
|
+
S,
|
|
1448
1459
|
h,
|
|
1449
|
-
|
|
1450
|
-
|
|
1460
|
+
N,
|
|
1461
|
+
r
|
|
1451
1462
|
]);
|
|
1452
|
-
const Q =
|
|
1463
|
+
const Q = M(
|
|
1453
1464
|
(C) => {
|
|
1454
|
-
|
|
1465
|
+
k(C), r == null || r(C);
|
|
1455
1466
|
},
|
|
1456
|
-
[
|
|
1457
|
-
),
|
|
1458
|
-
|
|
1459
|
-
}, [
|
|
1467
|
+
[r]
|
|
1468
|
+
), Ie = M(() => {
|
|
1469
|
+
B || k(null);
|
|
1470
|
+
}, [B]), ke = M(
|
|
1460
1471
|
async (C) => {
|
|
1461
|
-
var
|
|
1472
|
+
var j;
|
|
1462
1473
|
if (h)
|
|
1463
1474
|
try {
|
|
1464
|
-
|
|
1475
|
+
N && console.log(
|
|
1465
1476
|
"[MessagingShell] Starting conversation with:",
|
|
1466
1477
|
C.id
|
|
1467
1478
|
);
|
|
1468
|
-
const
|
|
1479
|
+
const D = await h.startChannelWithParticipant({
|
|
1469
1480
|
id: C.id,
|
|
1470
1481
|
name: C.name,
|
|
1471
1482
|
email: C.email,
|
|
1472
1483
|
phone: C.phone
|
|
1473
1484
|
});
|
|
1474
1485
|
try {
|
|
1475
|
-
await
|
|
1476
|
-
} catch (
|
|
1477
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1486
|
+
await D.show();
|
|
1487
|
+
} catch (T) {
|
|
1488
|
+
console.warn("[MessagingShell] Failed to unhide channel:", T);
|
|
1478
1489
|
}
|
|
1479
|
-
|
|
1480
|
-
} catch (
|
|
1481
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1490
|
+
k(D), u(!1), (j = W.current) == null || j.close(), a == null || a(C);
|
|
1491
|
+
} catch (D) {
|
|
1492
|
+
console.error("[MessagingShell] Failed to start conversation:", D);
|
|
1482
1493
|
}
|
|
1483
1494
|
},
|
|
1484
|
-
[h, a,
|
|
1485
|
-
),
|
|
1495
|
+
[h, a, N]
|
|
1496
|
+
), X = M(() => {
|
|
1486
1497
|
var C;
|
|
1487
|
-
u(!1), (C =
|
|
1488
|
-
}, []),
|
|
1498
|
+
u(!1), (C = W.current) == null || C.close();
|
|
1499
|
+
}, []), Se = M(
|
|
1500
|
+
(C) => {
|
|
1501
|
+
C.target === W.current && X();
|
|
1502
|
+
},
|
|
1503
|
+
[X]
|
|
1504
|
+
), pe = M(
|
|
1489
1505
|
async (C) => {
|
|
1490
|
-
|
|
1506
|
+
N && console.log("[MessagingShell] Leaving conversation:", C.id), k(null), V(!1), U.current = null, await O();
|
|
1491
1507
|
},
|
|
1492
|
-
[
|
|
1493
|
-
),
|
|
1508
|
+
[O, N]
|
|
1509
|
+
), Re = M(
|
|
1494
1510
|
async (C) => {
|
|
1495
|
-
|
|
1511
|
+
N && console.log("[MessagingShell] Blocking participant:", C), k(null), V(!1), U.current = null, await O();
|
|
1496
1512
|
},
|
|
1497
|
-
[
|
|
1498
|
-
),
|
|
1499
|
-
return
|
|
1500
|
-
|
|
1513
|
+
[O, N]
|
|
1514
|
+
), K = !!I;
|
|
1515
|
+
return b ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(Ee, {}) }) : w ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: w, onBack: E }) }) : !S || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
|
|
1516
|
+
te,
|
|
1501
1517
|
{
|
|
1502
1518
|
message: "Not connected to messaging service",
|
|
1503
|
-
onBack:
|
|
1519
|
+
onBack: E
|
|
1504
1520
|
}
|
|
1505
|
-
) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
|
|
1521
|
+
) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: Y }) }) : /* @__PURE__ */ i(
|
|
1506
1522
|
"div",
|
|
1507
1523
|
{
|
|
1508
1524
|
className: p(
|
|
@@ -1510,7 +1526,7 @@ const us = ({
|
|
|
1510
1526
|
s
|
|
1511
1527
|
),
|
|
1512
1528
|
children: [
|
|
1513
|
-
/* @__PURE__ */
|
|
1529
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1514
1530
|
/* @__PURE__ */ e(
|
|
1515
1531
|
"div",
|
|
1516
1532
|
{
|
|
@@ -1518,20 +1534,20 @@ const us = ({
|
|
|
1518
1534
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1519
1535
|
{
|
|
1520
1536
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1521
|
-
"!hidden": m === !1 ||
|
|
1537
|
+
"!hidden": m === !1 || B,
|
|
1522
1538
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1523
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !
|
|
1539
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !B && K,
|
|
1524
1540
|
// Normal mode: show when no channel selected
|
|
1525
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !
|
|
1541
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !B && !K
|
|
1526
1542
|
}
|
|
1527
1543
|
),
|
|
1528
1544
|
children: /* @__PURE__ */ e(
|
|
1529
|
-
|
|
1545
|
+
Ne,
|
|
1530
1546
|
{
|
|
1531
1547
|
onChannelSelect: Q,
|
|
1532
1548
|
selectedChannel: I || void 0,
|
|
1533
|
-
filters:
|
|
1534
|
-
customEmptyStateIndicator:
|
|
1549
|
+
filters: P,
|
|
1550
|
+
customEmptyStateIndicator: y
|
|
1535
1551
|
}
|
|
1536
1552
|
)
|
|
1537
1553
|
}
|
|
@@ -1543,24 +1559,24 @@ const us = ({
|
|
|
1543
1559
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1544
1560
|
{
|
|
1545
1561
|
// In direct conversation mode, always show (full width)
|
|
1546
|
-
flex:
|
|
1562
|
+
flex: B || K,
|
|
1547
1563
|
// Normal mode: hide on mobile when no channel selected
|
|
1548
|
-
"hidden lg:flex": !
|
|
1564
|
+
"hidden lg:flex": !B && !K
|
|
1549
1565
|
}
|
|
1550
1566
|
),
|
|
1551
1567
|
children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1552
|
-
|
|
1568
|
+
we,
|
|
1553
1569
|
{
|
|
1554
1570
|
channel: I,
|
|
1555
|
-
onBack:
|
|
1556
|
-
showBackButton: !
|
|
1571
|
+
onBack: Ie,
|
|
1572
|
+
showBackButton: !B,
|
|
1557
1573
|
renderMessageInputActions: n,
|
|
1558
|
-
onLeaveConversation:
|
|
1559
|
-
onBlockParticipant:
|
|
1574
|
+
onLeaveConversation: pe,
|
|
1575
|
+
onBlockParticipant: Re,
|
|
1560
1576
|
CustomChannelEmptyState: c
|
|
1561
1577
|
},
|
|
1562
1578
|
I.id
|
|
1563
|
-
) }) : /* @__PURE__ */ e(
|
|
1579
|
+
) }) : /* @__PURE__ */ e(ye, { hasChannels: R })
|
|
1564
1580
|
}
|
|
1565
1581
|
)
|
|
1566
1582
|
] }),
|
|
@@ -1568,34 +1584,32 @@ const us = ({
|
|
|
1568
1584
|
/* @__PURE__ */ e(
|
|
1569
1585
|
"dialog",
|
|
1570
1586
|
{
|
|
1571
|
-
ref:
|
|
1587
|
+
ref: W,
|
|
1572
1588
|
className: "mes-dialog",
|
|
1573
|
-
onClick:
|
|
1574
|
-
|
|
1575
|
-
},
|
|
1576
|
-
onClose: te,
|
|
1589
|
+
onClick: Se,
|
|
1590
|
+
onClose: X,
|
|
1577
1591
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1578
|
-
|
|
1592
|
+
fs,
|
|
1579
1593
|
{
|
|
1580
1594
|
participantSource: J,
|
|
1581
|
-
onSelectParticipant:
|
|
1582
|
-
onClose:
|
|
1583
|
-
existingParticipantIds:
|
|
1584
|
-
participantLabel:
|
|
1585
|
-
searchPlaceholder: `Search ${
|
|
1595
|
+
onSelectParticipant: ke,
|
|
1596
|
+
onClose: X,
|
|
1597
|
+
existingParticipantIds: x,
|
|
1598
|
+
participantLabel: _,
|
|
1599
|
+
searchPlaceholder: `Search ${_}...`
|
|
1586
1600
|
},
|
|
1587
|
-
|
|
1601
|
+
z
|
|
1588
1602
|
) })
|
|
1589
1603
|
}
|
|
1590
1604
|
)
|
|
1591
1605
|
]
|
|
1592
1606
|
}
|
|
1593
1607
|
);
|
|
1594
|
-
},
|
|
1608
|
+
}, Cs = ({
|
|
1595
1609
|
question: t,
|
|
1596
1610
|
onClick: s,
|
|
1597
1611
|
loading: n = !1,
|
|
1598
|
-
className:
|
|
1612
|
+
className: r
|
|
1599
1613
|
}) => /* @__PURE__ */ e(
|
|
1600
1614
|
"button",
|
|
1601
1615
|
{
|
|
@@ -1609,40 +1623,40 @@ const us = ({
|
|
|
1609
1623
|
"hover:brightness-95 active:brightness-90": !n,
|
|
1610
1624
|
"opacity-50 cursor-not-allowed": n
|
|
1611
1625
|
},
|
|
1612
|
-
|
|
1626
|
+
r
|
|
1613
1627
|
),
|
|
1614
1628
|
children: t
|
|
1615
1629
|
}
|
|
1616
|
-
),
|
|
1630
|
+
), ps = ({
|
|
1617
1631
|
faqs: t,
|
|
1618
1632
|
onFaqClick: s,
|
|
1619
1633
|
loadingFaqId: n,
|
|
1620
|
-
headerText:
|
|
1634
|
+
headerText: r,
|
|
1621
1635
|
className: a,
|
|
1622
|
-
avatarImage:
|
|
1623
|
-
avatarName:
|
|
1636
|
+
avatarImage: o,
|
|
1637
|
+
avatarName: l
|
|
1624
1638
|
}) => {
|
|
1625
|
-
const c = t.filter((m) => m.enabled).sort((m,
|
|
1626
|
-
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */
|
|
1627
|
-
(
|
|
1639
|
+
const c = t.filter((m) => m.enabled).sort((m, g) => (m.order ?? 0) - (g.order ?? 0));
|
|
1640
|
+
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1641
|
+
(o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1628
1642
|
q,
|
|
1629
1643
|
{
|
|
1630
|
-
id:
|
|
1631
|
-
name:
|
|
1632
|
-
image:
|
|
1644
|
+
id: l || "account",
|
|
1645
|
+
name: l || "Account",
|
|
1646
|
+
image: o,
|
|
1633
1647
|
size: 24,
|
|
1634
1648
|
shape: "circle"
|
|
1635
1649
|
}
|
|
1636
1650
|
) }),
|
|
1637
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ i(
|
|
1638
1652
|
"div",
|
|
1639
1653
|
{
|
|
1640
1654
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1641
1655
|
style: { backgroundColor: "#F1F0EE" },
|
|
1642
1656
|
children: [
|
|
1643
|
-
|
|
1657
|
+
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1644
1658
|
c.map((m) => /* @__PURE__ */ e(
|
|
1645
|
-
|
|
1659
|
+
Cs,
|
|
1646
1660
|
{
|
|
1647
1661
|
question: m.question,
|
|
1648
1662
|
onClick: () => s(m.id),
|
|
@@ -1654,59 +1668,59 @@ const us = ({
|
|
|
1654
1668
|
}
|
|
1655
1669
|
)
|
|
1656
1670
|
] }) });
|
|
1657
|
-
},
|
|
1658
|
-
const { initialSearch: n = "", pageSize:
|
|
1659
|
-
if (
|
|
1660
|
-
const d =
|
|
1661
|
-
c(!0),
|
|
1671
|
+
}, Rs = (t, s = {}) => {
|
|
1672
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l, c] = v(!1), [m, g] = v(null), [y, h] = v(n), [f, S] = v(!0), [b, w] = v(), E = M(async (R = !1, F) => {
|
|
1673
|
+
if (l) return;
|
|
1674
|
+
const d = F !== void 0 ? F : y;
|
|
1675
|
+
c(!0), g(null);
|
|
1662
1676
|
try {
|
|
1663
1677
|
const u = await t.loadParticipants({
|
|
1664
1678
|
search: d || void 0,
|
|
1665
|
-
limit:
|
|
1666
|
-
cursor: R ? void 0 :
|
|
1679
|
+
limit: r,
|
|
1680
|
+
cursor: R ? void 0 : b
|
|
1667
1681
|
});
|
|
1668
|
-
|
|
1669
|
-
(
|
|
1670
|
-
),
|
|
1682
|
+
o(
|
|
1683
|
+
(x) => R ? u.participants : [...x, ...u.participants]
|
|
1684
|
+
), S(u.hasMore), w(u.nextCursor);
|
|
1671
1685
|
} catch (u) {
|
|
1672
|
-
const
|
|
1673
|
-
x
|
|
1686
|
+
const x = u instanceof Error ? u.message : "Failed to load participants";
|
|
1687
|
+
g(x), console.error("[useParticipants] Load error:", u);
|
|
1674
1688
|
} finally {
|
|
1675
1689
|
c(!1);
|
|
1676
1690
|
}
|
|
1677
|
-
}, [t,
|
|
1678
|
-
f && !
|
|
1679
|
-
}, [f,
|
|
1680
|
-
h(R),
|
|
1681
|
-
}, [
|
|
1682
|
-
|
|
1683
|
-
}, [
|
|
1691
|
+
}, [t, y, b, r, l]), N = M(() => {
|
|
1692
|
+
f && !l && E(!1);
|
|
1693
|
+
}, [f, l, E]), I = M((R) => {
|
|
1694
|
+
h(R), w(void 0), E(!0, R);
|
|
1695
|
+
}, [E]), k = M(() => {
|
|
1696
|
+
w(void 0), E(!0);
|
|
1697
|
+
}, [E]);
|
|
1684
1698
|
return G(() => {
|
|
1685
|
-
|
|
1699
|
+
E(!0);
|
|
1686
1700
|
}, [t.loadParticipants]), {
|
|
1687
1701
|
participants: a,
|
|
1688
|
-
loading:
|
|
1702
|
+
loading: l,
|
|
1689
1703
|
error: m,
|
|
1690
|
-
searchQuery:
|
|
1704
|
+
searchQuery: y,
|
|
1691
1705
|
hasMore: f,
|
|
1692
1706
|
totalCount: t.totalCount,
|
|
1693
|
-
loadMore:
|
|
1707
|
+
loadMore: N,
|
|
1694
1708
|
search: I,
|
|
1695
|
-
refresh:
|
|
1709
|
+
refresh: k
|
|
1696
1710
|
};
|
|
1697
1711
|
};
|
|
1698
1712
|
export {
|
|
1699
1713
|
q as Avatar,
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1714
|
+
cs as ChannelEmptyState,
|
|
1715
|
+
Ne as ChannelList,
|
|
1716
|
+
we as ChannelView,
|
|
1717
|
+
ps as FaqList,
|
|
1718
|
+
Cs as FaqListItem,
|
|
1719
|
+
ks as MessagingProvider,
|
|
1706
1720
|
Ss as MessagingShell,
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1721
|
+
fs as ParticipantPicker,
|
|
1722
|
+
es as formatRelativeTime,
|
|
1723
|
+
Xe as useMessaging,
|
|
1724
|
+
Rs as useParticipants
|
|
1711
1725
|
};
|
|
1712
1726
|
//# sourceMappingURL=index.js.map
|