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