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