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