@linktr.ee/messaging-react 1.3.0 → 1.4.0-rc-1761046174
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 +9 -0
- package/dist/index.js +741 -681
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +1 -1
- package/src/components/ChannelView.tsx +7 -2
- package/src/components/MessagingShell/EmptyState.tsx +1 -1
- package/src/components/MessagingShell/ErrorState.tsx +18 -20
- package/src/components/MessagingShell/LoadingState.tsx +1 -1
- package/src/components/MessagingShell/index.tsx +103 -12
- package/src/components/ParticipantPicker/ParticipantPicker.tsx +6 -1
- package/src/types.ts +10 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { NotePencilIcon as
|
|
7
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
+
import T from "classnames";
|
|
3
|
+
import X, { createContext as xe, useContext as Ne, useCallback as O, useState as v, useRef as H, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as Ce } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as be, useChatContext as ve, ChannelList as we, Channel as Ee, Window as Ie, MessageList as ye, useChannelStateContext as Se, MessageInput as Re } from "stream-chat-react";
|
|
6
|
+
import { NotePencilIcon as ke, XIcon as de, ArrowLeftIcon as De, DotsThreeIcon as Pe, SpinnerGapIcon as J, SignOutIcon as Te, ProhibitInsetIcon as ae, FlagIcon as Oe, MagnifyingGlassIcon as Ue, ChatCircleDotsIcon as ie } from "@phosphor-icons/react";
|
|
7
|
+
const ue = xe({
|
|
8
8
|
service: null,
|
|
9
9
|
client: null,
|
|
10
10
|
isConnected: !1,
|
|
@@ -15,229 +15,229 @@ const ae = ue({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), K = () => Ne(ue), Je = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
|
-
serviceConfig:
|
|
22
|
-
apiKey:
|
|
21
|
+
serviceConfig: r,
|
|
22
|
+
apiKey: o,
|
|
23
23
|
capabilities: a = {},
|
|
24
|
-
customization:
|
|
25
|
-
debug:
|
|
24
|
+
customization: d = {},
|
|
25
|
+
debug: h = !1
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
(
|
|
29
|
-
|
|
27
|
+
const n = O(
|
|
28
|
+
(C, ...R) => {
|
|
29
|
+
h && console.log(`🔥 [MessagingProvider] ${C}`, ...R);
|
|
30
30
|
},
|
|
31
|
-
[
|
|
31
|
+
[h]
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
n("🔄 RENDER START", {
|
|
34
34
|
userId: s == null ? void 0 : s.id,
|
|
35
|
-
apiKey: (
|
|
36
|
-
serviceConfig: !!
|
|
35
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
36
|
+
serviceConfig: !!r,
|
|
37
37
|
capabilities: Object.keys(a),
|
|
38
|
-
customization: Object.keys(
|
|
38
|
+
customization: Object.keys(d)
|
|
39
39
|
});
|
|
40
|
-
const [
|
|
40
|
+
const [l, w] = v(null), [f, b] = v(null), [i, N] = v(!1), [g, y] = v(!1), [E, U] = v(null), D = H(!1), I = H({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
|
-
apiKey:
|
|
43
|
-
serviceConfig:
|
|
42
|
+
apiKey: o,
|
|
43
|
+
serviceConfig: r,
|
|
44
44
|
capabilities: a,
|
|
45
|
-
customization:
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
renderCount:
|
|
49
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
45
|
+
customization: d
|
|
46
|
+
}), S = H(0);
|
|
47
|
+
S.current++, n("📊 RENDER INFO", {
|
|
48
|
+
renderCount: S.current,
|
|
49
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
50
50
|
propChanges: {
|
|
51
|
-
userChanged:
|
|
52
|
-
apiKeyChanged:
|
|
53
|
-
serviceConfigChanged:
|
|
54
|
-
capabilitiesChanged:
|
|
55
|
-
customizationChanged:
|
|
51
|
+
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
52
|
+
apiKeyChanged: I.current.apiKey !== o,
|
|
53
|
+
serviceConfigChanged: I.current.serviceConfig !== r,
|
|
54
|
+
capabilitiesChanged: I.current.capabilities !== a,
|
|
55
|
+
customizationChanged: I.current.customization !== d
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), I.current = {
|
|
58
58
|
userId: s == null ? void 0 : s.id,
|
|
59
|
-
apiKey:
|
|
60
|
-
serviceConfig:
|
|
59
|
+
apiKey: o,
|
|
60
|
+
serviceConfig: r,
|
|
61
61
|
capabilities: a,
|
|
62
|
-
customization:
|
|
63
|
-
},
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
renderCount:
|
|
67
|
-
apiKey: !!
|
|
68
|
-
serviceConfig: !!
|
|
62
|
+
customization: d
|
|
63
|
+
}, G(() => {
|
|
64
|
+
const C = S.current;
|
|
65
|
+
if (n("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
66
|
+
renderCount: C,
|
|
67
|
+
apiKey: !!o,
|
|
68
|
+
serviceConfig: !!r,
|
|
69
69
|
dependencies: {
|
|
70
|
-
apiKey: (
|
|
71
|
-
serviceConfigRef:
|
|
72
|
-
serviceConfigStable:
|
|
73
|
-
apiKeyStable:
|
|
70
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
71
|
+
serviceConfigRef: r,
|
|
72
|
+
serviceConfigStable: I.current.serviceConfig === r,
|
|
73
|
+
apiKeyStable: I.current.apiKey === o
|
|
74
74
|
}
|
|
75
|
-
}), !
|
|
76
|
-
|
|
77
|
-
renderCount:
|
|
75
|
+
}), !o || !r) {
|
|
76
|
+
n("⚠️ SERVICE INIT SKIPPED", {
|
|
77
|
+
renderCount: C,
|
|
78
78
|
reason: "Missing apiKey or serviceConfig"
|
|
79
79
|
});
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
renderCount:
|
|
84
|
-
apiKey: (
|
|
85
|
-
serviceConfigChanged:
|
|
82
|
+
n("🚀 CREATING NEW SERVICE", {
|
|
83
|
+
renderCount: C,
|
|
84
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
85
|
+
serviceConfigChanged: I.current.serviceConfig !== r
|
|
86
86
|
});
|
|
87
|
-
const
|
|
88
|
-
...
|
|
89
|
-
apiKey:
|
|
90
|
-
debug:
|
|
87
|
+
const R = new Ce({
|
|
88
|
+
...r,
|
|
89
|
+
apiKey: o,
|
|
90
|
+
debug: h
|
|
91
91
|
});
|
|
92
|
-
return w(
|
|
93
|
-
renderCount:
|
|
94
|
-
serviceInstance: !!
|
|
92
|
+
return w(R), n("✅ SERVICE SET", {
|
|
93
|
+
renderCount: C,
|
|
94
|
+
serviceInstance: !!R
|
|
95
95
|
}), () => {
|
|
96
|
-
|
|
97
|
-
renderCount:
|
|
96
|
+
n("🧹 SERVICE CLEANUP", {
|
|
97
|
+
renderCount: C,
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
|
-
}),
|
|
99
|
+
}), R.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
|
-
}, [
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
106
|
-
hasService: !!
|
|
101
|
+
}, [o, r, h, n]);
|
|
102
|
+
const P = H(null);
|
|
103
|
+
G(() => {
|
|
104
|
+
var R, $;
|
|
105
|
+
if (n("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
106
|
+
hasService: !!l,
|
|
107
107
|
hasUser: !!s,
|
|
108
108
|
userId: s == null ? void 0 : s.id,
|
|
109
|
-
isConnecting:
|
|
110
|
-
isConnected:
|
|
111
|
-
dependencies: { service: !!
|
|
112
|
-
}), !
|
|
113
|
-
|
|
109
|
+
isConnecting: D.current,
|
|
110
|
+
isConnected: i,
|
|
111
|
+
dependencies: { service: !!l, userId: s == null ? void 0 : s.id }
|
|
112
|
+
}), !l || !s) {
|
|
113
|
+
n("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
116
|
+
if (D.current) {
|
|
117
|
+
n("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (((
|
|
121
|
-
|
|
120
|
+
if (((R = P.current) == null ? void 0 : R.serviceId) === l && (($ = P.current) == null ? void 0 : $.userId) === s.id) {
|
|
121
|
+
n(
|
|
122
122
|
"⚠️ USER CONNECTION SKIPPED",
|
|
123
123
|
"Already connected this user with this service"
|
|
124
124
|
);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
(async () => {
|
|
128
|
-
|
|
128
|
+
n("🚀 STARTING USER CONNECTION", { userId: s.id }), D.current = !0, y(!0), U(null);
|
|
129
129
|
try {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
130
|
+
n("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
131
|
+
const L = await l.connectUser(s);
|
|
132
|
+
b(L), N(!0), P.current = { serviceId: l, userId: s.id }, n("✅ USER CONNECTION SUCCESS", {
|
|
133
133
|
userId: s.id,
|
|
134
|
-
clientId:
|
|
134
|
+
clientId: L.userID
|
|
135
135
|
});
|
|
136
|
-
} catch (
|
|
137
|
-
const
|
|
138
|
-
|
|
136
|
+
} catch (L) {
|
|
137
|
+
const _ = L instanceof Error ? L.message : "Connection failed";
|
|
138
|
+
U(_), n("❌ USER CONNECTION ERROR", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
error:
|
|
140
|
+
error: _
|
|
141
141
|
});
|
|
142
142
|
} finally {
|
|
143
|
-
y(!1),
|
|
143
|
+
y(!1), D.current = !1, n("🔄 USER CONNECTION FINISHED", {
|
|
144
144
|
userId: s.id,
|
|
145
|
-
isConnected:
|
|
145
|
+
isConnected: i
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
})();
|
|
149
|
-
}, [
|
|
150
|
-
hasService: !!
|
|
151
|
-
isConnected:
|
|
149
|
+
}, [l, s, n, i]), G(() => (n("🔌 CLEANUP EFFECT REGISTERED", {
|
|
150
|
+
hasService: !!l,
|
|
151
|
+
isConnected: i
|
|
152
152
|
}), () => {
|
|
153
|
-
|
|
153
|
+
l && i ? (n(
|
|
154
154
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
155
155
|
"Cleaning up connection on unmount"
|
|
156
|
-
),
|
|
157
|
-
hasService: !!
|
|
158
|
-
isConnected:
|
|
156
|
+
), P.current = null, l.disconnectUser().catch(console.error)) : n("🔇 CLEANUP EFFECT SKIPPED", {
|
|
157
|
+
hasService: !!l,
|
|
158
|
+
isConnected: i
|
|
159
159
|
});
|
|
160
|
-
}), [
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
hasService: !!
|
|
160
|
+
}), [l, i, n]);
|
|
161
|
+
const m = O(async () => {
|
|
162
|
+
if (n("🔄 REFRESH CONNECTION CALLED", {
|
|
163
|
+
hasService: !!l,
|
|
164
164
|
hasUser: !!s
|
|
165
|
-
}), !
|
|
166
|
-
|
|
165
|
+
}), !l || !s) {
|
|
166
|
+
n("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
n("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
|
|
170
170
|
try {
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
} catch (
|
|
175
|
-
const
|
|
176
|
-
|
|
171
|
+
n("🔌 DISCONNECTING FOR REFRESH"), await l.disconnectUser(), n("📞 RECONNECTING FOR REFRESH");
|
|
172
|
+
const C = await l.connectUser(s);
|
|
173
|
+
b(C), N(!0), U(null), n("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
174
|
+
} catch (C) {
|
|
175
|
+
const R = C instanceof Error ? C.message : "Refresh failed";
|
|
176
|
+
U(R), n("❌ CONNECTION REFRESH ERROR", {
|
|
177
177
|
userId: s.id,
|
|
178
|
-
error:
|
|
178
|
+
error: R
|
|
179
179
|
});
|
|
180
180
|
} finally {
|
|
181
|
-
y(!1),
|
|
181
|
+
y(!1), n("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
182
182
|
}
|
|
183
|
-
}, [
|
|
184
|
-
hasService: !!
|
|
185
|
-
hasClient: !!
|
|
186
|
-
isConnected:
|
|
187
|
-
isLoading:
|
|
188
|
-
hasError: !!
|
|
183
|
+
}, [l, s, n]), u = X.useMemo(() => (n("💫 CONTEXT VALUE MEMOIZATION", {
|
|
184
|
+
hasService: !!l,
|
|
185
|
+
hasClient: !!f,
|
|
186
|
+
isConnected: i,
|
|
187
|
+
isLoading: g,
|
|
188
|
+
hasError: !!E,
|
|
189
189
|
capabilitiesKeys: Object.keys(a),
|
|
190
|
-
customizationKeys: Object.keys(
|
|
190
|
+
customizationKeys: Object.keys(d)
|
|
191
191
|
}), {
|
|
192
|
-
service:
|
|
193
|
-
client:
|
|
194
|
-
isConnected:
|
|
195
|
-
isLoading:
|
|
196
|
-
error:
|
|
192
|
+
service: l,
|
|
193
|
+
client: f,
|
|
194
|
+
isConnected: i,
|
|
195
|
+
isLoading: g,
|
|
196
|
+
error: E,
|
|
197
197
|
capabilities: a,
|
|
198
|
-
customization:
|
|
199
|
-
refreshConnection:
|
|
200
|
-
debug:
|
|
198
|
+
customization: d,
|
|
199
|
+
refreshConnection: m,
|
|
200
|
+
debug: h
|
|
201
201
|
}), [
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
l,
|
|
203
|
+
f,
|
|
204
|
+
i,
|
|
205
|
+
g,
|
|
206
|
+
E,
|
|
207
207
|
a,
|
|
208
|
-
m,
|
|
209
|
-
u,
|
|
210
208
|
d,
|
|
211
|
-
|
|
209
|
+
m,
|
|
210
|
+
h,
|
|
211
|
+
n
|
|
212
212
|
]);
|
|
213
|
-
return
|
|
214
|
-
renderCount:
|
|
215
|
-
willRenderChat: !!(
|
|
216
|
-
contextValueReady: !!
|
|
217
|
-
}), /* @__PURE__ */ e(
|
|
218
|
-
},
|
|
219
|
-
function
|
|
220
|
-
return /* @__PURE__ */
|
|
213
|
+
return n("🔄 RENDER END", {
|
|
214
|
+
renderCount: S.current,
|
|
215
|
+
willRenderChat: !!(f && i),
|
|
216
|
+
contextValueReady: !!u
|
|
217
|
+
}), /* @__PURE__ */ e(ue.Provider, { value: u, children: f && i ? /* @__PURE__ */ e(be, { client: f, children: t }) : t });
|
|
218
|
+
}, Me = () => K();
|
|
219
|
+
function ee({ label: t, className: s, children: r, ...o }) {
|
|
220
|
+
return /* @__PURE__ */ c(
|
|
221
221
|
"button",
|
|
222
222
|
{
|
|
223
223
|
type: "button",
|
|
224
|
-
className:
|
|
224
|
+
className: T(
|
|
225
225
|
"rounded-full p-2 transition-colors focus-ring",
|
|
226
226
|
{
|
|
227
|
-
"cursor-not-allowed opacity-50":
|
|
228
|
-
"hover:bg-sand": !
|
|
227
|
+
"cursor-not-allowed opacity-50": o.disabled,
|
|
228
|
+
"hover:bg-sand": !o.disabled
|
|
229
229
|
},
|
|
230
230
|
s
|
|
231
231
|
),
|
|
232
|
-
...
|
|
232
|
+
...o,
|
|
233
233
|
children: [
|
|
234
234
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
235
|
-
|
|
235
|
+
r
|
|
236
236
|
]
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Le(t) {
|
|
241
241
|
const s = [
|
|
242
242
|
{ color: "#8129D9" },
|
|
243
243
|
// purple
|
|
@@ -264,32 +264,32 @@ function Te(t) {
|
|
|
264
264
|
{ color: "#70764d" }
|
|
265
265
|
// olive green
|
|
266
266
|
];
|
|
267
|
-
let
|
|
267
|
+
let r = 0;
|
|
268
268
|
for (let a = 0; a < t.length; a++)
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
return s[
|
|
269
|
+
r = (r << 5) - r + t.charCodeAt(a), r = r & r;
|
|
270
|
+
const o = Math.abs(r) % s.length;
|
|
271
|
+
return s[o];
|
|
272
272
|
}
|
|
273
|
-
const
|
|
273
|
+
const se = ({
|
|
274
274
|
id: t,
|
|
275
275
|
name: s,
|
|
276
|
-
image:
|
|
277
|
-
size:
|
|
276
|
+
image: r,
|
|
277
|
+
size: o = 40,
|
|
278
278
|
className: a
|
|
279
279
|
}) => {
|
|
280
|
-
const { color:
|
|
280
|
+
const { color: d } = Le(t), h = s.charAt(0).toUpperCase(), l = o < 32 ? "text-xs" : o < 56 ? "text-sm" : "text-lg";
|
|
281
281
|
return /* @__PURE__ */ e(
|
|
282
282
|
"div",
|
|
283
283
|
{
|
|
284
|
-
className:
|
|
284
|
+
className: T(
|
|
285
285
|
"flex-shrink-0 overflow-hidden rounded-full",
|
|
286
286
|
a
|
|
287
287
|
),
|
|
288
|
-
style: { width: `${
|
|
289
|
-
children:
|
|
288
|
+
style: { width: `${o}px`, height: `${o}px` },
|
|
289
|
+
children: r ? /* @__PURE__ */ e(
|
|
290
290
|
"img",
|
|
291
291
|
{
|
|
292
|
-
src:
|
|
292
|
+
src: r,
|
|
293
293
|
alt: "",
|
|
294
294
|
className: "h-full w-full object-cover aspect-square"
|
|
295
295
|
}
|
|
@@ -297,159 +297,159 @@ const Y = ({
|
|
|
297
297
|
"div",
|
|
298
298
|
{
|
|
299
299
|
"aria-hidden": "true",
|
|
300
|
-
className:
|
|
300
|
+
className: T(
|
|
301
301
|
"flex h-full w-full items-center justify-center font-semibold",
|
|
302
|
-
|
|
302
|
+
l
|
|
303
303
|
),
|
|
304
304
|
style: {
|
|
305
|
-
color:
|
|
306
|
-
backgroundColor: `color-mix(in srgb, ${
|
|
305
|
+
color: d,
|
|
306
|
+
backgroundColor: `color-mix(in srgb, ${d} 20%, transparent)`
|
|
307
307
|
},
|
|
308
|
-
children:
|
|
308
|
+
children: h
|
|
309
309
|
}
|
|
310
310
|
)
|
|
311
311
|
}
|
|
312
312
|
);
|
|
313
|
-
},
|
|
314
|
-
var
|
|
315
|
-
const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id),
|
|
316
|
-
t &&
|
|
317
|
-
},
|
|
318
|
-
(
|
|
319
|
-
var
|
|
320
|
-
return ((
|
|
313
|
+
}, Fe = ({ channel: t, selectedChannel: s, onChannelSelect: r, debug: o = !1 }) => {
|
|
314
|
+
var g, y, E, U, D, I, S;
|
|
315
|
+
const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
|
|
316
|
+
t && r(t);
|
|
317
|
+
}, n = Object.values(((g = t == null ? void 0 : t.state) == null ? void 0 : g.members) || {}).find(
|
|
318
|
+
(P) => {
|
|
319
|
+
var m, u;
|
|
320
|
+
return ((m = P.user) == null ? void 0 : m.id) && P.user.id !== ((u = t == null ? void 0 : t._client) == null ? void 0 : u.userID);
|
|
321
321
|
}
|
|
322
|
-
),
|
|
322
|
+
), l = ((y = n == null ? void 0 : n.user) == null ? void 0 : y.name) || "Conversation", w = (E = n == null ? void 0 : n.user) == null ? void 0 : E.image, f = (D = (U = t == null ? void 0 : t.state) == null ? void 0 : U.messages) == null ? void 0 : D[t.state.messages.length - 1], b = (f == null ? void 0 : f.text) || "No messages yet", i = f != null && f.created_at ? new Date(f.created_at).toLocaleTimeString([], {
|
|
323
323
|
hour: "2-digit",
|
|
324
324
|
minute: "2-digit"
|
|
325
|
-
}) : "",
|
|
326
|
-
return
|
|
325
|
+
}) : "", N = ((I = t == null ? void 0 : t.state) == null ? void 0 : I.unreadCount) || 0;
|
|
326
|
+
return o && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
327
327
|
channelId: t == null ? void 0 : t.id,
|
|
328
328
|
isSelected: a,
|
|
329
|
-
participantName:
|
|
330
|
-
unread:
|
|
331
|
-
hasTimestamp: !!
|
|
329
|
+
participantName: l,
|
|
330
|
+
unread: N,
|
|
331
|
+
hasTimestamp: !!i
|
|
332
332
|
}), /* @__PURE__ */ e(
|
|
333
333
|
"button",
|
|
334
334
|
{
|
|
335
335
|
type: "button",
|
|
336
|
-
onClick:
|
|
337
|
-
className:
|
|
336
|
+
onClick: d,
|
|
337
|
+
className: T(
|
|
338
338
|
"w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
339
339
|
{
|
|
340
340
|
"bg-primary-alt/10 border-l-4 border-l-primary": a,
|
|
341
341
|
"hover:bg-sand": !a
|
|
342
342
|
}
|
|
343
343
|
),
|
|
344
|
-
children: /* @__PURE__ */
|
|
344
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
|
|
345
345
|
/* @__PURE__ */ e(
|
|
346
|
-
|
|
346
|
+
se,
|
|
347
347
|
{
|
|
348
|
-
id: ((
|
|
349
|
-
name:
|
|
348
|
+
id: ((S = n == null ? void 0 : n.user) == null ? void 0 : S.id) || t.id || "unknown",
|
|
349
|
+
name: l,
|
|
350
350
|
image: w,
|
|
351
351
|
size: 44
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
355
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
|
|
356
356
|
/* @__PURE__ */ e(
|
|
357
357
|
"h3",
|
|
358
358
|
{
|
|
359
|
-
className:
|
|
359
|
+
className: T(
|
|
360
360
|
"text-sm font-medium truncate",
|
|
361
361
|
a ? "text-primary" : "text-charcoal"
|
|
362
362
|
),
|
|
363
|
-
children:
|
|
363
|
+
children: l
|
|
364
364
|
}
|
|
365
365
|
),
|
|
366
|
-
|
|
366
|
+
i && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: i })
|
|
367
367
|
] }),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
370
|
-
|
|
368
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
369
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: b }),
|
|
370
|
+
N > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: N > 99 ? "99+" : N })
|
|
371
371
|
] })
|
|
372
372
|
] })
|
|
373
373
|
] })
|
|
374
374
|
}
|
|
375
375
|
);
|
|
376
|
-
},
|
|
376
|
+
}, pe = ({
|
|
377
377
|
onChannelSelect: t,
|
|
378
378
|
selectedChannel: s,
|
|
379
|
-
showStartConversation:
|
|
380
|
-
onStartConversation:
|
|
379
|
+
showStartConversation: r = !1,
|
|
380
|
+
onStartConversation: o,
|
|
381
381
|
participantLabel: a = "participants",
|
|
382
|
-
className:
|
|
382
|
+
className: d
|
|
383
383
|
}) => {
|
|
384
|
-
var
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
const { debug:
|
|
388
|
-
|
|
389
|
-
renderCount:
|
|
384
|
+
var f;
|
|
385
|
+
const h = X.useRef(0);
|
|
386
|
+
h.current++;
|
|
387
|
+
const { debug: n = !1 } = K();
|
|
388
|
+
n && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
389
|
+
renderCount: h.current,
|
|
390
390
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
391
|
-
showStartConversation:
|
|
391
|
+
showStartConversation: r,
|
|
392
392
|
participantLabel: a
|
|
393
393
|
});
|
|
394
|
-
const { client:
|
|
395
|
-
|
|
396
|
-
renderCount:
|
|
397
|
-
hasClient: !!
|
|
398
|
-
clientUserId:
|
|
399
|
-
clientConnected: (
|
|
394
|
+
const { client: l } = ve();
|
|
395
|
+
n && console.log("📺 [ChannelList] 📡 CHAT CONTEXT", {
|
|
396
|
+
renderCount: h.current,
|
|
397
|
+
hasClient: !!l,
|
|
398
|
+
clientUserId: l == null ? void 0 : l.userID,
|
|
399
|
+
clientConnected: (f = l == null ? void 0 : l.wsConnection) == null ? void 0 : f.isHealthy
|
|
400
400
|
});
|
|
401
|
-
const w =
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
renderCount:
|
|
405
|
-
userId:
|
|
406
|
-
filters:
|
|
407
|
-
}),
|
|
408
|
-
}, [
|
|
409
|
-
return /* @__PURE__ */
|
|
401
|
+
const w = X.useMemo(() => {
|
|
402
|
+
const b = l.userID, i = b ? { type: "messaging", members: { $in: [b] }, hidden: !1 } : { type: "messaging" };
|
|
403
|
+
return n && console.log("📺 [ChannelList] 🔍 FILTERS MEMOIZED", {
|
|
404
|
+
renderCount: h.current,
|
|
405
|
+
userId: b,
|
|
406
|
+
filters: i
|
|
407
|
+
}), i;
|
|
408
|
+
}, [l.userID, n]);
|
|
409
|
+
return /* @__PURE__ */ c(
|
|
410
410
|
"div",
|
|
411
411
|
{
|
|
412
|
-
className:
|
|
413
|
-
"h-full flex flex-col min-w-0 overflow-hidden",
|
|
414
|
-
|
|
412
|
+
className: T(
|
|
413
|
+
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
414
|
+
d
|
|
415
415
|
),
|
|
416
416
|
children: [
|
|
417
|
-
/* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
|
|
418
418
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
|
|
419
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children:
|
|
420
|
-
|
|
419
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: r && o && /* @__PURE__ */ e(
|
|
420
|
+
ee,
|
|
421
421
|
{
|
|
422
422
|
label: "Start a new conversation",
|
|
423
|
-
onClick:
|
|
423
|
+
onClick: o,
|
|
424
424
|
className: "inline-flex size-10 items-center justify-center",
|
|
425
|
-
children: /* @__PURE__ */ e(
|
|
425
|
+
children: /* @__PURE__ */ e(ke, { className: "h-5 w-5" })
|
|
426
426
|
}
|
|
427
427
|
) })
|
|
428
428
|
] }) }),
|
|
429
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (
|
|
430
|
-
renderCount:
|
|
429
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (n && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
|
|
430
|
+
renderCount: h.current,
|
|
431
431
|
filters: w,
|
|
432
|
-
hasClient: !!
|
|
433
|
-
clientUserId:
|
|
432
|
+
hasClient: !!l,
|
|
433
|
+
clientUserId: l == null ? void 0 : l.userID
|
|
434
434
|
}), /* @__PURE__ */ e(
|
|
435
|
-
|
|
435
|
+
we,
|
|
436
436
|
{
|
|
437
437
|
filters: w,
|
|
438
438
|
sort: { last_message_at: -1 },
|
|
439
439
|
options: { limit: 30 },
|
|
440
|
-
Preview: (
|
|
441
|
-
var
|
|
442
|
-
return
|
|
443
|
-
channelId: (
|
|
440
|
+
Preview: (b) => {
|
|
441
|
+
var i, N;
|
|
442
|
+
return n && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
443
|
+
channelId: (i = b.channel) == null ? void 0 : i.id,
|
|
444
444
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
445
|
-
isSelected: (s == null ? void 0 : s.id) === ((
|
|
445
|
+
isSelected: (s == null ? void 0 : s.id) === ((N = b.channel) == null ? void 0 : N.id)
|
|
446
446
|
}), /* @__PURE__ */ e(
|
|
447
|
-
|
|
447
|
+
Fe,
|
|
448
448
|
{
|
|
449
|
-
...
|
|
449
|
+
...b,
|
|
450
450
|
selectedChannel: s,
|
|
451
451
|
onChannelSelect: t,
|
|
452
|
-
debug:
|
|
452
|
+
debug: n
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
455
|
}
|
|
@@ -458,145 +458,145 @@ const Y = ({
|
|
|
458
458
|
]
|
|
459
459
|
}
|
|
460
460
|
);
|
|
461
|
-
},
|
|
461
|
+
}, Y = ({
|
|
462
462
|
variant: t = "default",
|
|
463
463
|
className: s,
|
|
464
|
-
children:
|
|
465
|
-
...
|
|
464
|
+
children: r,
|
|
465
|
+
...o
|
|
466
466
|
}) => /* @__PURE__ */ e(
|
|
467
467
|
"button",
|
|
468
468
|
{
|
|
469
469
|
type: "button",
|
|
470
|
-
className:
|
|
470
|
+
className: T(
|
|
471
471
|
"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",
|
|
472
472
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
473
473
|
s
|
|
474
474
|
),
|
|
475
|
-
...
|
|
476
|
-
children:
|
|
475
|
+
...o,
|
|
476
|
+
children: r
|
|
477
477
|
}
|
|
478
478
|
);
|
|
479
|
-
function
|
|
480
|
-
return /* @__PURE__ */ e(
|
|
479
|
+
function me({ onClick: t }) {
|
|
480
|
+
return /* @__PURE__ */ e(ee, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
481
481
|
}
|
|
482
|
-
const
|
|
482
|
+
const je = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
483
483
|
t && t(),
|
|
484
|
-
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
485
|
-
] }),
|
|
486
|
-
var
|
|
487
|
-
const { channel: a } =
|
|
488
|
-
(
|
|
489
|
-
var
|
|
490
|
-
return ((
|
|
484
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Re, { focus: !0, maxRows: 4 }) })
|
|
485
|
+
] }), Be = ({ onBack: t, showBackButton: s, onShowInfo: r, canShowInfo: o }) => {
|
|
486
|
+
var l, w, f, b;
|
|
487
|
+
const { channel: a } = Se(), d = X.useMemo(() => Object.values(a.state.members || {}).find(
|
|
488
|
+
(N) => {
|
|
489
|
+
var g;
|
|
490
|
+
return ((g = N.user) == null ? void 0 : g.id) && N.user.id !== a._client.userID;
|
|
491
491
|
}
|
|
492
|
-
), [a._client.userID, a.state.members]),
|
|
493
|
-
return /* @__PURE__ */
|
|
494
|
-
/* @__PURE__ */
|
|
492
|
+
), [a._client.userID, a.state.members]), h = ((l = d == null ? void 0 : d.user) == null ? void 0 : l.name) || ((w = d == null ? void 0 : d.user) == null ? void 0 : w.id) || "Unknown member", n = (f = d == null ? void 0 : d.user) == null ? void 0 : f.image;
|
|
493
|
+
return /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
|
|
494
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
495
495
|
s && t && /* @__PURE__ */ e(
|
|
496
496
|
"button",
|
|
497
497
|
{
|
|
498
498
|
type: "button",
|
|
499
499
|
onClick: t,
|
|
500
500
|
className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
|
|
501
|
-
"aria-label": "Back to
|
|
502
|
-
children: /* @__PURE__ */ e(
|
|
501
|
+
"aria-label": "Back to conversations",
|
|
502
|
+
children: /* @__PURE__ */ e(De, { className: "h-5 w-5 text-stone", weight: "bold" })
|
|
503
503
|
}
|
|
504
504
|
),
|
|
505
505
|
/* @__PURE__ */ e(
|
|
506
|
-
|
|
506
|
+
se,
|
|
507
507
|
{
|
|
508
|
-
id: ((
|
|
509
|
-
name:
|
|
510
|
-
image:
|
|
508
|
+
id: ((b = d == null ? void 0 : d.user) == null ? void 0 : b.id) || a.id || "unknown",
|
|
509
|
+
name: h,
|
|
510
|
+
image: n,
|
|
511
511
|
size: 40
|
|
512
512
|
}
|
|
513
513
|
),
|
|
514
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children:
|
|
514
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: h }) })
|
|
515
515
|
] }),
|
|
516
|
-
|
|
516
|
+
o && r && /* @__PURE__ */ e(ee, { label: "Chat info", onClick: r, children: /* @__PURE__ */ e(Pe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
|
|
517
517
|
] });
|
|
518
|
-
},
|
|
518
|
+
}, Ae = ({
|
|
519
519
|
isOpen: t,
|
|
520
520
|
onClose: s,
|
|
521
|
-
participant:
|
|
522
|
-
channel:
|
|
521
|
+
participant: r,
|
|
522
|
+
channel: o,
|
|
523
523
|
followerStatusLabel: a,
|
|
524
|
-
onLeaveConversation:
|
|
525
|
-
onBlockParticipant:
|
|
524
|
+
onLeaveConversation: d,
|
|
525
|
+
onBlockParticipant: h
|
|
526
526
|
}) => {
|
|
527
|
-
var
|
|
528
|
-
const { service:
|
|
529
|
-
|
|
527
|
+
var L, _, V, W, z, j, q;
|
|
528
|
+
const { service: n, debug: l } = K(), w = H(null), [f, b] = v(!1), [i, N] = v(!1), [g, y] = v(!1);
|
|
529
|
+
G(() => {
|
|
530
530
|
const k = w.current;
|
|
531
531
|
k && (t ? k.showModal() : k.close());
|
|
532
532
|
}, [t]);
|
|
533
|
-
const
|
|
533
|
+
const E = O(async () => {
|
|
534
534
|
var k;
|
|
535
|
-
if (!(!
|
|
535
|
+
if (!(!n || !((k = r == null ? void 0 : r.user) != null && k.id)))
|
|
536
536
|
try {
|
|
537
|
-
const
|
|
538
|
-
(
|
|
539
|
-
var
|
|
540
|
-
return
|
|
537
|
+
const B = (await n.getBlockedUsers()).some(
|
|
538
|
+
(A) => {
|
|
539
|
+
var Q;
|
|
540
|
+
return A.blocked_user_id === ((Q = r == null ? void 0 : r.user) == null ? void 0 : Q.id);
|
|
541
541
|
}
|
|
542
542
|
);
|
|
543
|
-
|
|
544
|
-
} catch (
|
|
543
|
+
b(B);
|
|
544
|
+
} catch (M) {
|
|
545
545
|
console.error(
|
|
546
546
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
547
|
-
|
|
547
|
+
M
|
|
548
548
|
);
|
|
549
549
|
}
|
|
550
|
-
}, [
|
|
551
|
-
|
|
552
|
-
t &&
|
|
553
|
-
}, [t,
|
|
554
|
-
const
|
|
550
|
+
}, [n, (L = r == null ? void 0 : r.user) == null ? void 0 : L.id]);
|
|
551
|
+
G(() => {
|
|
552
|
+
t && E();
|
|
553
|
+
}, [t, E]);
|
|
554
|
+
const U = async () => {
|
|
555
555
|
var k;
|
|
556
|
-
if (!
|
|
557
|
-
|
|
556
|
+
if (!i) {
|
|
557
|
+
l && console.log("[ChannelInfoDialog] Leave conversation", o.cid), N(!0);
|
|
558
558
|
try {
|
|
559
|
-
const
|
|
560
|
-
await
|
|
561
|
-
} catch (
|
|
562
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
559
|
+
const M = ((k = o._client) == null ? void 0 : k.userID) ?? null;
|
|
560
|
+
await o.hide(M, !1), d && await d(o), s();
|
|
561
|
+
} catch (M) {
|
|
562
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", M);
|
|
563
563
|
} finally {
|
|
564
|
-
|
|
564
|
+
N(!1);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
},
|
|
568
|
-
var k,
|
|
569
|
-
if (!(
|
|
570
|
-
|
|
567
|
+
}, D = async () => {
|
|
568
|
+
var k, M, B;
|
|
569
|
+
if (!(g || !n)) {
|
|
570
|
+
l && console.log("[ChannelInfoDialog] Block member", (k = r == null ? void 0 : r.user) == null ? void 0 : k.id), y(!0);
|
|
571
571
|
try {
|
|
572
|
-
await
|
|
573
|
-
} catch (
|
|
574
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
572
|
+
await n.blockUser((M = r == null ? void 0 : r.user) == null ? void 0 : M.id), h && await h((B = r == null ? void 0 : r.user) == null ? void 0 : B.id), s();
|
|
573
|
+
} catch (A) {
|
|
574
|
+
console.error("[ChannelInfoDialog] Failed to block member", A);
|
|
575
575
|
} finally {
|
|
576
576
|
y(!1);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
},
|
|
580
|
-
var k,
|
|
581
|
-
if (!(
|
|
582
|
-
|
|
579
|
+
}, I = async () => {
|
|
580
|
+
var k, M, B;
|
|
581
|
+
if (!(g || !n)) {
|
|
582
|
+
l && console.log("[ChannelInfoDialog] Unblock member", (k = r == null ? void 0 : r.user) == null ? void 0 : k.id), y(!0);
|
|
583
583
|
try {
|
|
584
|
-
await
|
|
585
|
-
} catch (
|
|
586
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
584
|
+
await n.unBlockUser((M = r == null ? void 0 : r.user) == null ? void 0 : M.id), h && await h((B = r == null ? void 0 : r.user) == null ? void 0 : B.id), s();
|
|
585
|
+
} catch (A) {
|
|
586
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", A);
|
|
587
587
|
} finally {
|
|
588
588
|
y(!1);
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
},
|
|
591
|
+
}, S = () => {
|
|
592
592
|
s(), window.open(
|
|
593
593
|
"https://linktr.ee/s/about/trust-center/report",
|
|
594
594
|
"_blank",
|
|
595
595
|
"noopener,noreferrer"
|
|
596
596
|
);
|
|
597
597
|
};
|
|
598
|
-
if (!
|
|
599
|
-
const
|
|
598
|
+
if (!r) return null;
|
|
599
|
+
const P = ((_ = r.user) == null ? void 0 : _.name) || ((V = r.user) == null ? void 0 : V.id) || "Unknown member", m = (W = r.user) == null ? void 0 : W.image, u = (z = r.user) == null ? void 0 : z.email, C = (j = r.user) == null ? void 0 : j.username, R = u || (C ? `linktr.ee/${C}` : void 0), $ = ((q = r.user) == null ? void 0 : q.id) || "unknown";
|
|
600
600
|
return (
|
|
601
601
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
602
602
|
/* @__PURE__ */ e(
|
|
@@ -608,66 +608,66 @@ const Ue = ({ renderActions: t }) => /* @__PURE__ */ i("div", { className: "mess
|
|
|
608
608
|
onClick: (k) => {
|
|
609
609
|
k.target === w.current && s();
|
|
610
610
|
},
|
|
611
|
-
children: /* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
611
|
+
children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
612
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
613
613
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
614
|
-
/* @__PURE__ */ e(
|
|
614
|
+
/* @__PURE__ */ e(me, { onClick: s })
|
|
615
615
|
] }),
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
|
|
617
|
+
/* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
618
618
|
/* @__PURE__ */ e(
|
|
619
|
-
|
|
619
|
+
se,
|
|
620
620
|
{
|
|
621
|
-
id:
|
|
622
|
-
name:
|
|
623
|
-
image:
|
|
621
|
+
id: $,
|
|
622
|
+
name: P,
|
|
623
|
+
image: m,
|
|
624
624
|
size: 64
|
|
625
625
|
}
|
|
626
626
|
),
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
629
|
-
|
|
627
|
+
/* @__PURE__ */ c("div", { className: "min-w-0 flex-1", children: [
|
|
628
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: P }),
|
|
629
|
+
R && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: R }),
|
|
630
630
|
a && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: a })
|
|
631
631
|
] })
|
|
632
632
|
] }) }),
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
635
|
-
|
|
633
|
+
/* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
634
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
|
|
635
|
+
Y,
|
|
636
636
|
{
|
|
637
|
-
onClick:
|
|
638
|
-
disabled:
|
|
639
|
-
"aria-busy":
|
|
637
|
+
onClick: U,
|
|
638
|
+
disabled: i,
|
|
639
|
+
"aria-busy": i,
|
|
640
640
|
children: [
|
|
641
|
-
|
|
641
|
+
i ? /* @__PURE__ */ e(J, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Te, { className: "h-5 w-5" }),
|
|
642
642
|
/* @__PURE__ */ e("span", { children: "Leave Conversation" })
|
|
643
643
|
]
|
|
644
644
|
}
|
|
645
645
|
) }),
|
|
646
|
-
/* @__PURE__ */ e("li", { children:
|
|
647
|
-
|
|
646
|
+
/* @__PURE__ */ e("li", { children: f ? /* @__PURE__ */ c(
|
|
647
|
+
Y,
|
|
648
648
|
{
|
|
649
|
-
onClick:
|
|
650
|
-
disabled:
|
|
651
|
-
"aria-busy":
|
|
649
|
+
onClick: I,
|
|
650
|
+
disabled: g,
|
|
651
|
+
"aria-busy": g,
|
|
652
652
|
children: [
|
|
653
|
-
|
|
653
|
+
g ? /* @__PURE__ */ e(J, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-5 w-5" }),
|
|
654
654
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
655
655
|
]
|
|
656
656
|
}
|
|
657
|
-
) : /* @__PURE__ */
|
|
658
|
-
|
|
657
|
+
) : /* @__PURE__ */ c(
|
|
658
|
+
Y,
|
|
659
659
|
{
|
|
660
|
-
onClick:
|
|
661
|
-
disabled:
|
|
662
|
-
"aria-busy":
|
|
660
|
+
onClick: D,
|
|
661
|
+
disabled: g,
|
|
662
|
+
"aria-busy": g,
|
|
663
663
|
children: [
|
|
664
|
-
|
|
664
|
+
g ? /* @__PURE__ */ e(J, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-5 w-5" }),
|
|
665
665
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
666
666
|
]
|
|
667
667
|
}
|
|
668
668
|
) }),
|
|
669
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */ e(
|
|
669
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(Y, { variant: "danger", onClick: S, children: [
|
|
670
|
+
/* @__PURE__ */ e(Oe, { className: "h-5 w-5" }),
|
|
671
671
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
672
672
|
] }) })
|
|
673
673
|
] })
|
|
@@ -676,66 +676,75 @@ const Ue = ({ renderActions: t }) => /* @__PURE__ */ i("div", { className: "mess
|
|
|
676
676
|
}
|
|
677
677
|
)
|
|
678
678
|
);
|
|
679
|
-
},
|
|
679
|
+
}, He = ({
|
|
680
680
|
channel: t,
|
|
681
681
|
onBack: s,
|
|
682
|
-
showBackButton:
|
|
683
|
-
renderMessageInputActions:
|
|
682
|
+
showBackButton: r = !1,
|
|
683
|
+
renderMessageInputActions: o,
|
|
684
684
|
onLeaveConversation: a,
|
|
685
|
-
onBlockParticipant:
|
|
686
|
-
className:
|
|
685
|
+
onBlockParticipant: d,
|
|
686
|
+
className: h
|
|
687
687
|
}) => {
|
|
688
|
-
const [
|
|
689
|
-
(
|
|
690
|
-
var
|
|
691
|
-
return ((
|
|
688
|
+
const [n, l] = v(!1), w = X.useMemo(() => Object.values(t.state.members || {}).find(
|
|
689
|
+
(i) => {
|
|
690
|
+
var N;
|
|
691
|
+
return ((N = i.user) == null ? void 0 : N.id) && i.user.id !== t._client.userID;
|
|
692
692
|
}
|
|
693
|
-
), [t._client.userID, t.state.members]),
|
|
694
|
-
const
|
|
695
|
-
return
|
|
693
|
+
), [t._client.userID, t.state.members]), f = X.useMemo(() => {
|
|
694
|
+
const b = t.data ?? {};
|
|
695
|
+
return b.followerStatus ? String(b.followerStatus) : b.isFollower ? "Subscribed to you" : void 0;
|
|
696
696
|
}, [t.data]);
|
|
697
|
-
return /* @__PURE__ */
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
697
|
+
return /* @__PURE__ */ c(
|
|
698
|
+
"div",
|
|
699
|
+
{
|
|
700
|
+
className: T(
|
|
701
|
+
"messaging-channel-view h-full flex flex-col",
|
|
702
|
+
h
|
|
703
|
+
),
|
|
704
|
+
children: [
|
|
705
|
+
/* @__PURE__ */ e(Ee, { channel: t, children: /* @__PURE__ */ c(Ie, { children: [
|
|
706
|
+
/* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
|
|
707
|
+
Be,
|
|
708
|
+
{
|
|
709
|
+
onBack: s,
|
|
710
|
+
showBackButton: r,
|
|
711
|
+
onShowInfo: () => l(!0),
|
|
712
|
+
canShowInfo: !!w
|
|
713
|
+
}
|
|
714
|
+
) }),
|
|
715
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ e(ye, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }) }),
|
|
716
|
+
/* @__PURE__ */ e(
|
|
717
|
+
je,
|
|
718
|
+
{
|
|
719
|
+
renderActions: () => o == null ? void 0 : o(t)
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
] }) }),
|
|
723
|
+
/* @__PURE__ */ e(
|
|
724
|
+
Ae,
|
|
725
|
+
{
|
|
726
|
+
isOpen: n,
|
|
727
|
+
onClose: () => l(!1),
|
|
728
|
+
participant: w,
|
|
729
|
+
channel: t,
|
|
730
|
+
followerStatusLabel: f,
|
|
731
|
+
onLeaveConversation: a,
|
|
732
|
+
onBlockParticipant: d
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
]
|
|
736
|
+
}
|
|
737
|
+
);
|
|
729
738
|
};
|
|
730
|
-
function
|
|
739
|
+
function Ge({
|
|
731
740
|
searchQuery: t,
|
|
732
741
|
setSearchQuery: s,
|
|
733
|
-
placeholder:
|
|
742
|
+
placeholder: r
|
|
734
743
|
}) {
|
|
735
|
-
const
|
|
736
|
-
return /* @__PURE__ */
|
|
744
|
+
const o = H(null);
|
|
745
|
+
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
737
746
|
/* @__PURE__ */ e(
|
|
738
|
-
|
|
747
|
+
Ue,
|
|
739
748
|
{
|
|
740
749
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
741
750
|
weight: "bold"
|
|
@@ -744,185 +753,185 @@ function pe({
|
|
|
744
753
|
/* @__PURE__ */ e(
|
|
745
754
|
"input",
|
|
746
755
|
{
|
|
747
|
-
ref:
|
|
756
|
+
ref: o,
|
|
748
757
|
type: "text",
|
|
749
|
-
placeholder:
|
|
758
|
+
placeholder: r,
|
|
750
759
|
value: t,
|
|
751
760
|
onChange: (a) => s(a.target.value),
|
|
752
761
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
753
762
|
}
|
|
754
763
|
),
|
|
755
764
|
t && /* @__PURE__ */ e(
|
|
756
|
-
|
|
765
|
+
ee,
|
|
757
766
|
{
|
|
758
767
|
label: "Clear search",
|
|
759
768
|
onClick: () => {
|
|
760
769
|
var a;
|
|
761
|
-
s(""), (a =
|
|
770
|
+
s(""), (a = o.current) == null || a.focus();
|
|
762
771
|
},
|
|
763
772
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
764
|
-
children: /* @__PURE__ */ e(
|
|
773
|
+
children: /* @__PURE__ */ e(de, { className: "h-4 w-4", weight: "bold" })
|
|
765
774
|
}
|
|
766
775
|
)
|
|
767
776
|
] });
|
|
768
777
|
}
|
|
769
|
-
const
|
|
778
|
+
const $e = ({
|
|
770
779
|
participantSource: t,
|
|
771
780
|
onSelectParticipant: s,
|
|
772
|
-
onClose:
|
|
773
|
-
existingParticipantIds:
|
|
781
|
+
onClose: r,
|
|
782
|
+
existingParticipantIds: o = /* @__PURE__ */ new Set(),
|
|
774
783
|
participantLabel: a = "participants",
|
|
775
|
-
searchPlaceholder:
|
|
776
|
-
className:
|
|
784
|
+
searchPlaceholder: d = "Search participants...",
|
|
785
|
+
className: h
|
|
777
786
|
}) => {
|
|
778
|
-
const { debug:
|
|
787
|
+
const { debug: n } = K(), [l, w] = v(""), [f, b] = v([]), [i, N] = v(!1), [g, y] = v(null), [E, U] = v(
|
|
779
788
|
null
|
|
780
|
-
),
|
|
781
|
-
|
|
789
|
+
), D = H(!1);
|
|
790
|
+
G(() => {
|
|
782
791
|
if (t.loading) {
|
|
783
|
-
|
|
792
|
+
n && console.log(
|
|
784
793
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
785
794
|
);
|
|
786
795
|
return;
|
|
787
796
|
}
|
|
788
|
-
if (
|
|
797
|
+
if (D.current) return;
|
|
789
798
|
(async () => {
|
|
790
|
-
|
|
799
|
+
n && console.log("[ParticipantPicker] Loading initial participants..."), N(!0), y(null);
|
|
791
800
|
try {
|
|
792
|
-
const
|
|
801
|
+
const u = await t.loadParticipants({
|
|
793
802
|
search: "",
|
|
794
803
|
// Load all participants initially
|
|
795
804
|
limit: 100
|
|
796
805
|
});
|
|
797
|
-
|
|
806
|
+
b(u.participants), D.current = !0, n && console.log(
|
|
798
807
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
799
|
-
|
|
808
|
+
u.participants.length
|
|
800
809
|
);
|
|
801
|
-
} catch (
|
|
802
|
-
const
|
|
803
|
-
y(
|
|
810
|
+
} catch (u) {
|
|
811
|
+
const C = u instanceof Error ? u.message : "Failed to load participants";
|
|
812
|
+
y(C), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
804
813
|
} finally {
|
|
805
|
-
|
|
814
|
+
N(!1);
|
|
806
815
|
}
|
|
807
816
|
})();
|
|
808
|
-
}, [t.loading,
|
|
809
|
-
const
|
|
810
|
-
var
|
|
811
|
-
if (!
|
|
812
|
-
const
|
|
813
|
-
return
|
|
814
|
-
}),
|
|
815
|
-
async (
|
|
816
|
-
if (!
|
|
817
|
-
|
|
817
|
+
}, [t.loading, n]);
|
|
818
|
+
const I = f.filter((m) => !o.has(m.id)).filter((m) => {
|
|
819
|
+
var C;
|
|
820
|
+
if (!l) return !0;
|
|
821
|
+
const u = l.toLowerCase();
|
|
822
|
+
return m.name.toLowerCase().includes(u) || ((C = m.email) == null ? void 0 : C.toLowerCase().includes(u)) || !1;
|
|
823
|
+
}), S = O(
|
|
824
|
+
async (m) => {
|
|
825
|
+
if (!E) {
|
|
826
|
+
U(m.id);
|
|
818
827
|
try {
|
|
819
|
-
await s(
|
|
820
|
-
} catch (
|
|
821
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
828
|
+
await s(m);
|
|
829
|
+
} catch (u) {
|
|
830
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), U(null);
|
|
822
831
|
}
|
|
823
832
|
}
|
|
824
833
|
},
|
|
825
|
-
[s,
|
|
826
|
-
),
|
|
827
|
-
(
|
|
834
|
+
[s, E]
|
|
835
|
+
), P = (m, u) => {
|
|
836
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), S(u));
|
|
828
837
|
};
|
|
829
|
-
return /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
838
|
+
return /* @__PURE__ */ c("div", { className: T("flex flex-col h-full", h), children: [
|
|
839
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
840
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
|
|
832
841
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
833
|
-
/* @__PURE__ */ e(
|
|
842
|
+
/* @__PURE__ */ e(me, { onClick: r })
|
|
834
843
|
] }),
|
|
835
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
|
|
836
845
|
"Select a ",
|
|
837
846
|
a.slice(0, -1),
|
|
838
847
|
" to start messaging (",
|
|
839
|
-
|
|
848
|
+
I.length,
|
|
840
849
|
" available)",
|
|
841
850
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
|
|
842
851
|
] }),
|
|
843
852
|
/* @__PURE__ */ e(
|
|
844
|
-
|
|
853
|
+
Ge,
|
|
845
854
|
{
|
|
846
|
-
searchQuery:
|
|
855
|
+
searchQuery: l,
|
|
847
856
|
setSearchQuery: w,
|
|
848
|
-
placeholder:
|
|
857
|
+
placeholder: d
|
|
849
858
|
}
|
|
850
859
|
)
|
|
851
860
|
] }),
|
|
852
|
-
|
|
861
|
+
g && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
853
862
|
"Error loading ",
|
|
854
863
|
a,
|
|
855
864
|
": ",
|
|
856
|
-
|
|
865
|
+
g
|
|
857
866
|
] }),
|
|
858
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
867
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: i && I.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
859
868
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
860
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
|
|
861
870
|
"Loading ",
|
|
862
871
|
a,
|
|
863
872
|
"..."
|
|
864
873
|
] })
|
|
865
|
-
] }) }) :
|
|
866
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
867
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
868
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
869
|
-
] }) : /* @__PURE__ */
|
|
870
|
-
|
|
871
|
-
const
|
|
874
|
+
] }) }) : I.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
875
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ie, { className: "h-8 w-8 text-charcoal" }) }),
|
|
876
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: l ? `No ${a} found` : f.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
877
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: l ? "Try a different search term" : f.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
878
|
+
] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
|
|
879
|
+
I.map((m) => {
|
|
880
|
+
const u = m.name || m.email || m.id, C = m.email && m.name ? m.email : m.phone;
|
|
872
881
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
873
882
|
"button",
|
|
874
883
|
{
|
|
875
884
|
type: "button",
|
|
876
|
-
onClick: () =>
|
|
877
|
-
onKeyDown: (
|
|
885
|
+
onClick: () => S(m),
|
|
886
|
+
onKeyDown: (R) => P(R, m),
|
|
878
887
|
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",
|
|
879
|
-
children: /* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
888
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
889
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
881
890
|
/* @__PURE__ */ e(
|
|
882
|
-
|
|
891
|
+
se,
|
|
883
892
|
{
|
|
884
|
-
id:
|
|
885
|
-
name:
|
|
886
|
-
image:
|
|
893
|
+
id: m.id,
|
|
894
|
+
name: u,
|
|
895
|
+
image: m.image,
|
|
887
896
|
size: 40
|
|
888
897
|
}
|
|
889
898
|
),
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
892
|
-
|
|
899
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
900
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
901
|
+
C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
|
|
893
902
|
] })
|
|
894
903
|
] }),
|
|
895
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
904
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === m.id ? /* @__PURE__ */ e(J, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5 text-stone" }) })
|
|
896
905
|
] })
|
|
897
906
|
}
|
|
898
|
-
) },
|
|
907
|
+
) }, m.id);
|
|
899
908
|
}),
|
|
900
|
-
|
|
909
|
+
i && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
901
910
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
902
911
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
903
912
|
] }) })
|
|
904
913
|
] }) })
|
|
905
914
|
] });
|
|
906
|
-
},
|
|
915
|
+
}, _e = ({ hasChannels: t, onStartConversation: s, participantLabel: r }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
|
|
907
916
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "💬" }) }),
|
|
908
917
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
909
|
-
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */
|
|
918
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ c(oe, { children: [
|
|
910
919
|
"Choose a conversation from the list or",
|
|
911
920
|
" ",
|
|
912
|
-
s && /* @__PURE__ */
|
|
921
|
+
s && /* @__PURE__ */ c(ce, { onClick: s, children: [
|
|
913
922
|
"start a new conversation with a ",
|
|
914
|
-
|
|
923
|
+
r.slice(0, -1),
|
|
915
924
|
"."
|
|
916
925
|
] })
|
|
917
|
-
] }) : s && /* @__PURE__ */
|
|
918
|
-
/* @__PURE__ */
|
|
926
|
+
] }) : s && /* @__PURE__ */ c(oe, { children: [
|
|
927
|
+
/* @__PURE__ */ c(ce, { onClick: s, children: [
|
|
919
928
|
"Start a new conversation with one of your ",
|
|
920
|
-
|
|
929
|
+
r
|
|
921
930
|
] }),
|
|
922
931
|
" ",
|
|
923
932
|
"to begin messaging."
|
|
924
933
|
] }) })
|
|
925
|
-
] }) }),
|
|
934
|
+
] }) }), ce = ({
|
|
926
935
|
onClick: t,
|
|
927
936
|
children: s
|
|
928
937
|
}) => /* @__PURE__ */ e(
|
|
@@ -933,25 +942,25 @@ const je = ({
|
|
|
933
942
|
className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
|
|
934
943
|
children: s
|
|
935
944
|
}
|
|
936
|
-
),
|
|
937
|
-
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "⚠️" }) }),
|
|
938
|
-
/* @__PURE__ */ e("h2", { className: "
|
|
945
|
+
), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
|
|
946
|
+
/* @__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: "⚠️" }) }),
|
|
947
|
+
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
939
948
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
940
949
|
s && /* @__PURE__ */ e(
|
|
941
950
|
"button",
|
|
942
951
|
{
|
|
943
952
|
type: "button",
|
|
944
953
|
onClick: s,
|
|
945
|
-
className: "inline-flex items-center px-4 py-2
|
|
946
|
-
children: "
|
|
954
|
+
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-primary hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors",
|
|
955
|
+
children: "Go Back"
|
|
947
956
|
}
|
|
948
957
|
)
|
|
949
|
-
] }) }),
|
|
958
|
+
] }) }), Ve = ({ className: t, message: s }) => /* @__PURE__ */ c(
|
|
950
959
|
"div",
|
|
951
960
|
{
|
|
952
|
-
className:
|
|
961
|
+
className: T("flex items-center justify-center h-full", t),
|
|
953
962
|
children: [
|
|
954
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
955
964
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
956
965
|
"animateTransform",
|
|
957
966
|
{
|
|
@@ -989,245 +998,296 @@ const je = ({
|
|
|
989
998
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
990
999
|
]
|
|
991
1000
|
}
|
|
992
|
-
),
|
|
993
|
-
/* @__PURE__ */ e(
|
|
1001
|
+
), We = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1002
|
+
/* @__PURE__ */ e(Ve, { className: "w-6 h-6" }),
|
|
994
1003
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
995
|
-
] }) }),
|
|
1004
|
+
] }) }), Ke = ({
|
|
996
1005
|
capabilities: t = {},
|
|
997
1006
|
className: s,
|
|
998
|
-
renderMessageInputActions:
|
|
999
|
-
onChannelSelect:
|
|
1000
|
-
onParticipantSelect: a
|
|
1007
|
+
renderMessageInputActions: r,
|
|
1008
|
+
onChannelSelect: o,
|
|
1009
|
+
onParticipantSelect: a,
|
|
1010
|
+
initialParticipantFilter: d
|
|
1001
1011
|
}) => {
|
|
1002
1012
|
const {
|
|
1003
|
-
service:
|
|
1004
|
-
client:
|
|
1005
|
-
isConnected:
|
|
1006
|
-
isLoading:
|
|
1007
|
-
error:
|
|
1008
|
-
refreshConnection:
|
|
1009
|
-
debug:
|
|
1010
|
-
} =
|
|
1011
|
-
showStartConversation:
|
|
1012
|
-
participantSource:
|
|
1013
|
-
participantLabel:
|
|
1014
|
-
} = t,
|
|
1015
|
-
if (!
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1013
|
+
service: h,
|
|
1014
|
+
client: n,
|
|
1015
|
+
isConnected: l,
|
|
1016
|
+
isLoading: w,
|
|
1017
|
+
error: f,
|
|
1018
|
+
refreshConnection: b,
|
|
1019
|
+
debug: i
|
|
1020
|
+
} = Me(), [N, g] = v(null), [y, E] = v(!1), [U, D] = v(!1), [I, S] = v(/* @__PURE__ */ new Set()), [P, m] = v(0), [u, C] = v(!1), [R, $] = v(null), L = H(null), {
|
|
1021
|
+
showStartConversation: _ = !1,
|
|
1022
|
+
participantSource: V,
|
|
1023
|
+
participantLabel: W = "participants"
|
|
1024
|
+
} = t, z = H(null), j = O(async () => {
|
|
1025
|
+
if (!n || !l) return;
|
|
1026
|
+
const x = n.userID;
|
|
1027
|
+
if (x)
|
|
1018
1028
|
try {
|
|
1019
|
-
|
|
1020
|
-
const
|
|
1029
|
+
i && console.log("[MessagingShell] Syncing channels for user:", x);
|
|
1030
|
+
const p = await n.queryChannels(
|
|
1021
1031
|
{
|
|
1022
1032
|
type: "messaging",
|
|
1023
|
-
members: { $in: [
|
|
1033
|
+
members: { $in: [x] }
|
|
1024
1034
|
},
|
|
1025
1035
|
{},
|
|
1026
1036
|
{ limit: 100 }
|
|
1027
|
-
),
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
Object.values(
|
|
1031
|
-
var
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1037
|
+
), F = /* @__PURE__ */ new Set();
|
|
1038
|
+
p.forEach((ne) => {
|
|
1039
|
+
const fe = ne.state.members;
|
|
1040
|
+
Object.values(fe).forEach((ge) => {
|
|
1041
|
+
var le;
|
|
1042
|
+
const te = (le = ge.user) == null ? void 0 : le.id;
|
|
1043
|
+
te && te !== x && F.add(te);
|
|
1034
1044
|
});
|
|
1035
|
-
}),
|
|
1036
|
-
channelCount:
|
|
1037
|
-
memberCount:
|
|
1045
|
+
}), S(F), E(p.length > 0), z.current = x, i && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1046
|
+
channelCount: p.length,
|
|
1047
|
+
memberCount: F.size
|
|
1038
1048
|
});
|
|
1039
|
-
} catch (
|
|
1040
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1049
|
+
} catch (p) {
|
|
1050
|
+
console.error("[MessagingShell] Failed to sync channels:", p);
|
|
1041
1051
|
}
|
|
1042
|
-
}, [
|
|
1043
|
-
|
|
1044
|
-
if (!
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
}, [
|
|
1048
|
-
|
|
1049
|
-
(
|
|
1050
|
-
|
|
1052
|
+
}, [n, l, i]);
|
|
1053
|
+
G(() => {
|
|
1054
|
+
if (!n || !l) return;
|
|
1055
|
+
const x = n.userID;
|
|
1056
|
+
x && z.current !== x && j();
|
|
1057
|
+
}, [n, l, j]), G(() => {
|
|
1058
|
+
if (!d || !n || !l) return;
|
|
1059
|
+
(async () => {
|
|
1060
|
+
const p = n.userID;
|
|
1061
|
+
if (p)
|
|
1062
|
+
try {
|
|
1063
|
+
i && console.log(
|
|
1064
|
+
"[MessagingShell] Loading initial conversation with:",
|
|
1065
|
+
d
|
|
1066
|
+
);
|
|
1067
|
+
const F = await n.queryChannels(
|
|
1068
|
+
{
|
|
1069
|
+
type: "messaging",
|
|
1070
|
+
members: { $in: [p, d] }
|
|
1071
|
+
},
|
|
1072
|
+
{},
|
|
1073
|
+
{ limit: 1 }
|
|
1074
|
+
);
|
|
1075
|
+
F.length > 0 ? (g(F[0]), C(!0), $(null), i && console.log(
|
|
1076
|
+
"[MessagingShell] Initial conversation loaded:",
|
|
1077
|
+
F[0].id
|
|
1078
|
+
)) : ($("No conversation found with this account"), i && console.log(
|
|
1079
|
+
"[MessagingShell] No conversation found for:",
|
|
1080
|
+
d
|
|
1081
|
+
));
|
|
1082
|
+
} catch (F) {
|
|
1083
|
+
console.error(
|
|
1084
|
+
"[MessagingShell] Failed to load initial conversation:",
|
|
1085
|
+
F
|
|
1086
|
+
), $("Failed to load conversation");
|
|
1087
|
+
}
|
|
1088
|
+
})();
|
|
1089
|
+
}, [d, n, l, i]);
|
|
1090
|
+
const q = O(
|
|
1091
|
+
(x) => {
|
|
1092
|
+
g(x), o == null || o(x);
|
|
1051
1093
|
},
|
|
1052
|
-
[
|
|
1053
|
-
),
|
|
1054
|
-
|
|
1055
|
-
}, []),
|
|
1056
|
-
var
|
|
1057
|
-
|
|
1058
|
-
}, [
|
|
1059
|
-
async (
|
|
1060
|
-
var
|
|
1061
|
-
if (
|
|
1094
|
+
[o]
|
|
1095
|
+
), k = O(() => {
|
|
1096
|
+
u || g(null);
|
|
1097
|
+
}, [u]), M = O(() => {
|
|
1098
|
+
var x;
|
|
1099
|
+
V && (m((p) => p + 1), D(!0), (x = L.current) == null || x.showModal());
|
|
1100
|
+
}, [V]), B = O(
|
|
1101
|
+
async (x) => {
|
|
1102
|
+
var p;
|
|
1103
|
+
if (h)
|
|
1062
1104
|
try {
|
|
1063
|
-
|
|
1105
|
+
i && console.log(
|
|
1064
1106
|
"[MessagingShell] Starting conversation with:",
|
|
1065
|
-
|
|
1107
|
+
x.id
|
|
1066
1108
|
);
|
|
1067
|
-
const
|
|
1068
|
-
id:
|
|
1069
|
-
name:
|
|
1070
|
-
email:
|
|
1071
|
-
phone:
|
|
1109
|
+
const F = await h.startChannelWithParticipant({
|
|
1110
|
+
id: x.id,
|
|
1111
|
+
name: x.name,
|
|
1112
|
+
email: x.email,
|
|
1113
|
+
phone: x.phone
|
|
1072
1114
|
});
|
|
1073
1115
|
try {
|
|
1074
|
-
await
|
|
1075
|
-
} catch (
|
|
1076
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1116
|
+
await F.show();
|
|
1117
|
+
} catch (ne) {
|
|
1118
|
+
console.warn("[MessagingShell] Failed to unhide channel:", ne);
|
|
1077
1119
|
}
|
|
1078
|
-
|
|
1079
|
-
} catch (
|
|
1080
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1120
|
+
g(F), D(!1), (p = L.current) == null || p.close(), a == null || a(x);
|
|
1121
|
+
} catch (F) {
|
|
1122
|
+
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1081
1123
|
}
|
|
1082
1124
|
},
|
|
1083
|
-
[
|
|
1084
|
-
),
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
}, []),
|
|
1088
|
-
async (
|
|
1089
|
-
|
|
1125
|
+
[h, a, i]
|
|
1126
|
+
), A = O(() => {
|
|
1127
|
+
var x;
|
|
1128
|
+
D(!1), (x = L.current) == null || x.close();
|
|
1129
|
+
}, []), Q = O(
|
|
1130
|
+
async (x) => {
|
|
1131
|
+
i && console.log("[MessagingShell] Leaving conversation:", x.id), g(null), z.current = null, await j();
|
|
1090
1132
|
},
|
|
1091
|
-
[
|
|
1092
|
-
),
|
|
1093
|
-
async (
|
|
1094
|
-
|
|
1133
|
+
[j, i]
|
|
1134
|
+
), he = O(
|
|
1135
|
+
async (x) => {
|
|
1136
|
+
i && console.log("[MessagingShell] Blocking participant:", x), g(null), z.current = null, await j();
|
|
1095
1137
|
},
|
|
1096
|
-
[
|
|
1097
|
-
),
|
|
1098
|
-
return
|
|
1099
|
-
|
|
1138
|
+
[j, i]
|
|
1139
|
+
), Z = !!N;
|
|
1140
|
+
return w ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(We, {}) }) : f ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(re, { message: f, onBack: b }) }) : !l || !n ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(
|
|
1141
|
+
re,
|
|
1100
1142
|
{
|
|
1101
|
-
|
|
1102
|
-
|
|
1143
|
+
message: "Not connected to messaging service",
|
|
1144
|
+
onBack: b
|
|
1103
1145
|
}
|
|
1104
|
-
) }) : /* @__PURE__ */
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1146
|
+
) }) : R ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(re, { message: R }) }) : /* @__PURE__ */ c(
|
|
1147
|
+
"div",
|
|
1148
|
+
{
|
|
1149
|
+
className: T(
|
|
1150
|
+
"messaging-shell h-full bg-white overflow-hidden",
|
|
1151
|
+
s
|
|
1152
|
+
),
|
|
1153
|
+
children: [
|
|
1154
|
+
/* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
|
|
1155
|
+
/* @__PURE__ */ e(
|
|
1156
|
+
"div",
|
|
1111
1157
|
{
|
|
1112
|
-
|
|
1113
|
-
|
|
1158
|
+
className: T(
|
|
1159
|
+
"messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
|
|
1160
|
+
{
|
|
1161
|
+
// In direct conversation mode, always hide the channel list
|
|
1162
|
+
hidden: u,
|
|
1163
|
+
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1164
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": !u && Z,
|
|
1165
|
+
// Normal mode: show when no channel selected
|
|
1166
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": !u && !Z
|
|
1167
|
+
}
|
|
1168
|
+
),
|
|
1169
|
+
children: /* @__PURE__ */ e(
|
|
1170
|
+
pe,
|
|
1171
|
+
{
|
|
1172
|
+
onChannelSelect: q,
|
|
1173
|
+
selectedChannel: N || void 0,
|
|
1174
|
+
showStartConversation: _ && !!V,
|
|
1175
|
+
onStartConversation: M,
|
|
1176
|
+
participantLabel: W
|
|
1177
|
+
}
|
|
1178
|
+
)
|
|
1114
1179
|
}
|
|
1115
1180
|
),
|
|
1116
|
-
|
|
1117
|
-
|
|
1181
|
+
/* @__PURE__ */ e(
|
|
1182
|
+
"div",
|
|
1118
1183
|
{
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
Ae,
|
|
1148
|
-
{
|
|
1149
|
-
hasChannels: b,
|
|
1150
|
-
onStartConversation: f ? _ : void 0,
|
|
1151
|
-
participantLabel: S
|
|
1184
|
+
className: T(
|
|
1185
|
+
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1186
|
+
{
|
|
1187
|
+
// In direct conversation mode, always show (full width)
|
|
1188
|
+
flex: u || Z,
|
|
1189
|
+
// Normal mode: hide on mobile when no channel selected
|
|
1190
|
+
"hidden lg:flex": !u && !Z
|
|
1191
|
+
}
|
|
1192
|
+
),
|
|
1193
|
+
children: N ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1194
|
+
He,
|
|
1195
|
+
{
|
|
1196
|
+
channel: N,
|
|
1197
|
+
onBack: k,
|
|
1198
|
+
showBackButton: !0,
|
|
1199
|
+
renderMessageInputActions: r,
|
|
1200
|
+
onLeaveConversation: Q,
|
|
1201
|
+
onBlockParticipant: he
|
|
1202
|
+
},
|
|
1203
|
+
N.id
|
|
1204
|
+
) }) : /* @__PURE__ */ e(
|
|
1205
|
+
_e,
|
|
1206
|
+
{
|
|
1207
|
+
hasChannels: y,
|
|
1208
|
+
onStartConversation: _ ? M : void 0,
|
|
1209
|
+
participantLabel: W
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1152
1212
|
}
|
|
1153
1213
|
)
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
/* @__PURE__ */ e(
|
|
1159
|
-
"dialog",
|
|
1160
|
-
{
|
|
1161
|
-
ref: u,
|
|
1162
|
-
className: "mes-dialog",
|
|
1163
|
-
onClick: (h) => {
|
|
1164
|
-
h.target === u.current && G();
|
|
1165
|
-
},
|
|
1166
|
-
onClose: G,
|
|
1167
|
-
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1168
|
-
je,
|
|
1214
|
+
] }),
|
|
1215
|
+
V && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1216
|
+
/* @__PURE__ */ e(
|
|
1217
|
+
"dialog",
|
|
1169
1218
|
{
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1219
|
+
ref: L,
|
|
1220
|
+
className: "mes-dialog",
|
|
1221
|
+
onClick: (x) => {
|
|
1222
|
+
x.target === L.current && A();
|
|
1223
|
+
},
|
|
1224
|
+
onClose: A,
|
|
1225
|
+
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1226
|
+
$e,
|
|
1227
|
+
{
|
|
1228
|
+
participantSource: V,
|
|
1229
|
+
onSelectParticipant: B,
|
|
1230
|
+
onClose: A,
|
|
1231
|
+
existingParticipantIds: I,
|
|
1232
|
+
participantLabel: W,
|
|
1233
|
+
searchPlaceholder: `Search ${W}...`
|
|
1234
|
+
},
|
|
1235
|
+
P
|
|
1236
|
+
) })
|
|
1237
|
+
}
|
|
1238
|
+
)
|
|
1239
|
+
]
|
|
1240
|
+
}
|
|
1241
|
+
);
|
|
1242
|
+
}, es = (t, s = {}) => {
|
|
1243
|
+
const { initialSearch: r = "", pageSize: o = 20 } = s, [a, d] = v([]), [h, n] = v(!1), [l, w] = v(null), [f, b] = v(r), [i, N] = v(!0), [g, y] = v(), E = O(async (S = !1, P) => {
|
|
1244
|
+
if (h) return;
|
|
1245
|
+
const m = P !== void 0 ? P : f;
|
|
1246
|
+
n(!0), w(null);
|
|
1187
1247
|
try {
|
|
1188
|
-
const
|
|
1189
|
-
search:
|
|
1190
|
-
limit:
|
|
1191
|
-
cursor:
|
|
1248
|
+
const u = await t.loadParticipants({
|
|
1249
|
+
search: m || void 0,
|
|
1250
|
+
limit: o,
|
|
1251
|
+
cursor: S ? void 0 : g
|
|
1192
1252
|
});
|
|
1193
|
-
|
|
1194
|
-
(
|
|
1195
|
-
),
|
|
1196
|
-
} catch (
|
|
1197
|
-
const
|
|
1198
|
-
w(
|
|
1253
|
+
d(
|
|
1254
|
+
(C) => S ? u.participants : [...C, ...u.participants]
|
|
1255
|
+
), N(u.hasMore), y(u.nextCursor);
|
|
1256
|
+
} catch (u) {
|
|
1257
|
+
const C = u instanceof Error ? u.message : "Failed to load participants";
|
|
1258
|
+
w(C), console.error("[useParticipants] Load error:", u);
|
|
1199
1259
|
} finally {
|
|
1200
|
-
|
|
1260
|
+
n(!1);
|
|
1201
1261
|
}
|
|
1202
|
-
}, [t,
|
|
1203
|
-
|
|
1204
|
-
}, [
|
|
1205
|
-
|
|
1206
|
-
}, [
|
|
1207
|
-
y(void 0),
|
|
1208
|
-
}, [
|
|
1209
|
-
return
|
|
1210
|
-
|
|
1262
|
+
}, [t, f, g, o, h]), U = O(() => {
|
|
1263
|
+
i && !h && E(!1);
|
|
1264
|
+
}, [i, h, E]), D = O((S) => {
|
|
1265
|
+
b(S), y(void 0), E(!0, S);
|
|
1266
|
+
}, [E]), I = O(() => {
|
|
1267
|
+
y(void 0), E(!0);
|
|
1268
|
+
}, [E]);
|
|
1269
|
+
return G(() => {
|
|
1270
|
+
E(!0);
|
|
1211
1271
|
}, [t.loadParticipants]), {
|
|
1212
1272
|
participants: a,
|
|
1213
|
-
loading:
|
|
1214
|
-
error:
|
|
1215
|
-
searchQuery:
|
|
1216
|
-
hasMore:
|
|
1273
|
+
loading: h,
|
|
1274
|
+
error: l,
|
|
1275
|
+
searchQuery: f,
|
|
1276
|
+
hasMore: i,
|
|
1217
1277
|
totalCount: t.totalCount,
|
|
1218
|
-
loadMore:
|
|
1219
|
-
search:
|
|
1220
|
-
refresh:
|
|
1278
|
+
loadMore: U,
|
|
1279
|
+
search: D,
|
|
1280
|
+
refresh: I
|
|
1221
1281
|
};
|
|
1222
1282
|
};
|
|
1223
1283
|
export {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1284
|
+
se as Avatar,
|
|
1285
|
+
pe as ChannelList,
|
|
1286
|
+
He as ChannelView,
|
|
1287
|
+
Je as MessagingProvider,
|
|
1288
|
+
Ke as MessagingShell,
|
|
1289
|
+
$e as ParticipantPicker,
|
|
1290
|
+
Me as useMessaging,
|
|
1291
|
+
es as useParticipants
|
|
1232
1292
|
};
|
|
1233
1293
|
//# sourceMappingURL=index.js.map
|