@linktr.ee/messaging-react 1.22.3 → 1.23.0
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 +13 -1
- package/dist/index.js +917 -903
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.stories.tsx +53 -1
- package/src/components/ChannelView.tsx +23 -3
- package/src/components/MessagingShell/index.tsx +2 -0
- package/src/types.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as de } from "react/jsx-runtime";
|
|
2
2
|
import R from "classnames";
|
|
3
|
-
import A, { createContext as
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { GiftIcon as Ht, XIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
3
|
+
import A, { createContext as at, useContext as rt, useCallback as L, useState as S, useRef as Z, useEffect as J, useMemo as Ee } from "react";
|
|
4
|
+
import { StreamChatService as ot } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as lt, ChannelList as it, DateSeparator as ct, useChannelStateContext as Se, useChatContext as $e, areMessageUIPropsEqual as dt, useMessageReminder as ut, useComponentContext as mt, Attachment as ht, EditMessageModal as ft, MessageBlocked as gt, MessageBouncePrompt as xt, MessageDeleted as bt, MessageIsThreadReplyInChannelButtonIndicator as Ct, MessageRepliesCountButton as Nt, ReminderNotification as vt, StreamedMessageText as wt, messageHasAttachments as pt, messageHasReactions as yt, isDateSeparatorMessage as Et, isMessageBlocked as _t, isMessageBounced as It, MessageBounceModal as St, Poll as Mt, MessageText as kt, MessageErrorIcon as Dt, useMessageContext as je, useMessageComposer as Tt, useStateStore as Rt, MessageInput as Lt, useMessageInputContext as Pt, useMessageComposerHasSendableData as Ut, SimpleAttachmentSelector as Ft, QuotedMessagePreview as Ot, AttachmentPreviewList as At, TextareaComposer as Bt, MessageTimestamp as Te, Channel as $t, WithComponents as jt, Window as Gt, MessageList as Vt } from "stream-chat-react";
|
|
6
|
+
import { GiftIcon as Ht, XIcon as Me, ArrowUpIcon as zt, SparkleIcon as Wt, ArrowLeftIcon as Re, StarIcon as Le, DotsThreeIcon as Pe, SpinnerGapIcon as be, SignOutIcon as qt, ProhibitInsetIcon as Ue, FlagIcon as Yt, MagnifyingGlassIcon as Zt, ChatCircleDotsIcon as Fe } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as Oe } from "stream-chat";
|
|
8
|
+
const Ge = at({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,199 +15,199 @@ const $e = st({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), ve = () => rt(Ge), js = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
22
|
+
apiKey: a,
|
|
23
23
|
capabilities: l = {},
|
|
24
|
-
debug:
|
|
24
|
+
debug: d = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
(
|
|
28
|
-
|
|
26
|
+
const r = L(
|
|
27
|
+
(m, ...i) => {
|
|
28
|
+
d && console.log(`🔥 [MessagingProvider] ${m}`, ...i);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[d]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
r("🔄 RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
|
-
apiKey: (
|
|
34
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [u, g] = S(null), [x, v] = S(null), [b, y] = S(!1), [o, w] = S(!1), [I, p] = S(null), M = Z(!1), C = Z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
|
-
apiKey:
|
|
40
|
+
apiKey: a,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: l
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
46
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
43
|
+
}), N = Z(0);
|
|
44
|
+
N.current++, r("📊 RENDER INFO", {
|
|
45
|
+
renderCount: N.current,
|
|
46
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: C.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
-
apiKeyChanged: C.current.apiKey !==
|
|
49
|
+
apiKeyChanged: C.current.apiKey !== a,
|
|
50
50
|
serviceConfigChanged: C.current.serviceConfig !== n,
|
|
51
51
|
capabilitiesChanged: C.current.capabilities !== l
|
|
52
52
|
}
|
|
53
53
|
}), C.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
|
-
apiKey:
|
|
55
|
+
apiKey: a,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: l
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
renderCount:
|
|
62
|
-
apiKey: !!
|
|
58
|
+
}, J(() => {
|
|
59
|
+
const m = N.current;
|
|
60
|
+
if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
+
renderCount: m,
|
|
62
|
+
apiKey: !!a,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
65
|
-
apiKey: (
|
|
65
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
67
|
serviceConfigStable: C.current.serviceConfig === n,
|
|
68
|
-
apiKeyStable: C.current.apiKey ===
|
|
68
|
+
apiKeyStable: C.current.apiKey === a
|
|
69
69
|
}
|
|
70
|
-
}), !
|
|
71
|
-
|
|
72
|
-
renderCount:
|
|
70
|
+
}), !a || !n) {
|
|
71
|
+
r("⚠️ SERVICE INIT SKIPPED", {
|
|
72
|
+
renderCount: m,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
renderCount:
|
|
79
|
-
apiKey: (
|
|
77
|
+
r("🚀 CREATING NEW SERVICE", {
|
|
78
|
+
renderCount: m,
|
|
79
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: C.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const i = new ot({
|
|
83
83
|
...n,
|
|
84
|
-
apiKey:
|
|
85
|
-
debug:
|
|
84
|
+
apiKey: a,
|
|
85
|
+
debug: d
|
|
86
86
|
});
|
|
87
|
-
return g(
|
|
88
|
-
renderCount:
|
|
89
|
-
serviceInstance: !!
|
|
87
|
+
return g(i), r("✅ SERVICE SET", {
|
|
88
|
+
renderCount: m,
|
|
89
|
+
serviceInstance: !!i
|
|
90
90
|
}), () => {
|
|
91
|
-
|
|
92
|
-
renderCount:
|
|
91
|
+
r("🧹 SERVICE CLEANUP", {
|
|
92
|
+
renderCount: m,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), i.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
hasService: !!
|
|
96
|
+
}, [a, n, d, r]);
|
|
97
|
+
const f = Z(null);
|
|
98
|
+
J(() => {
|
|
99
|
+
var i, E;
|
|
100
|
+
if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
104
|
+
isConnecting: M.current,
|
|
105
105
|
isConnected: b,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
108
|
-
|
|
106
|
+
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !u || !s) {
|
|
108
|
+
r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
111
|
+
if (M.current) {
|
|
112
|
+
r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
116
|
-
|
|
115
|
+
if (((i = f.current) == null ? void 0 : i.serviceId) === u && ((E = f.current) == null ? void 0 : E.userId) === s.id) {
|
|
116
|
+
r(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
119
119
|
);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
|
|
123
|
+
r("🚀 STARTING USER CONNECTION", { userId: s.id }), M.current = !0, w(!0), p(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
125
|
+
r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const D = await u.connectUser(s);
|
|
127
|
+
v(D), y(!0), f.current = { serviceId: u, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: D.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
|
|
131
|
+
} catch (D) {
|
|
132
|
+
const j = D instanceof Error ? D.message : "Connection failed";
|
|
133
|
+
p(j), r("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: j
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
w(!1), M.current = !1, r("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: b
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [u, s, r, b]), J(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!u,
|
|
146
146
|
isConnected: b
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
u && b ? (r(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
151
|
+
), f.current = null, u.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!u,
|
|
153
153
|
isConnected: b
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
hasService: !!
|
|
155
|
+
}), [u, b, r]);
|
|
156
|
+
const k = L(async () => {
|
|
157
|
+
if (r("🔄 REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
161
|
-
|
|
160
|
+
}), !u || !s) {
|
|
161
|
+
r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
|
|
165
165
|
try {
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
const
|
|
171
|
-
|
|
166
|
+
r("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
|
|
167
|
+
const m = await u.connectUser(s);
|
|
168
|
+
v(m), y(!0), p(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (m) {
|
|
170
|
+
const i = m instanceof Error ? m.message : "Refresh failed";
|
|
171
|
+
p(i), r("❌ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: i
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
w(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
178
|
+
}, [u, s, r]), h = A.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!u,
|
|
180
180
|
hasClient: !!x,
|
|
181
181
|
isConnected: b,
|
|
182
|
-
isLoading:
|
|
182
|
+
isLoading: o,
|
|
183
183
|
hasError: !!I,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
186
|
+
service: u,
|
|
187
187
|
client: x,
|
|
188
188
|
isConnected: b,
|
|
189
|
-
isLoading:
|
|
189
|
+
isLoading: o,
|
|
190
190
|
error: I,
|
|
191
191
|
capabilities: l,
|
|
192
|
-
refreshConnection:
|
|
193
|
-
debug:
|
|
192
|
+
refreshConnection: k,
|
|
193
|
+
debug: d
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
u,
|
|
196
196
|
x,
|
|
197
197
|
b,
|
|
198
|
-
|
|
198
|
+
o,
|
|
199
199
|
I,
|
|
200
200
|
l,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
k,
|
|
202
|
+
d,
|
|
203
|
+
r
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
206
|
-
renderCount:
|
|
205
|
+
return r("🔄 RENDER END", {
|
|
206
|
+
renderCount: N.current,
|
|
207
207
|
willRenderChat: !!(x && b),
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
208
|
+
contextValueReady: !!h
|
|
209
|
+
}), /* @__PURE__ */ e(Ge.Provider, { value: h, children: x && b ? /* @__PURE__ */ e(
|
|
210
|
+
lt,
|
|
211
211
|
{
|
|
212
212
|
client: x,
|
|
213
213
|
customClasses: {
|
|
@@ -216,34 +216,34 @@ const $e = st({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Jt = () => ve(), Ve = A.createContext({
|
|
220
220
|
selectedChannel: void 0,
|
|
221
221
|
onChannelSelect: () => {
|
|
222
222
|
},
|
|
223
223
|
debug: !1,
|
|
224
224
|
renderMessagePreview: void 0
|
|
225
|
-
}),
|
|
225
|
+
}), Qt = Ve.Provider, Xt = () => A.useContext(Ve), Kt = (t, s) => {
|
|
226
226
|
const n = new Date(
|
|
227
227
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
228
228
|
), l = new Date(
|
|
229
229
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
230
230
|
).getTime() - n.getTime();
|
|
231
231
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
232
|
-
},
|
|
232
|
+
}, es = (t) => {
|
|
233
233
|
const s = /* @__PURE__ */ new Date();
|
|
234
234
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
235
235
|
return "Just now";
|
|
236
|
-
const
|
|
237
|
-
return
|
|
236
|
+
const a = Kt(t, s);
|
|
237
|
+
return a === 0 ? t.toLocaleTimeString([], {
|
|
238
238
|
hour: "numeric",
|
|
239
239
|
minute: "2-digit",
|
|
240
240
|
hour12: !0
|
|
241
|
-
}) :
|
|
241
|
+
}) : a === 1 ? "Yesterday" : a < 7 ? `${a}d` : a < 28 ? `${Math.floor(a / 7)}w` : t.toLocaleDateString("en-US", {
|
|
242
242
|
month: "numeric",
|
|
243
243
|
day: "numeric",
|
|
244
244
|
year: "2-digit"
|
|
245
245
|
});
|
|
246
|
-
},
|
|
246
|
+
}, Ae = [
|
|
247
247
|
"🍎",
|
|
248
248
|
// Apple
|
|
249
249
|
"🍌",
|
|
@@ -271,33 +271,33 @@ const $e = st({
|
|
|
271
271
|
"🍈"
|
|
272
272
|
// Melon
|
|
273
273
|
];
|
|
274
|
-
function
|
|
274
|
+
function ts(t) {
|
|
275
275
|
let s = 0;
|
|
276
276
|
for (let n = 0; n < t.length; n++) {
|
|
277
|
-
const
|
|
278
|
-
s = (s << 5) - s +
|
|
277
|
+
const a = t.charCodeAt(n);
|
|
278
|
+
s = (s << 5) - s + a, s = s & s;
|
|
279
279
|
}
|
|
280
280
|
return Math.abs(s);
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
const n =
|
|
284
|
-
return
|
|
282
|
+
function ss(t) {
|
|
283
|
+
const n = ts(t) % Ae.length;
|
|
284
|
+
return Ae[n];
|
|
285
285
|
}
|
|
286
286
|
const ee = ({
|
|
287
287
|
id: t,
|
|
288
288
|
image: s,
|
|
289
289
|
size: n = 40,
|
|
290
|
-
className:
|
|
290
|
+
className: a,
|
|
291
291
|
shape: l = "squircle"
|
|
292
292
|
}) => {
|
|
293
|
-
const
|
|
293
|
+
const d = ss(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", g = l === "circle" ? { borderRadius: "50%" } : {
|
|
294
294
|
borderRadius: "33%",
|
|
295
295
|
"corner-shape": "superellipse(1.3)"
|
|
296
296
|
};
|
|
297
297
|
return /* @__PURE__ */ e(
|
|
298
298
|
"div",
|
|
299
299
|
{
|
|
300
|
-
className: R("flex-shrink-0 overflow-hidden",
|
|
300
|
+
className: R("flex-shrink-0 overflow-hidden", a),
|
|
301
301
|
style: {
|
|
302
302
|
width: `${n}px`,
|
|
303
303
|
height: `${n}px`,
|
|
@@ -316,14 +316,14 @@ const ee = ({
|
|
|
316
316
|
"aria-hidden": "true",
|
|
317
317
|
className: R(
|
|
318
318
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
319
|
-
|
|
319
|
+
u
|
|
320
320
|
),
|
|
321
|
-
children:
|
|
321
|
+
children: d
|
|
322
322
|
}
|
|
323
323
|
)
|
|
324
324
|
}
|
|
325
325
|
);
|
|
326
|
-
},
|
|
326
|
+
}, ns = ({ size: t = 15 }) => /* @__PURE__ */ e(
|
|
327
327
|
"svg",
|
|
328
328
|
{
|
|
329
329
|
width: t,
|
|
@@ -340,123 +340,123 @@ const ee = ({
|
|
|
340
340
|
}
|
|
341
341
|
)
|
|
342
342
|
}
|
|
343
|
-
),
|
|
343
|
+
), as = (t) => {
|
|
344
344
|
var s;
|
|
345
345
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
346
|
-
},
|
|
346
|
+
}, rs = (t) => {
|
|
347
347
|
var s;
|
|
348
348
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
349
|
-
},
|
|
349
|
+
}, ke = (t) => {
|
|
350
350
|
var s;
|
|
351
351
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
352
|
-
},
|
|
352
|
+
}, He = (t) => as(t) || rs(t), os = (t) => {
|
|
353
353
|
var s;
|
|
354
|
-
return
|
|
355
|
-
},
|
|
354
|
+
return He(t) && !((s = t.text) != null && s.trim());
|
|
355
|
+
}, ye = ({
|
|
356
356
|
message: t,
|
|
357
357
|
standalone: s = !1,
|
|
358
358
|
isMyMessage: n = !1,
|
|
359
|
-
hasAttachment:
|
|
359
|
+
hasAttachment: a = !1
|
|
360
360
|
}) => {
|
|
361
361
|
var b;
|
|
362
|
-
const l =
|
|
363
|
-
if (!l && !
|
|
362
|
+
const l = He(t), d = ke(t);
|
|
363
|
+
if (!l && !d)
|
|
364
364
|
return null;
|
|
365
365
|
if (l) {
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
368
|
-
const
|
|
369
|
-
return /* @__PURE__ */
|
|
366
|
+
const y = (b = t.metadata) == null ? void 0 : b.amount_text;
|
|
367
|
+
if (!y) return null;
|
|
368
|
+
const o = s ? "message-tip-standalone" : "message-tag message-tag--tip", w = s ? `${y} tip` : `Delivered with ${y} tip`;
|
|
369
|
+
return /* @__PURE__ */ c("div", { className: o, children: [
|
|
370
370
|
/* @__PURE__ */ e(Ht, { size: s ? 14 : 12 }),
|
|
371
|
-
/* @__PURE__ */ e("span", { children:
|
|
371
|
+
/* @__PURE__ */ e("span", { children: w })
|
|
372
372
|
] });
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const r = n && a, u = r ? "Sent with AI" : "Sent with DM Agent", g = [
|
|
375
375
|
"message-chatbot-indicator",
|
|
376
376
|
n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
|
|
377
|
-
|
|
378
|
-
].join(" "), x = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children:
|
|
379
|
-
return /* @__PURE__ */ e("div", { className: g, "data-testid": "message-chatbot-indicator", children: n && !
|
|
377
|
+
r ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
|
|
378
|
+
].join(" "), x = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: u }), v = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(ns, { size: r ? 12 : 15 }) });
|
|
379
|
+
return /* @__PURE__ */ e("div", { className: g, "data-testid": "message-chatbot-indicator", children: n && !r ? /* @__PURE__ */ c(de, { children: [
|
|
380
380
|
x,
|
|
381
|
-
|
|
382
|
-
] }) : /* @__PURE__ */
|
|
383
|
-
|
|
381
|
+
v
|
|
382
|
+
] }) : /* @__PURE__ */ c(de, { children: [
|
|
383
|
+
v,
|
|
384
384
|
x
|
|
385
385
|
] }) });
|
|
386
|
-
},
|
|
386
|
+
}, ze = A.memo(
|
|
387
387
|
({ channel: t, unread: s }) => {
|
|
388
|
-
var
|
|
389
|
-
const { selectedChannel: n, onChannelSelect:
|
|
390
|
-
t &&
|
|
391
|
-
}, g = (
|
|
392
|
-
const
|
|
393
|
-
!
|
|
394
|
-
},
|
|
395
|
-
(
|
|
396
|
-
var
|
|
397
|
-
return ((
|
|
388
|
+
var f, k, h, m;
|
|
389
|
+
const { selectedChannel: n, onChannelSelect: a, debug: l, renderMessagePreview: d } = Xt(), r = (n == null ? void 0 : n.id) === (t == null ? void 0 : t.id), u = () => {
|
|
390
|
+
t && a(t);
|
|
391
|
+
}, g = (i) => {
|
|
392
|
+
const E = i.key === "Enter" || i.key === " ", D = i.repeat;
|
|
393
|
+
!E || D || (i.preventDefault(), u());
|
|
394
|
+
}, v = Object.values(((f = t == null ? void 0 : t.state) == null ? void 0 : f.members) || {}).find(
|
|
395
|
+
(i) => {
|
|
396
|
+
var E, D;
|
|
397
|
+
return ((E = i.user) == null ? void 0 : E.id) && i.user.id !== ((D = t == null ? void 0 : t._client) == null ? void 0 : D.userID);
|
|
398
398
|
}
|
|
399
|
-
), b = ((
|
|
400
|
-
var
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
for (let
|
|
404
|
-
if (
|
|
399
|
+
), b = ((k = v == null ? void 0 : v.user) == null ? void 0 : k.name) || "Conversation", y = (h = v == null ? void 0 : v.user) == null ? void 0 : h.image, o = (() => {
|
|
400
|
+
var E;
|
|
401
|
+
const i = (E = t == null ? void 0 : t.state) == null ? void 0 : E.messages;
|
|
402
|
+
if (i != null && i.length) {
|
|
403
|
+
for (let D = i.length - 1; D >= 0; D--)
|
|
404
|
+
if (i[D].type !== "system") return i[D];
|
|
405
405
|
}
|
|
406
406
|
})(), I = (() => {
|
|
407
|
-
var
|
|
408
|
-
if (
|
|
409
|
-
const
|
|
410
|
-
return
|
|
411
|
-
})(),
|
|
407
|
+
var E;
|
|
408
|
+
if (o != null && o.text) return o.text;
|
|
409
|
+
const i = (E = o == null ? void 0 : o.attachments) == null ? void 0 : E[0];
|
|
410
|
+
return i ? i.og_scrape_url ? i.og_scrape_url : i.type === "image" ? "📷 Sent an image" : i.type === "video" ? "🎥 Sent a video" : i.type === "audio" ? "🎵 Sent audio" : i.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
411
|
+
})(), p = o != null && o.created_at ? es(new Date(o.created_at)) : "", M = o ? ke(o) : !1, C = d ? d(o, I) : `${M ? "✨ " : ""}${I}`, N = s ?? 0;
|
|
412
412
|
return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
413
413
|
channelId: t == null ? void 0 : t.id,
|
|
414
|
-
isSelected:
|
|
414
|
+
isSelected: r,
|
|
415
415
|
participantName: b,
|
|
416
|
-
unreadCount:
|
|
417
|
-
hasTimestamp: !!
|
|
416
|
+
unreadCount: N,
|
|
417
|
+
hasTimestamp: !!p
|
|
418
418
|
}), /* @__PURE__ */ e(
|
|
419
419
|
"div",
|
|
420
420
|
{
|
|
421
421
|
role: "button",
|
|
422
422
|
tabIndex: 0,
|
|
423
|
-
onClick:
|
|
423
|
+
onClick: u,
|
|
424
424
|
onKeyDown: g,
|
|
425
425
|
className: R(
|
|
426
426
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
427
427
|
{
|
|
428
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
429
|
-
"hover:bg-sand": !
|
|
428
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": r,
|
|
429
|
+
"hover:bg-sand": !r
|
|
430
430
|
}
|
|
431
431
|
),
|
|
432
|
-
children: /* @__PURE__ */
|
|
432
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
|
|
433
433
|
/* @__PURE__ */ e(
|
|
434
434
|
ee,
|
|
435
435
|
{
|
|
436
|
-
id: ((
|
|
436
|
+
id: ((m = v == null ? void 0 : v.user) == null ? void 0 : m.id) || t.id || "unknown",
|
|
437
437
|
name: b,
|
|
438
|
-
image:
|
|
438
|
+
image: y,
|
|
439
439
|
size: 44,
|
|
440
440
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
441
441
|
}
|
|
442
442
|
),
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
443
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
444
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
|
|
445
445
|
/* @__PURE__ */ e(
|
|
446
446
|
"h3",
|
|
447
447
|
{
|
|
448
448
|
className: R(
|
|
449
449
|
"text-sm font-medium truncate",
|
|
450
|
-
|
|
450
|
+
r ? "text-primary" : "text-charcoal"
|
|
451
451
|
),
|
|
452
452
|
children: b
|
|
453
453
|
}
|
|
454
454
|
),
|
|
455
|
-
|
|
455
|
+
p && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: p })
|
|
456
456
|
] }),
|
|
457
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
458
458
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: C }),
|
|
459
|
-
|
|
459
|
+
N > 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: N > 99 ? "99+" : N })
|
|
460
460
|
] })
|
|
461
461
|
] })
|
|
462
462
|
] })
|
|
@@ -464,21 +464,21 @@ const ee = ({
|
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
);
|
|
467
|
-
|
|
468
|
-
const
|
|
467
|
+
ze.displayName = "CustomChannelPreview";
|
|
468
|
+
const We = A.memo(
|
|
469
469
|
({
|
|
470
470
|
onChannelSelect: t,
|
|
471
471
|
selectedChannel: s,
|
|
472
472
|
filters: n,
|
|
473
|
-
className:
|
|
473
|
+
className: a,
|
|
474
474
|
customEmptyStateIndicator: l,
|
|
475
|
-
renderMessagePreview:
|
|
475
|
+
renderMessagePreview: d
|
|
476
476
|
}) => {
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
const { debug:
|
|
480
|
-
|
|
481
|
-
renderCount:
|
|
477
|
+
const r = A.useRef(0);
|
|
478
|
+
r.current++;
|
|
479
|
+
const { debug: u = !1 } = ve();
|
|
480
|
+
u && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
481
|
+
renderCount: r.current,
|
|
482
482
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
483
483
|
filters: n
|
|
484
484
|
});
|
|
@@ -486,25 +486,25 @@ const Ve = A.memo(
|
|
|
486
486
|
() => ({
|
|
487
487
|
selectedChannel: s,
|
|
488
488
|
onChannelSelect: t,
|
|
489
|
-
debug:
|
|
490
|
-
renderMessagePreview:
|
|
489
|
+
debug: u,
|
|
490
|
+
renderMessagePreview: d
|
|
491
491
|
}),
|
|
492
|
-
[s, t,
|
|
492
|
+
[s, t, u, d]
|
|
493
493
|
);
|
|
494
494
|
return /* @__PURE__ */ e(
|
|
495
495
|
"div",
|
|
496
496
|
{
|
|
497
497
|
className: R(
|
|
498
498
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
499
|
-
|
|
499
|
+
a
|
|
500
500
|
),
|
|
501
|
-
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
502
|
-
|
|
501
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(Qt, { value: g, children: /* @__PURE__ */ e(
|
|
502
|
+
it,
|
|
503
503
|
{
|
|
504
504
|
filters: n,
|
|
505
505
|
sort: { last_message_at: -1 },
|
|
506
506
|
options: { limit: 30 },
|
|
507
|
-
Preview:
|
|
507
|
+
Preview: ze,
|
|
508
508
|
EmptyStateIndicator: l
|
|
509
509
|
},
|
|
510
510
|
JSON.stringify(n)
|
|
@@ -513,12 +513,12 @@ const Ve = A.memo(
|
|
|
513
513
|
);
|
|
514
514
|
}
|
|
515
515
|
);
|
|
516
|
-
|
|
517
|
-
const
|
|
516
|
+
We.displayName = "ChannelList";
|
|
517
|
+
const xe = ({
|
|
518
518
|
variant: t = "default",
|
|
519
519
|
className: s,
|
|
520
520
|
children: n,
|
|
521
|
-
...
|
|
521
|
+
...a
|
|
522
522
|
}) => /* @__PURE__ */ e(
|
|
523
523
|
"button",
|
|
524
524
|
{
|
|
@@ -528,24 +528,24 @@ const ge = ({
|
|
|
528
528
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
529
529
|
s
|
|
530
530
|
),
|
|
531
|
-
...
|
|
531
|
+
...a,
|
|
532
532
|
children: n
|
|
533
533
|
}
|
|
534
534
|
);
|
|
535
|
-
function
|
|
536
|
-
return /* @__PURE__ */
|
|
535
|
+
function qe({ label: t, className: s, children: n, ...a }) {
|
|
536
|
+
return /* @__PURE__ */ c(
|
|
537
537
|
"button",
|
|
538
538
|
{
|
|
539
539
|
type: "button",
|
|
540
540
|
className: R(
|
|
541
541
|
"rounded-full p-2 transition-colors focus-ring",
|
|
542
542
|
{
|
|
543
|
-
"cursor-not-allowed opacity-50":
|
|
544
|
-
"hover:bg-sand": !
|
|
543
|
+
"cursor-not-allowed opacity-50": a.disabled,
|
|
544
|
+
"hover:bg-sand": !a.disabled
|
|
545
545
|
},
|
|
546
546
|
s
|
|
547
547
|
),
|
|
548
|
-
...
|
|
548
|
+
...a,
|
|
549
549
|
children: [
|
|
550
550
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
551
551
|
n
|
|
@@ -553,41 +553,41 @@ function ze({ label: t, className: s, children: n, ...r }) {
|
|
|
553
553
|
}
|
|
554
554
|
);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
return /* @__PURE__ */ e(
|
|
558
|
-
}
|
|
559
|
-
const os = (t) => /* @__PURE__ */ e(lt, { ...t, position: "center" }), Ee = "vote_up", _e = "vote_down";
|
|
560
|
-
function ls(t) {
|
|
561
|
-
return t != null && t.length ? t.some((s) => s.type === _e) ? "down" : t.some((s) => s.type === Ee) ? "up" : null : null;
|
|
556
|
+
function Ye({ onClick: t }) {
|
|
557
|
+
return /* @__PURE__ */ e(qe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
562
558
|
}
|
|
559
|
+
const ls = (t) => /* @__PURE__ */ e(ct, { ...t, position: "center" }), _e = "vote_up", Ie = "vote_down";
|
|
563
560
|
function is(t) {
|
|
564
|
-
|
|
565
|
-
|
|
561
|
+
return t != null && t.length ? t.some((s) => s.type === Ie) ? "down" : t.some((s) => s.type === _e) ? "up" : null : null;
|
|
562
|
+
}
|
|
563
|
+
function cs(t) {
|
|
564
|
+
const { channel: s } = Se(), { client: n } = $e("useMessageVote"), a = Ee(
|
|
565
|
+
() => is(t.own_reactions),
|
|
566
566
|
[t.own_reactions]
|
|
567
|
-
), l =
|
|
567
|
+
), l = L(async () => {
|
|
568
568
|
if (n != null && n.userID)
|
|
569
569
|
try {
|
|
570
|
-
|
|
570
|
+
a === "up" ? await s.deleteReaction(t.id, _e) : await s.sendReaction(
|
|
571
571
|
t.id,
|
|
572
|
-
{ type:
|
|
572
|
+
{ type: _e },
|
|
573
573
|
{ enforce_unique: !0, skip_push: !0 }
|
|
574
574
|
);
|
|
575
575
|
} catch {
|
|
576
576
|
}
|
|
577
|
-
}, [s, n == null ? void 0 : n.userID, t.id,
|
|
577
|
+
}, [s, n == null ? void 0 : n.userID, t.id, a]), d = L(async () => {
|
|
578
578
|
if (n != null && n.userID)
|
|
579
579
|
try {
|
|
580
|
-
|
|
580
|
+
a === "down" ? await s.deleteReaction(t.id, Ie) : await s.sendReaction(
|
|
581
581
|
t.id,
|
|
582
|
-
{ type:
|
|
582
|
+
{ type: Ie },
|
|
583
583
|
{ enforce_unique: !0, skip_push: !0 }
|
|
584
584
|
);
|
|
585
585
|
} catch {
|
|
586
586
|
}
|
|
587
|
-
}, [s, n == null ? void 0 : n.userID, t.id,
|
|
588
|
-
return { selected:
|
|
587
|
+
}, [s, n == null ? void 0 : n.userID, t.id, a]);
|
|
588
|
+
return { selected: a, voteUp: l, voteDown: d };
|
|
589
589
|
}
|
|
590
|
-
const
|
|
590
|
+
const ds = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
591
591
|
"path",
|
|
592
592
|
{
|
|
593
593
|
d: "M4.667 7.333l2.666-6A1.333 1.333 0 018.667 2v2.667a.667.667 0 00.666.666h3.764a1.334 1.334 0 011.192 1.93l-2.333 4.666a1.333 1.333 0 01-1.193.738H4.667m0-5.334v5.334m0-5.334H2.667a1.333 1.333 0 00-1.334 1.334v2.666a1.333 1.333 0 001.334 1.334h2",
|
|
@@ -597,7 +597,7 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
597
597
|
strokeLinejoin: "round",
|
|
598
598
|
fill: t ? "currentColor" : "none"
|
|
599
599
|
}
|
|
600
|
-
) }),
|
|
600
|
+
) }), us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
601
601
|
"path",
|
|
602
602
|
{
|
|
603
603
|
d: "M11.333 8.667l-2.666 6A1.333 1.333 0 017.333 14v-2.667a.667.667 0 00-.666-.666H2.903a1.334 1.334 0 01-1.192-1.93l2.333-4.666a1.333 1.333 0 011.193-.738h6.096m0 5.334V3.333m0 5.334h2a1.333 1.333 0 001.334-1.334V4.667a1.333 1.333 0 00-1.334-1.334h-2",
|
|
@@ -607,11 +607,11 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
607
607
|
strokeLinejoin: "round",
|
|
608
608
|
fill: t ? "currentColor" : "none"
|
|
609
609
|
}
|
|
610
|
-
) }),
|
|
610
|
+
) }), ms = ({
|
|
611
611
|
selected: t,
|
|
612
612
|
onVoteUp: s,
|
|
613
613
|
onVoteDown: n
|
|
614
|
-
}) => /* @__PURE__ */
|
|
614
|
+
}) => /* @__PURE__ */ c("div", { className: "message-vote-buttons", children: [
|
|
615
615
|
/* @__PURE__ */ e(
|
|
616
616
|
"button",
|
|
617
617
|
{
|
|
@@ -620,7 +620,7 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
620
620
|
onClick: s,
|
|
621
621
|
"aria-label": "Helpful",
|
|
622
622
|
"aria-pressed": t === "up",
|
|
623
|
-
children: /* @__PURE__ */ e(
|
|
623
|
+
children: /* @__PURE__ */ e(ds, { filled: t === "up" })
|
|
624
624
|
}
|
|
625
625
|
),
|
|
626
626
|
/* @__PURE__ */ e(
|
|
@@ -631,191 +631,191 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
631
631
|
onClick: n,
|
|
632
632
|
"aria-label": "Not helpful",
|
|
633
633
|
"aria-pressed": t === "down",
|
|
634
|
-
children: /* @__PURE__ */ e(
|
|
634
|
+
children: /* @__PURE__ */ e(us, { filled: t === "down" })
|
|
635
635
|
}
|
|
636
636
|
)
|
|
637
|
-
] }),
|
|
638
|
-
var
|
|
637
|
+
] }), hs = (t) => {
|
|
638
|
+
var ue, me;
|
|
639
639
|
const {
|
|
640
640
|
additionalMessageInputProps: s,
|
|
641
641
|
chatbotVotingEnabled: n,
|
|
642
|
-
editing:
|
|
642
|
+
editing: a,
|
|
643
643
|
endOfGroup: l,
|
|
644
|
-
firstOfGroup:
|
|
645
|
-
groupedByUser:
|
|
646
|
-
handleAction:
|
|
644
|
+
firstOfGroup: d,
|
|
645
|
+
groupedByUser: r,
|
|
646
|
+
handleAction: u,
|
|
647
647
|
handleOpenThread: g,
|
|
648
648
|
handleRetry: x,
|
|
649
|
-
highlighted:
|
|
649
|
+
highlighted: v,
|
|
650
650
|
isMessageAIGenerated: b,
|
|
651
|
-
isMyMessage:
|
|
652
|
-
message:
|
|
653
|
-
renderText:
|
|
651
|
+
isMyMessage: y,
|
|
652
|
+
message: o,
|
|
653
|
+
renderText: w,
|
|
654
654
|
threadList: I
|
|
655
|
-
} = t, { client:
|
|
656
|
-
Attachment:
|
|
657
|
-
EditMessageModal:
|
|
658
|
-
MessageBlocked:
|
|
659
|
-
MessageBouncePrompt:
|
|
660
|
-
MessageDeleted:
|
|
661
|
-
MessageIsThreadReplyInChannelButtonIndicator:
|
|
662
|
-
MessageRepliesCountButton:
|
|
663
|
-
ReminderNotification:
|
|
664
|
-
StreamedMessageText:
|
|
665
|
-
PinIndicator:
|
|
666
|
-
} =
|
|
667
|
-
() => b == null ? void 0 : b(
|
|
668
|
-
[b,
|
|
669
|
-
),
|
|
670
|
-
() => !
|
|
671
|
-
[
|
|
655
|
+
} = t, { client: p } = $e("CustomMessage"), [M, C] = S(!1), N = ut(o.id), { selected: f, voteUp: k, voteDown: h } = cs(o), {
|
|
656
|
+
Attachment: m = ht,
|
|
657
|
+
EditMessageModal: i = ft,
|
|
658
|
+
MessageBlocked: E = gt,
|
|
659
|
+
MessageBouncePrompt: D = xt,
|
|
660
|
+
MessageDeleted: j = bt,
|
|
661
|
+
MessageIsThreadReplyInChannelButtonIndicator: W = Ct,
|
|
662
|
+
MessageRepliesCountButton: T = Nt,
|
|
663
|
+
ReminderNotification: q = vt,
|
|
664
|
+
StreamedMessageText: G = wt,
|
|
665
|
+
PinIndicator: X
|
|
666
|
+
} = mt("CustomMessage"), te = pt(o), se = yt(o), ne = Ee(
|
|
667
|
+
() => b == null ? void 0 : b(o),
|
|
668
|
+
[b, o]
|
|
669
|
+
), z = Ee(
|
|
670
|
+
() => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
|
|
671
|
+
[o]
|
|
672
672
|
);
|
|
673
|
-
if (
|
|
673
|
+
if (Et(o))
|
|
674
674
|
return null;
|
|
675
|
-
if (
|
|
676
|
-
return /* @__PURE__ */ e(
|
|
677
|
-
if (
|
|
678
|
-
return /* @__PURE__ */ e(
|
|
679
|
-
const Q = !I && !!
|
|
680
|
-
let
|
|
681
|
-
|
|
682
|
-
const
|
|
675
|
+
if (o.deleted_at || o.type === "deleted")
|
|
676
|
+
return /* @__PURE__ */ e(j, { message: o });
|
|
677
|
+
if (_t(o))
|
|
678
|
+
return /* @__PURE__ */ e(E, {});
|
|
679
|
+
const Q = !I && !!o.reply_count, P = !I && o.show_in_channel && o.parent_id, U = o.status === "failed" && ((ue = o.error) == null ? void 0 : ue.status) !== 403, V = It(o);
|
|
680
|
+
let B;
|
|
681
|
+
U ? B = () => x(o) : V && (B = () => C(!0));
|
|
682
|
+
const O = y(), ae = R(
|
|
683
683
|
"str-chat__message str-chat__message-simple",
|
|
684
|
-
`str-chat__message--${
|
|
685
|
-
`str-chat__message--${
|
|
686
|
-
|
|
687
|
-
|
|
684
|
+
`str-chat__message--${o.type}`,
|
|
685
|
+
`str-chat__message--${o.status}`,
|
|
686
|
+
O ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
687
|
+
o.text ? "str-chat__message--has-text" : "has-no-text",
|
|
688
688
|
{
|
|
689
|
-
"str-chat__message--has-attachment":
|
|
690
|
-
"str-chat__message--highlighted":
|
|
691
|
-
"str-chat__message--pinned pinned-message":
|
|
692
|
-
"str-chat__message--with-reactions":
|
|
693
|
-
"str-chat__message-send-can-be-retried": (
|
|
694
|
-
"str-chat__message-with-thread-link": Q ||
|
|
689
|
+
"str-chat__message--has-attachment": te,
|
|
690
|
+
"str-chat__message--highlighted": v,
|
|
691
|
+
"str-chat__message--pinned pinned-message": o.pinned,
|
|
692
|
+
"str-chat__message--with-reactions": se,
|
|
693
|
+
"str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((me = o == null ? void 0 : o.error) == null ? void 0 : me.status) !== 403,
|
|
694
|
+
"str-chat__message-with-thread-link": Q || P,
|
|
695
695
|
"str-chat__virtual-message__wrapper--end": l,
|
|
696
|
-
"str-chat__virtual-message__wrapper--first":
|
|
697
|
-
"str-chat__virtual-message__wrapper--group":
|
|
696
|
+
"str-chat__virtual-message__wrapper--first": d,
|
|
697
|
+
"str-chat__virtual-message__wrapper--group": r
|
|
698
698
|
}
|
|
699
|
-
),
|
|
700
|
-
return /* @__PURE__ */
|
|
701
|
-
|
|
702
|
-
|
|
699
|
+
), ie = o.poll_id && p.polls.fromState(o.poll_id), K = os(o), Y = ke(o), re = !!(z != null && z.length && !o.quoted_message), ce = Y && O && re;
|
|
700
|
+
return /* @__PURE__ */ c(de, { children: [
|
|
701
|
+
a && /* @__PURE__ */ e(
|
|
702
|
+
i,
|
|
703
703
|
{
|
|
704
704
|
additionalMessageInputProps: s
|
|
705
705
|
}
|
|
706
706
|
),
|
|
707
|
-
|
|
708
|
-
|
|
707
|
+
M && /* @__PURE__ */ e(
|
|
708
|
+
St,
|
|
709
709
|
{
|
|
710
|
-
MessageBouncePrompt:
|
|
710
|
+
MessageBouncePrompt: D,
|
|
711
711
|
onClose: () => C(!1),
|
|
712
|
-
open:
|
|
712
|
+
open: M
|
|
713
713
|
}
|
|
714
714
|
),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
!!
|
|
718
|
-
|
|
715
|
+
/* @__PURE__ */ c("div", { className: ae, children: [
|
|
716
|
+
X && /* @__PURE__ */ e(X, {}),
|
|
717
|
+
!!N && /* @__PURE__ */ e(q, { reminder: N }),
|
|
718
|
+
o.user && /* @__PURE__ */ e(
|
|
719
719
|
ee,
|
|
720
720
|
{
|
|
721
721
|
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
722
|
-
id:
|
|
723
|
-
image:
|
|
724
|
-
name:
|
|
722
|
+
id: o.user.id,
|
|
723
|
+
image: o.user.image,
|
|
724
|
+
name: o.user.name || o.user.id
|
|
725
725
|
}
|
|
726
726
|
),
|
|
727
727
|
/* @__PURE__ */ e(
|
|
728
728
|
"div",
|
|
729
729
|
{
|
|
730
730
|
className: R("str-chat__message-inner", {
|
|
731
|
-
"str-chat__simple-message--error-failed":
|
|
731
|
+
"str-chat__simple-message--error-failed": U || V
|
|
732
732
|
}),
|
|
733
733
|
"data-testid": "message-inner",
|
|
734
|
-
onClick:
|
|
735
|
-
onKeyDown:
|
|
736
|
-
role:
|
|
737
|
-
tabIndex:
|
|
734
|
+
onClick: B,
|
|
735
|
+
onKeyDown: B,
|
|
736
|
+
role: B ? "button" : void 0,
|
|
737
|
+
tabIndex: B ? 0 : void 0,
|
|
738
738
|
style: {
|
|
739
739
|
// Force margins to 0 to prevent hover layout shift
|
|
740
740
|
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
741
741
|
marginInlineEnd: 0,
|
|
742
742
|
marginInlineStart: 0
|
|
743
743
|
},
|
|
744
|
-
children:
|
|
744
|
+
children: K ? (
|
|
745
745
|
/* Tip-only messages render as a standalone bubble */
|
|
746
|
-
/* @__PURE__ */ e(
|
|
747
|
-
) : /* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
|
|
750
|
-
|
|
746
|
+
/* @__PURE__ */ e(ye, { message: o, standalone: !0 })
|
|
747
|
+
) : /* @__PURE__ */ c("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
748
|
+
/* @__PURE__ */ c("div", { className: "str-chat__message-bubble", children: [
|
|
749
|
+
Y && !ce && /* @__PURE__ */ e(
|
|
750
|
+
ye,
|
|
751
751
|
{
|
|
752
|
-
message:
|
|
752
|
+
message: o,
|
|
753
753
|
hasAttachment: re,
|
|
754
|
-
isMyMessage:
|
|
754
|
+
isMyMessage: O
|
|
755
755
|
}
|
|
756
756
|
),
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
757
|
+
ie && /* @__PURE__ */ e(Mt, { poll: ie }),
|
|
758
|
+
z != null && z.length && !o.quoted_message ? /* @__PURE__ */ e(
|
|
759
|
+
m,
|
|
760
760
|
{
|
|
761
|
-
actionHandler:
|
|
762
|
-
attachments:
|
|
761
|
+
actionHandler: u,
|
|
762
|
+
attachments: z
|
|
763
763
|
}
|
|
764
764
|
) : null,
|
|
765
|
-
|
|
766
|
-
|
|
765
|
+
ne ? /* @__PURE__ */ e(
|
|
766
|
+
G,
|
|
767
767
|
{
|
|
768
|
-
message:
|
|
769
|
-
renderText:
|
|
768
|
+
message: o,
|
|
769
|
+
renderText: w
|
|
770
770
|
}
|
|
771
|
-
) : /* @__PURE__ */ e(
|
|
772
|
-
/* @__PURE__ */ e(
|
|
771
|
+
) : /* @__PURE__ */ e(kt, { message: o, renderText: w }),
|
|
772
|
+
/* @__PURE__ */ e(Dt, {})
|
|
773
773
|
] }),
|
|
774
|
-
(!
|
|
775
|
-
|
|
774
|
+
(!Y || ce) && /* @__PURE__ */ e(
|
|
775
|
+
ye,
|
|
776
776
|
{
|
|
777
|
-
message:
|
|
777
|
+
message: o,
|
|
778
778
|
hasAttachment: re,
|
|
779
|
-
isMyMessage:
|
|
779
|
+
isMyMessage: O
|
|
780
780
|
}
|
|
781
781
|
),
|
|
782
|
-
n &&
|
|
783
|
-
|
|
782
|
+
n && Y && /* @__PURE__ */ e(
|
|
783
|
+
ms,
|
|
784
784
|
{
|
|
785
|
-
selected:
|
|
786
|
-
onVoteUp:
|
|
787
|
-
onVoteDown:
|
|
785
|
+
selected: f,
|
|
786
|
+
onVoteUp: k,
|
|
787
|
+
onVoteDown: h
|
|
788
788
|
}
|
|
789
789
|
)
|
|
790
790
|
] })
|
|
791
791
|
}
|
|
792
792
|
),
|
|
793
793
|
Q && /* @__PURE__ */ e(
|
|
794
|
-
|
|
794
|
+
T,
|
|
795
795
|
{
|
|
796
796
|
onClick: g,
|
|
797
|
-
reply_count:
|
|
797
|
+
reply_count: o.reply_count
|
|
798
798
|
}
|
|
799
799
|
),
|
|
800
|
-
|
|
801
|
-
] },
|
|
800
|
+
P && /* @__PURE__ */ e(W, {})
|
|
801
|
+
] }, o.id)
|
|
802
802
|
] });
|
|
803
|
-
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
),
|
|
807
|
-
const s =
|
|
808
|
-
return /* @__PURE__ */ e(
|
|
809
|
-
},
|
|
803
|
+
}, fs = A.memo(
|
|
804
|
+
hs,
|
|
805
|
+
dt
|
|
806
|
+
), gs = (t) => {
|
|
807
|
+
const s = je("CustomMessage");
|
|
808
|
+
return /* @__PURE__ */ e(fs, { ...s, ...t });
|
|
809
|
+
}, xs = (t) => ({
|
|
810
810
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
811
|
-
(s) =>
|
|
811
|
+
(s) => Oe.previewIsLoaded(s) || Oe.previewIsLoading(s)
|
|
812
812
|
)
|
|
813
|
-
}),
|
|
813
|
+
}), bs = ({
|
|
814
814
|
link: t,
|
|
815
815
|
onDismiss: s
|
|
816
816
|
}) => {
|
|
817
|
-
const { og_scrape_url: n, title:
|
|
818
|
-
return /* @__PURE__ */
|
|
817
|
+
const { og_scrape_url: n, title: a, image_url: l } = t;
|
|
818
|
+
return /* @__PURE__ */ c(
|
|
819
819
|
"a",
|
|
820
820
|
{
|
|
821
821
|
href: n,
|
|
@@ -827,7 +827,7 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
827
827
|
"img",
|
|
828
828
|
{
|
|
829
829
|
src: l,
|
|
830
|
-
alt:
|
|
830
|
+
alt: a || "",
|
|
831
831
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
832
832
|
}
|
|
833
833
|
),
|
|
@@ -835,47 +835,47 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
835
835
|
"button",
|
|
836
836
|
{
|
|
837
837
|
type: "button",
|
|
838
|
-
onClick: (
|
|
839
|
-
|
|
838
|
+
onClick: (r) => {
|
|
839
|
+
r.preventDefault(), s(n);
|
|
840
840
|
},
|
|
841
841
|
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",
|
|
842
842
|
"aria-label": "Close link preview",
|
|
843
|
-
children: /* @__PURE__ */ e(
|
|
843
|
+
children: /* @__PURE__ */ e(Me, { className: "size-4 text-black/90" })
|
|
844
844
|
}
|
|
845
845
|
),
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
|
|
846
|
+
/* @__PURE__ */ c("div", { className: "p-2", children: [
|
|
847
|
+
a && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: a }),
|
|
848
848
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
849
849
|
] })
|
|
850
850
|
]
|
|
851
851
|
}
|
|
852
852
|
);
|
|
853
|
-
},
|
|
854
|
-
const { linkPreviewsManager: t } =
|
|
853
|
+
}, Cs = () => {
|
|
854
|
+
const { linkPreviewsManager: t } = Tt(), { linkPreviews: s } = Rt(
|
|
855
855
|
t.state,
|
|
856
|
-
|
|
856
|
+
xs
|
|
857
857
|
), n = (l) => {
|
|
858
858
|
t.dismissPreview(l);
|
|
859
859
|
};
|
|
860
860
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((l) => /* @__PURE__ */ e(
|
|
861
|
-
|
|
861
|
+
bs,
|
|
862
862
|
{
|
|
863
863
|
link: l,
|
|
864
864
|
onDismiss: n
|
|
865
865
|
},
|
|
866
866
|
l.og_scrape_url
|
|
867
867
|
)) }) : null;
|
|
868
|
-
},
|
|
869
|
-
const { handleSubmit: t } =
|
|
870
|
-
return /* @__PURE__ */
|
|
871
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */ e(Ft, {}),
|
|
874
|
-
/* @__PURE__ */ e(bs, {}),
|
|
868
|
+
}, Ns = () => {
|
|
869
|
+
const { handleSubmit: t } = Pt(), s = Ut();
|
|
870
|
+
return /* @__PURE__ */ c(de, { children: [
|
|
871
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ft, {}) }),
|
|
872
|
+
/* @__PURE__ */ c("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
875
873
|
/* @__PURE__ */ e(Ot, {}),
|
|
876
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ e(Cs, {}),
|
|
875
|
+
/* @__PURE__ */ e(At, {}),
|
|
876
|
+
/* @__PURE__ */ c("div", { className: "flex", children: [
|
|
877
877
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
878
|
-
|
|
878
|
+
Bt,
|
|
879
879
|
{
|
|
880
880
|
className: "w-full resize-none outline-none leading-6",
|
|
881
881
|
autoFocus: !0,
|
|
@@ -891,38 +891,38 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
891
891
|
disabled: !s,
|
|
892
892
|
onClick: t,
|
|
893
893
|
type: "button",
|
|
894
|
-
children: /* @__PURE__ */ e(
|
|
894
|
+
children: /* @__PURE__ */ e(zt, { className: "size-4" })
|
|
895
895
|
}
|
|
896
896
|
)
|
|
897
897
|
] })
|
|
898
898
|
] })
|
|
899
899
|
] });
|
|
900
|
-
},
|
|
900
|
+
}, vs = ({
|
|
901
901
|
renderActions: t
|
|
902
|
-
}) => /* @__PURE__ */
|
|
902
|
+
}) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
903
903
|
t && (t == null ? void 0 : t()),
|
|
904
|
-
/* @__PURE__ */ e(
|
|
905
|
-
] }),
|
|
904
|
+
/* @__PURE__ */ e(Lt, { Input: Ns })
|
|
905
|
+
] }), ws = [
|
|
906
906
|
"SYSTEM_DM_AGENT_PAUSED",
|
|
907
907
|
"SYSTEM_DM_AGENT_RESUMED"
|
|
908
|
-
],
|
|
908
|
+
], ps = {
|
|
909
909
|
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
910
910
|
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
911
|
-
},
|
|
912
|
-
var
|
|
913
|
-
const s = (
|
|
914
|
-
if (
|
|
911
|
+
}, Be = (t) => ws.includes(t), ys = (t) => {
|
|
912
|
+
var a;
|
|
913
|
+
const s = (a = t.metadata) == null ? void 0 : a.custom_type;
|
|
914
|
+
if (Be(s))
|
|
915
915
|
return s;
|
|
916
916
|
const n = t.dm_agent_system_type;
|
|
917
|
-
if (
|
|
917
|
+
if (Be(n))
|
|
918
918
|
return n;
|
|
919
|
-
},
|
|
920
|
-
var
|
|
921
|
-
const s = t.message.hide_date === !0, n =
|
|
919
|
+
}, Es = (t) => {
|
|
920
|
+
var a;
|
|
921
|
+
const s = t.message.hide_date === !0, n = ys(t.message);
|
|
922
922
|
if (n) {
|
|
923
|
-
const l = ((
|
|
924
|
-
return /* @__PURE__ */
|
|
925
|
-
/* @__PURE__ */
|
|
923
|
+
const l = ((a = t.message.text) == null ? void 0 : a.trim()) || ps[n];
|
|
924
|
+
return /* @__PURE__ */ c("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
925
|
+
/* @__PURE__ */ c(
|
|
926
926
|
"div",
|
|
927
927
|
{
|
|
928
928
|
className: "mes-dm-agent-system-message",
|
|
@@ -930,7 +930,7 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
930
930
|
"data-dm-agent-system-type": n,
|
|
931
931
|
children: [
|
|
932
932
|
/* @__PURE__ */ e(
|
|
933
|
-
|
|
933
|
+
Wt,
|
|
934
934
|
{
|
|
935
935
|
size: 16,
|
|
936
936
|
weight: "regular",
|
|
@@ -942,23 +942,23 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
942
942
|
]
|
|
943
943
|
}
|
|
944
944
|
),
|
|
945
|
-
!s && /* @__PURE__ */ e(
|
|
945
|
+
!s && /* @__PURE__ */ e(Te, { message: t.message })
|
|
946
946
|
] });
|
|
947
947
|
}
|
|
948
|
-
return /* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ c("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
949
|
+
/* @__PURE__ */ c("div", { className: "str-chat__message--system__text", children: [
|
|
950
950
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
951
951
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
952
952
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
953
953
|
] }),
|
|
954
|
-
!s && /* @__PURE__ */ e(
|
|
954
|
+
!s && /* @__PURE__ */ e(Te, { message: t.message })
|
|
955
955
|
] });
|
|
956
|
-
},
|
|
956
|
+
}, _s = () => null, Is = ({ className: t, message: s }) => /* @__PURE__ */ c(
|
|
957
957
|
"div",
|
|
958
958
|
{
|
|
959
959
|
className: R("flex items-center justify-center h-full", t),
|
|
960
960
|
children: [
|
|
961
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
962
962
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
963
963
|
"animateTransform",
|
|
964
964
|
{
|
|
@@ -996,41 +996,41 @@ const cs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
996
996
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
997
997
|
]
|
|
998
998
|
}
|
|
999
|
-
),
|
|
1000
|
-
/* @__PURE__ */ e(
|
|
999
|
+
), Ne = A.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1000
|
+
/* @__PURE__ */ e(Is, { className: "w-6 h-6" }),
|
|
1001
1001
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1002
1002
|
] }) }));
|
|
1003
|
-
|
|
1004
|
-
const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150",
|
|
1003
|
+
Ne.displayName = "LoadingState";
|
|
1004
|
+
const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150", Ss = ({
|
|
1005
1005
|
onBack: t,
|
|
1006
1006
|
showBackButton: s,
|
|
1007
1007
|
onShowInfo: n,
|
|
1008
|
-
canShowInfo:
|
|
1008
|
+
canShowInfo: a,
|
|
1009
1009
|
showStarButton: l = !1
|
|
1010
1010
|
}) => {
|
|
1011
|
-
var
|
|
1012
|
-
const { channel:
|
|
1013
|
-
(
|
|
1014
|
-
var
|
|
1015
|
-
return ((
|
|
1011
|
+
var y, o, w, I, p, M;
|
|
1012
|
+
const { channel: d } = Se(), r = A.useMemo(() => Object.values(d.state.members || {}).find(
|
|
1013
|
+
(N) => {
|
|
1014
|
+
var f;
|
|
1015
|
+
return ((f = N.user) == null ? void 0 : f.id) && N.user.id !== d._client.userID;
|
|
1016
1016
|
}
|
|
1017
|
-
), [
|
|
1018
|
-
!!((I =
|
|
1017
|
+
), [d._client.userID, d.state.members]), u = ((y = r == null ? void 0 : r.user) == null ? void 0 : y.name) || ((o = r == null ? void 0 : r.user) == null ? void 0 : o.id) || "Unknown member", g = (w = r == null ? void 0 : r.user) == null ? void 0 : w.image, [x, v] = S(
|
|
1018
|
+
!!((I = d.state.membership) != null && I.pinned_at)
|
|
1019
1019
|
);
|
|
1020
|
-
|
|
1021
|
-
const C = (
|
|
1022
|
-
var
|
|
1023
|
-
|
|
1024
|
-
|
|
1020
|
+
J(() => {
|
|
1021
|
+
const C = (N) => {
|
|
1022
|
+
var f;
|
|
1023
|
+
v(
|
|
1024
|
+
N != null && N.member ? !!N.member.pinned_at : !!((f = d.state.membership) != null && f.pinned_at)
|
|
1025
1025
|
);
|
|
1026
1026
|
};
|
|
1027
|
-
return
|
|
1028
|
-
|
|
1027
|
+
return d.on("member.updated", C), () => {
|
|
1028
|
+
d.off("member.updated", C);
|
|
1029
1029
|
};
|
|
1030
|
-
}, [
|
|
1030
|
+
}, [d]);
|
|
1031
1031
|
const b = async () => {
|
|
1032
1032
|
try {
|
|
1033
|
-
x ? await
|
|
1033
|
+
x ? await d.unpin() : await d.pin();
|
|
1034
1034
|
} catch (C) {
|
|
1035
1035
|
console.error(
|
|
1036
1036
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
@@ -1038,8 +1038,8 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1038
1038
|
);
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1041
|
+
return /* @__PURE__ */ c("div", { className: "@container", children: [
|
|
1042
|
+
/* @__PURE__ */ c("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
|
|
1043
1043
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
|
|
1044
1044
|
"button",
|
|
1045
1045
|
{
|
|
@@ -1048,22 +1048,22 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1048
1048
|
}),
|
|
1049
1049
|
type: "button",
|
|
1050
1050
|
"aria-label": "Back to conversations",
|
|
1051
|
-
children: /* @__PURE__ */ e(
|
|
1051
|
+
children: /* @__PURE__ */ e(Re, { className: "size-5 text-black/90" })
|
|
1052
1052
|
}
|
|
1053
1053
|
) }),
|
|
1054
|
-
/* @__PURE__ */
|
|
1054
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
1055
1055
|
/* @__PURE__ */ e(
|
|
1056
1056
|
ee,
|
|
1057
1057
|
{
|
|
1058
|
-
id: ((
|
|
1059
|
-
name:
|
|
1058
|
+
id: ((p = r == null ? void 0 : r.user) == null ? void 0 : p.id) || d.id || "unknown",
|
|
1059
|
+
name: u,
|
|
1060
1060
|
image: g,
|
|
1061
1061
|
size: 40
|
|
1062
1062
|
}
|
|
1063
1063
|
),
|
|
1064
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
1064
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: u })
|
|
1065
1065
|
] }),
|
|
1066
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ c("div", { className: "flex justify-end items-center gap-2", children: [
|
|
1067
1067
|
l && /* @__PURE__ */ e(
|
|
1068
1068
|
"button",
|
|
1069
1069
|
{
|
|
@@ -1072,7 +1072,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1072
1072
|
type: "button",
|
|
1073
1073
|
"aria-label": x ? "Unstar conversation" : "Star conversation",
|
|
1074
1074
|
children: /* @__PURE__ */ e(
|
|
1075
|
-
|
|
1075
|
+
Le,
|
|
1076
1076
|
{
|
|
1077
1077
|
className: R("size-5", {
|
|
1078
1078
|
"text-yellow-600": x,
|
|
@@ -1090,13 +1090,13 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1090
1090
|
onClick: n,
|
|
1091
1091
|
type: "button",
|
|
1092
1092
|
"aria-label": "Show info",
|
|
1093
|
-
children: /* @__PURE__ */ e(
|
|
1093
|
+
children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
|
|
1094
1094
|
}
|
|
1095
1095
|
)
|
|
1096
1096
|
] })
|
|
1097
1097
|
] }),
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1098
|
+
/* @__PURE__ */ c("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
1099
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
1100
1100
|
s && t && /* @__PURE__ */ e(
|
|
1101
1101
|
"button",
|
|
1102
1102
|
{
|
|
@@ -1104,21 +1104,21 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1104
1104
|
onClick: t,
|
|
1105
1105
|
className: le,
|
|
1106
1106
|
"aria-label": "Back to conversations",
|
|
1107
|
-
children: /* @__PURE__ */ e(
|
|
1107
|
+
children: /* @__PURE__ */ e(Re, { className: "size-5 text-black/90" })
|
|
1108
1108
|
}
|
|
1109
1109
|
),
|
|
1110
1110
|
/* @__PURE__ */ e(
|
|
1111
1111
|
ee,
|
|
1112
1112
|
{
|
|
1113
|
-
id: ((
|
|
1114
|
-
name:
|
|
1113
|
+
id: ((M = r == null ? void 0 : r.user) == null ? void 0 : M.id) || d.id || "unknown",
|
|
1114
|
+
name: u,
|
|
1115
1115
|
image: g,
|
|
1116
1116
|
size: 40
|
|
1117
1117
|
}
|
|
1118
1118
|
),
|
|
1119
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
1119
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: u }) })
|
|
1120
1120
|
] }),
|
|
1121
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1122
1122
|
l && /* @__PURE__ */ e(
|
|
1123
1123
|
"button",
|
|
1124
1124
|
{
|
|
@@ -1127,7 +1127,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1127
1127
|
type: "button",
|
|
1128
1128
|
"aria-label": x ? "Unstar conversation" : "Star conversation",
|
|
1129
1129
|
children: /* @__PURE__ */ e(
|
|
1130
|
-
|
|
1130
|
+
Le,
|
|
1131
1131
|
{
|
|
1132
1132
|
className: R("size-5", {
|
|
1133
1133
|
"text-yellow-600": x,
|
|
@@ -1138,101 +1138,101 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1138
1138
|
)
|
|
1139
1139
|
}
|
|
1140
1140
|
),
|
|
1141
|
-
|
|
1141
|
+
a && n && /* @__PURE__ */ e(
|
|
1142
1142
|
"button",
|
|
1143
1143
|
{
|
|
1144
1144
|
className: le,
|
|
1145
1145
|
onClick: n,
|
|
1146
1146
|
type: "button",
|
|
1147
1147
|
"aria-label": "Show info",
|
|
1148
|
-
children: /* @__PURE__ */ e(
|
|
1148
|
+
children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
|
|
1149
1149
|
}
|
|
1150
1150
|
)
|
|
1151
1151
|
] })
|
|
1152
1152
|
] })
|
|
1153
1153
|
] });
|
|
1154
|
-
},
|
|
1154
|
+
}, Ms = ({
|
|
1155
1155
|
dialogRef: t,
|
|
1156
1156
|
onClose: s,
|
|
1157
1157
|
participant: n,
|
|
1158
|
-
channel:
|
|
1158
|
+
channel: a,
|
|
1159
1159
|
followerStatusLabel: l,
|
|
1160
|
-
onLeaveConversation:
|
|
1161
|
-
onBlockParticipant:
|
|
1162
|
-
showDeleteConversation:
|
|
1160
|
+
onLeaveConversation: d,
|
|
1161
|
+
onBlockParticipant: r,
|
|
1162
|
+
showDeleteConversation: u = !0,
|
|
1163
1163
|
onDeleteConversationClick: g,
|
|
1164
1164
|
onBlockParticipantClick: x,
|
|
1165
|
-
onReportParticipantClick:
|
|
1165
|
+
onReportParticipantClick: v,
|
|
1166
1166
|
customChannelActions: b
|
|
1167
1167
|
}) => {
|
|
1168
|
-
var
|
|
1169
|
-
const { service:
|
|
1170
|
-
var
|
|
1171
|
-
if (!(!
|
|
1168
|
+
var G, X, te, se, ne, z, Q;
|
|
1169
|
+
const { service: y, debug: o } = ve(), [w, I] = S(!1), [p, M] = S(!1), [C, N] = S(!1), f = L(async () => {
|
|
1170
|
+
var P;
|
|
1171
|
+
if (!(!y || !((P = n == null ? void 0 : n.user) != null && P.id)))
|
|
1172
1172
|
try {
|
|
1173
|
-
const
|
|
1174
|
-
(
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
1173
|
+
const V = (await y.getBlockedUsers()).some(
|
|
1174
|
+
(B) => {
|
|
1175
|
+
var O;
|
|
1176
|
+
return B.blocked_user_id === ((O = n == null ? void 0 : n.user) == null ? void 0 : O.id);
|
|
1177
1177
|
}
|
|
1178
1178
|
);
|
|
1179
|
-
I(
|
|
1180
|
-
} catch (
|
|
1179
|
+
I(V);
|
|
1180
|
+
} catch (U) {
|
|
1181
1181
|
console.error(
|
|
1182
1182
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
1183
|
-
|
|
1183
|
+
U
|
|
1184
1184
|
);
|
|
1185
1185
|
}
|
|
1186
|
-
}, [
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
}, [
|
|
1190
|
-
const
|
|
1191
|
-
var
|
|
1192
|
-
if (!
|
|
1193
|
-
g == null || g(),
|
|
1186
|
+
}, [y, (G = n == null ? void 0 : n.user) == null ? void 0 : G.id]);
|
|
1187
|
+
J(() => {
|
|
1188
|
+
f();
|
|
1189
|
+
}, [f]);
|
|
1190
|
+
const k = async () => {
|
|
1191
|
+
var P;
|
|
1192
|
+
if (!p) {
|
|
1193
|
+
g == null || g(), o && console.log("[ChannelInfoDialog] Leave conversation", a.cid), M(!0);
|
|
1194
1194
|
try {
|
|
1195
|
-
const
|
|
1196
|
-
await
|
|
1197
|
-
} catch (
|
|
1198
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
1195
|
+
const U = ((P = a._client) == null ? void 0 : P.userID) ?? null;
|
|
1196
|
+
await a.hide(U, !1), d && await d(a), s();
|
|
1197
|
+
} catch (U) {
|
|
1198
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", U);
|
|
1199
1199
|
} finally {
|
|
1200
|
-
|
|
1200
|
+
M(!1);
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
|
-
},
|
|
1204
|
-
var
|
|
1205
|
-
if (!(C || !
|
|
1206
|
-
x == null || x(),
|
|
1203
|
+
}, h = async () => {
|
|
1204
|
+
var P, U, V;
|
|
1205
|
+
if (!(C || !y)) {
|
|
1206
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), N(!0);
|
|
1207
1207
|
try {
|
|
1208
|
-
await
|
|
1209
|
-
} catch (
|
|
1210
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
1208
|
+
await y.blockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
|
|
1209
|
+
} catch (B) {
|
|
1210
|
+
console.error("[ChannelInfoDialog] Failed to block member", B);
|
|
1211
1211
|
} finally {
|
|
1212
|
-
|
|
1212
|
+
N(!1);
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
},
|
|
1216
|
-
var
|
|
1217
|
-
if (!(C || !
|
|
1218
|
-
x == null || x(),
|
|
1215
|
+
}, m = async () => {
|
|
1216
|
+
var P, U, V;
|
|
1217
|
+
if (!(C || !y)) {
|
|
1218
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), N(!0);
|
|
1219
1219
|
try {
|
|
1220
|
-
await
|
|
1221
|
-
} catch (
|
|
1222
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
1220
|
+
await y.unBlockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
|
|
1221
|
+
} catch (B) {
|
|
1222
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", B);
|
|
1223
1223
|
} finally {
|
|
1224
|
-
|
|
1224
|
+
N(!1);
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
|
-
},
|
|
1228
|
-
|
|
1227
|
+
}, i = () => {
|
|
1228
|
+
v == null || v(), s(), window.open(
|
|
1229
1229
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1230
1230
|
"_blank",
|
|
1231
1231
|
"noopener,noreferrer"
|
|
1232
1232
|
);
|
|
1233
1233
|
};
|
|
1234
1234
|
if (!n) return null;
|
|
1235
|
-
const
|
|
1235
|
+
const E = ((X = n.user) == null ? void 0 : X.name) || ((te = n.user) == null ? void 0 : te.id) || "Unknown member", D = (se = n.user) == null ? void 0 : se.image, j = (ne = n.user) == null ? void 0 : ne.email, W = (z = n.user) == null ? void 0 : z.username, T = j || (W ? `linktr.ee/${W}` : void 0), q = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
|
|
1236
1236
|
return (
|
|
1237
1237
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1238
1238
|
/* @__PURE__ */ e(
|
|
@@ -1241,34 +1241,34 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1241
1241
|
ref: t,
|
|
1242
1242
|
className: "mes-dialog group",
|
|
1243
1243
|
onClose: s,
|
|
1244
|
-
onClick: (
|
|
1245
|
-
|
|
1244
|
+
onClick: (P) => {
|
|
1245
|
+
P.target === t.current && s();
|
|
1246
1246
|
},
|
|
1247
|
-
children: /* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1247
|
+
children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
1248
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
1249
1249
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
1250
|
-
/* @__PURE__ */ e(
|
|
1250
|
+
/* @__PURE__ */ e(Ye, { onClick: s })
|
|
1251
1251
|
] }),
|
|
1252
|
-
/* @__PURE__ */
|
|
1252
|
+
/* @__PURE__ */ c("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
1253
1253
|
/* @__PURE__ */ e(
|
|
1254
1254
|
"div",
|
|
1255
1255
|
{
|
|
1256
1256
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
1257
1257
|
style: { backgroundColor: "#FBFAF9" },
|
|
1258
|
-
children: /* @__PURE__ */
|
|
1258
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center gap-3 w-full", children: [
|
|
1259
1259
|
/* @__PURE__ */ e(
|
|
1260
1260
|
ee,
|
|
1261
1261
|
{
|
|
1262
|
-
id:
|
|
1263
|
-
name:
|
|
1264
|
-
image:
|
|
1262
|
+
id: q,
|
|
1263
|
+
name: E,
|
|
1264
|
+
image: D,
|
|
1265
1265
|
size: 88,
|
|
1266
1266
|
shape: "circle"
|
|
1267
1267
|
}
|
|
1268
1268
|
),
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1271
|
-
|
|
1269
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1270
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: E }),
|
|
1271
|
+
T && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: T }),
|
|
1272
1272
|
l && /* @__PURE__ */ e(
|
|
1273
1273
|
"span",
|
|
1274
1274
|
{
|
|
@@ -1287,44 +1287,44 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1287
1287
|
] })
|
|
1288
1288
|
}
|
|
1289
1289
|
),
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
|
|
1292
|
-
|
|
1290
|
+
/* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1291
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
|
|
1292
|
+
xe,
|
|
1293
1293
|
{
|
|
1294
|
-
onClick:
|
|
1295
|
-
disabled:
|
|
1296
|
-
"aria-busy":
|
|
1294
|
+
onClick: k,
|
|
1295
|
+
disabled: p,
|
|
1296
|
+
"aria-busy": p,
|
|
1297
1297
|
children: [
|
|
1298
|
-
|
|
1298
|
+
p ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(qt, { className: "h-5 w-5" }),
|
|
1299
1299
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1300
1300
|
]
|
|
1301
1301
|
}
|
|
1302
1302
|
) }),
|
|
1303
|
-
/* @__PURE__ */ e("li", { children:
|
|
1304
|
-
|
|
1303
|
+
/* @__PURE__ */ e("li", { children: w ? /* @__PURE__ */ c(
|
|
1304
|
+
xe,
|
|
1305
1305
|
{
|
|
1306
|
-
onClick:
|
|
1306
|
+
onClick: m,
|
|
1307
1307
|
disabled: C,
|
|
1308
1308
|
"aria-busy": C,
|
|
1309
1309
|
children: [
|
|
1310
|
-
C ? /* @__PURE__ */ e(
|
|
1310
|
+
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ue, { className: "h-5 w-5" }),
|
|
1311
1311
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1312
1312
|
]
|
|
1313
1313
|
}
|
|
1314
|
-
) : /* @__PURE__ */
|
|
1315
|
-
|
|
1314
|
+
) : /* @__PURE__ */ c(
|
|
1315
|
+
xe,
|
|
1316
1316
|
{
|
|
1317
|
-
onClick:
|
|
1317
|
+
onClick: h,
|
|
1318
1318
|
disabled: C,
|
|
1319
1319
|
"aria-busy": C,
|
|
1320
1320
|
children: [
|
|
1321
|
-
C ? /* @__PURE__ */ e(
|
|
1321
|
+
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ue, { className: "h-5 w-5" }),
|
|
1322
1322
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1323
1323
|
]
|
|
1324
1324
|
}
|
|
1325
1325
|
) }),
|
|
1326
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */ e(
|
|
1326
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(xe, { variant: "danger", onClick: i, children: [
|
|
1327
|
+
/* @__PURE__ */ e(Yt, { className: "h-5 w-5" }),
|
|
1328
1328
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1329
1329
|
] }) }),
|
|
1330
1330
|
b
|
|
@@ -1334,60 +1334,70 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1334
1334
|
}
|
|
1335
1335
|
)
|
|
1336
1336
|
);
|
|
1337
|
-
},
|
|
1337
|
+
}, ks = ({
|
|
1338
1338
|
onBack: t,
|
|
1339
1339
|
showBackButton: s,
|
|
1340
1340
|
renderMessageInputActions: n,
|
|
1341
|
-
onLeaveConversation:
|
|
1341
|
+
onLeaveConversation: a,
|
|
1342
1342
|
onBlockParticipant: l,
|
|
1343
|
-
showDeleteConversation:
|
|
1344
|
-
onDeleteConversationClick:
|
|
1345
|
-
onBlockParticipantClick:
|
|
1343
|
+
showDeleteConversation: d = !0,
|
|
1344
|
+
onDeleteConversationClick: r,
|
|
1345
|
+
onBlockParticipantClick: u,
|
|
1346
1346
|
onReportParticipantClick: g,
|
|
1347
1347
|
showStarButton: x = !1,
|
|
1348
|
-
chatbotVotingEnabled:
|
|
1348
|
+
chatbotVotingEnabled: v = !1,
|
|
1349
1349
|
renderChannelBanner: b,
|
|
1350
|
-
customChannelActions:
|
|
1350
|
+
customChannelActions: y,
|
|
1351
|
+
renderMessage: o
|
|
1351
1352
|
}) => {
|
|
1352
|
-
const { channel:
|
|
1353
|
-
(
|
|
1354
|
-
var
|
|
1355
|
-
return ((
|
|
1353
|
+
const { channel: w } = Se(), I = Z(null), p = A.useMemo(() => Object.values(w.state.members || {}).find(
|
|
1354
|
+
(k) => {
|
|
1355
|
+
var h;
|
|
1356
|
+
return ((h = k.user) == null ? void 0 : h.id) && k.user.id !== w._client.userID;
|
|
1356
1357
|
}
|
|
1357
|
-
), [
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1360
|
-
return String(
|
|
1361
|
-
if (
|
|
1362
|
-
return
|
|
1363
|
-
}, [
|
|
1364
|
-
var
|
|
1365
|
-
(
|
|
1366
|
-
}, []),
|
|
1367
|
-
var
|
|
1368
|
-
(
|
|
1358
|
+
), [w._client.userID, w.state.members]), M = A.useMemo(() => {
|
|
1359
|
+
const f = w.data ?? {};
|
|
1360
|
+
if (f.followerStatus)
|
|
1361
|
+
return String(f.followerStatus);
|
|
1362
|
+
if (f.isFollower !== void 0)
|
|
1363
|
+
return f.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1364
|
+
}, [w.data]), C = L(() => {
|
|
1365
|
+
var f;
|
|
1366
|
+
(f = I.current) == null || f.showModal();
|
|
1367
|
+
}, []), N = L(() => {
|
|
1368
|
+
var f;
|
|
1369
|
+
(f = I.current) == null || f.close();
|
|
1369
1370
|
}, []);
|
|
1370
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ c(de, { children: [
|
|
1371
1372
|
/* @__PURE__ */ e(
|
|
1372
|
-
|
|
1373
|
+
jt,
|
|
1373
1374
|
{
|
|
1374
1375
|
overrides: {
|
|
1375
|
-
Message: (
|
|
1376
|
+
Message: (f) => {
|
|
1377
|
+
const { message: k } = je("ChannelView"), h = /* @__PURE__ */ e(
|
|
1378
|
+
gs,
|
|
1379
|
+
{
|
|
1380
|
+
...f,
|
|
1381
|
+
chatbotVotingEnabled: v
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
return !o || !k ? h : o(h, k);
|
|
1385
|
+
}
|
|
1376
1386
|
},
|
|
1377
|
-
children: /* @__PURE__ */
|
|
1387
|
+
children: /* @__PURE__ */ c(Gt, { children: [
|
|
1378
1388
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1379
|
-
|
|
1389
|
+
Ss,
|
|
1380
1390
|
{
|
|
1381
1391
|
onBack: t,
|
|
1382
1392
|
showBackButton: s,
|
|
1383
|
-
onShowInfo:
|
|
1384
|
-
canShowInfo: !!
|
|
1393
|
+
onShowInfo: C,
|
|
1394
|
+
canShowInfo: !!p,
|
|
1385
1395
|
showStarButton: x
|
|
1386
1396
|
}
|
|
1387
1397
|
) }),
|
|
1388
1398
|
b == null ? void 0 : b(),
|
|
1389
1399
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1390
|
-
|
|
1400
|
+
Vt,
|
|
1391
1401
|
{
|
|
1392
1402
|
hideDeletedMessages: !0,
|
|
1393
1403
|
hideNewMessageSeparator: !1,
|
|
@@ -1395,107 +1405,109 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1395
1405
|
}
|
|
1396
1406
|
) }),
|
|
1397
1407
|
/* @__PURE__ */ e(
|
|
1398
|
-
|
|
1408
|
+
vs,
|
|
1399
1409
|
{
|
|
1400
|
-
renderActions: () => n == null ? void 0 : n(
|
|
1410
|
+
renderActions: () => n == null ? void 0 : n(w)
|
|
1401
1411
|
}
|
|
1402
1412
|
)
|
|
1403
1413
|
] })
|
|
1404
1414
|
}
|
|
1405
1415
|
),
|
|
1406
1416
|
/* @__PURE__ */ e(
|
|
1407
|
-
|
|
1417
|
+
Ms,
|
|
1408
1418
|
{
|
|
1409
|
-
dialogRef:
|
|
1410
|
-
onClose:
|
|
1411
|
-
participant:
|
|
1412
|
-
channel:
|
|
1413
|
-
followerStatusLabel:
|
|
1414
|
-
onLeaveConversation:
|
|
1419
|
+
dialogRef: I,
|
|
1420
|
+
onClose: N,
|
|
1421
|
+
participant: p,
|
|
1422
|
+
channel: w,
|
|
1423
|
+
followerStatusLabel: M,
|
|
1424
|
+
onLeaveConversation: a,
|
|
1415
1425
|
onBlockParticipant: l,
|
|
1416
|
-
showDeleteConversation:
|
|
1417
|
-
onDeleteConversationClick:
|
|
1418
|
-
onBlockParticipantClick:
|
|
1426
|
+
showDeleteConversation: d,
|
|
1427
|
+
onDeleteConversationClick: r,
|
|
1428
|
+
onBlockParticipantClick: u,
|
|
1419
1429
|
onReportParticipantClick: g,
|
|
1420
|
-
customChannelActions:
|
|
1430
|
+
customChannelActions: y
|
|
1421
1431
|
}
|
|
1422
1432
|
)
|
|
1423
1433
|
] });
|
|
1424
|
-
},
|
|
1434
|
+
}, Ze = A.memo(
|
|
1425
1435
|
({
|
|
1426
1436
|
channel: t,
|
|
1427
1437
|
onBack: s,
|
|
1428
1438
|
showBackButton: n = !1,
|
|
1429
|
-
renderMessageInputActions:
|
|
1439
|
+
renderMessageInputActions: a,
|
|
1430
1440
|
onLeaveConversation: l,
|
|
1431
|
-
onBlockParticipant:
|
|
1432
|
-
className:
|
|
1433
|
-
CustomChannelEmptyState:
|
|
1441
|
+
onBlockParticipant: d,
|
|
1442
|
+
className: r,
|
|
1443
|
+
CustomChannelEmptyState: u = _s,
|
|
1434
1444
|
showDeleteConversation: g = !0,
|
|
1435
1445
|
onDeleteConversationClick: x,
|
|
1436
|
-
onBlockParticipantClick:
|
|
1446
|
+
onBlockParticipantClick: v,
|
|
1437
1447
|
onReportParticipantClick: b,
|
|
1438
|
-
dmAgentEnabled:
|
|
1439
|
-
messageMetadata:
|
|
1440
|
-
onMessageSent:
|
|
1448
|
+
dmAgentEnabled: y,
|
|
1449
|
+
messageMetadata: o,
|
|
1450
|
+
onMessageSent: w,
|
|
1441
1451
|
showStarButton: I = !1,
|
|
1442
|
-
chatbotVotingEnabled:
|
|
1443
|
-
renderChannelBanner:
|
|
1444
|
-
customChannelActions: C
|
|
1452
|
+
chatbotVotingEnabled: p = !1,
|
|
1453
|
+
renderChannelBanner: M,
|
|
1454
|
+
customChannelActions: C,
|
|
1455
|
+
renderMessage: N
|
|
1445
1456
|
}) => {
|
|
1446
|
-
const
|
|
1447
|
-
async (
|
|
1448
|
-
var
|
|
1449
|
-
const
|
|
1450
|
-
...
|
|
1451
|
-
...
|
|
1452
|
-
...
|
|
1457
|
+
const f = L(
|
|
1458
|
+
async (k, h, m) => {
|
|
1459
|
+
var T;
|
|
1460
|
+
const i = ((T = t.data) == null ? void 0 : T.chatbot_paused) === !0, E = y && !i, D = {
|
|
1461
|
+
...h,
|
|
1462
|
+
...E && { silent: !0 },
|
|
1463
|
+
...o && {
|
|
1453
1464
|
metadata: {
|
|
1454
|
-
...
|
|
1455
|
-
...
|
|
1465
|
+
...h.metadata ?? {},
|
|
1466
|
+
...o
|
|
1456
1467
|
}
|
|
1457
1468
|
}
|
|
1458
|
-
},
|
|
1459
|
-
...
|
|
1460
|
-
...
|
|
1461
|
-
},
|
|
1462
|
-
return
|
|
1469
|
+
}, j = {
|
|
1470
|
+
...m,
|
|
1471
|
+
...E && { skip_push: !0 }
|
|
1472
|
+
}, W = await t.sendMessage(D, j);
|
|
1473
|
+
return w == null || w(W), W;
|
|
1463
1474
|
},
|
|
1464
|
-
[t,
|
|
1475
|
+
[t, y, o, w]
|
|
1465
1476
|
);
|
|
1466
1477
|
return /* @__PURE__ */ e(
|
|
1467
1478
|
"div",
|
|
1468
1479
|
{
|
|
1469
1480
|
className: R(
|
|
1470
1481
|
"messaging-channel-view h-full flex flex-col",
|
|
1471
|
-
|
|
1482
|
+
r
|
|
1472
1483
|
),
|
|
1473
1484
|
children: /* @__PURE__ */ e(
|
|
1474
|
-
|
|
1485
|
+
$t,
|
|
1475
1486
|
{
|
|
1476
1487
|
channel: t,
|
|
1477
|
-
MessageSystem:
|
|
1478
|
-
EmptyStateIndicator:
|
|
1479
|
-
LoadingIndicator:
|
|
1480
|
-
DateSeparator:
|
|
1481
|
-
doSendMessageRequest:
|
|
1488
|
+
MessageSystem: Es,
|
|
1489
|
+
EmptyStateIndicator: u,
|
|
1490
|
+
LoadingIndicator: Ne,
|
|
1491
|
+
DateSeparator: ls,
|
|
1492
|
+
doSendMessageRequest: f,
|
|
1482
1493
|
children: /* @__PURE__ */ e(
|
|
1483
|
-
|
|
1494
|
+
ks,
|
|
1484
1495
|
{
|
|
1485
1496
|
onBack: s,
|
|
1486
1497
|
showBackButton: n,
|
|
1487
|
-
renderMessageInputActions:
|
|
1498
|
+
renderMessageInputActions: a,
|
|
1488
1499
|
onLeaveConversation: l,
|
|
1489
|
-
onBlockParticipant:
|
|
1490
|
-
CustomChannelEmptyState:
|
|
1500
|
+
onBlockParticipant: d,
|
|
1501
|
+
CustomChannelEmptyState: u,
|
|
1491
1502
|
showDeleteConversation: g,
|
|
1492
1503
|
onDeleteConversationClick: x,
|
|
1493
|
-
onBlockParticipantClick:
|
|
1504
|
+
onBlockParticipantClick: v,
|
|
1494
1505
|
onReportParticipantClick: b,
|
|
1495
1506
|
showStarButton: I,
|
|
1496
|
-
chatbotVotingEnabled:
|
|
1497
|
-
renderChannelBanner:
|
|
1498
|
-
customChannelActions: C
|
|
1507
|
+
chatbotVotingEnabled: p,
|
|
1508
|
+
renderChannelBanner: M,
|
|
1509
|
+
customChannelActions: C,
|
|
1510
|
+
renderMessage: N
|
|
1499
1511
|
}
|
|
1500
1512
|
)
|
|
1501
1513
|
}
|
|
@@ -1504,16 +1516,16 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1504
1516
|
);
|
|
1505
1517
|
}
|
|
1506
1518
|
);
|
|
1507
|
-
|
|
1508
|
-
function
|
|
1519
|
+
Ze.displayName = "ChannelView";
|
|
1520
|
+
function Ds({
|
|
1509
1521
|
searchQuery: t,
|
|
1510
1522
|
setSearchQuery: s,
|
|
1511
1523
|
placeholder: n
|
|
1512
1524
|
}) {
|
|
1513
|
-
const
|
|
1514
|
-
return /* @__PURE__ */
|
|
1525
|
+
const a = Z(null);
|
|
1526
|
+
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
1515
1527
|
/* @__PURE__ */ e(
|
|
1516
|
-
|
|
1528
|
+
Zt,
|
|
1517
1529
|
{
|
|
1518
1530
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1519
1531
|
weight: "bold"
|
|
@@ -1522,7 +1534,7 @@ function ks({
|
|
|
1522
1534
|
/* @__PURE__ */ e(
|
|
1523
1535
|
"input",
|
|
1524
1536
|
{
|
|
1525
|
-
ref:
|
|
1537
|
+
ref: a,
|
|
1526
1538
|
type: "text",
|
|
1527
1539
|
placeholder: n,
|
|
1528
1540
|
value: t,
|
|
@@ -1531,157 +1543,157 @@ function ks({
|
|
|
1531
1543
|
}
|
|
1532
1544
|
),
|
|
1533
1545
|
t && /* @__PURE__ */ e(
|
|
1534
|
-
|
|
1546
|
+
qe,
|
|
1535
1547
|
{
|
|
1536
1548
|
label: "Clear search",
|
|
1537
1549
|
onClick: () => {
|
|
1538
1550
|
var l;
|
|
1539
|
-
s(""), (l =
|
|
1551
|
+
s(""), (l = a.current) == null || l.focus();
|
|
1540
1552
|
},
|
|
1541
1553
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1542
|
-
children: /* @__PURE__ */ e(
|
|
1554
|
+
children: /* @__PURE__ */ e(Me, { className: "h-4 w-4", weight: "bold" })
|
|
1543
1555
|
}
|
|
1544
1556
|
)
|
|
1545
1557
|
] });
|
|
1546
1558
|
}
|
|
1547
|
-
const
|
|
1559
|
+
const Ts = ({
|
|
1548
1560
|
participantSource: t,
|
|
1549
1561
|
onSelectParticipant: s,
|
|
1550
1562
|
onClose: n,
|
|
1551
|
-
existingParticipantIds:
|
|
1563
|
+
existingParticipantIds: a = /* @__PURE__ */ new Set(),
|
|
1552
1564
|
participantLabel: l = "participants",
|
|
1553
|
-
searchPlaceholder:
|
|
1554
|
-
className:
|
|
1565
|
+
searchPlaceholder: d = "Search participants...",
|
|
1566
|
+
className: r
|
|
1555
1567
|
}) => {
|
|
1556
|
-
const { debug:
|
|
1568
|
+
const { debug: u } = ve(), [g, x] = S(""), [v, b] = S([]), [y, o] = S(!1), [w, I] = S(null), [p, M] = S(
|
|
1557
1569
|
null
|
|
1558
|
-
), C =
|
|
1559
|
-
|
|
1570
|
+
), C = Z(!1);
|
|
1571
|
+
J(() => {
|
|
1560
1572
|
if (t.loading) {
|
|
1561
|
-
|
|
1573
|
+
u && console.log(
|
|
1562
1574
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1563
1575
|
);
|
|
1564
1576
|
return;
|
|
1565
1577
|
}
|
|
1566
1578
|
if (C.current) return;
|
|
1567
1579
|
(async () => {
|
|
1568
|
-
|
|
1580
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), o(!0), I(null);
|
|
1569
1581
|
try {
|
|
1570
|
-
const
|
|
1582
|
+
const m = await t.loadParticipants({
|
|
1571
1583
|
search: "",
|
|
1572
1584
|
// Load all participants initially
|
|
1573
1585
|
limit: 100
|
|
1574
1586
|
});
|
|
1575
|
-
b(
|
|
1587
|
+
b(m.participants), C.current = !0, u && console.log(
|
|
1576
1588
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1577
|
-
|
|
1589
|
+
m.participants.length
|
|
1578
1590
|
);
|
|
1579
|
-
} catch (
|
|
1580
|
-
const
|
|
1581
|
-
I(
|
|
1591
|
+
} catch (m) {
|
|
1592
|
+
const i = m instanceof Error ? m.message : "Failed to load participants";
|
|
1593
|
+
I(i), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1582
1594
|
} finally {
|
|
1583
|
-
|
|
1595
|
+
o(!1);
|
|
1584
1596
|
}
|
|
1585
1597
|
})();
|
|
1586
|
-
}, [t.loading,
|
|
1587
|
-
const
|
|
1588
|
-
var
|
|
1598
|
+
}, [t.loading, u]);
|
|
1599
|
+
const N = v.filter((h) => !a.has(h.id)).filter((h) => {
|
|
1600
|
+
var i;
|
|
1589
1601
|
if (!g) return !0;
|
|
1590
|
-
const
|
|
1591
|
-
return
|
|
1592
|
-
}),
|
|
1593
|
-
async (
|
|
1594
|
-
if (!
|
|
1595
|
-
|
|
1602
|
+
const m = g.toLowerCase();
|
|
1603
|
+
return h.name.toLowerCase().includes(m) || ((i = h.email) == null ? void 0 : i.toLowerCase().includes(m)) || !1;
|
|
1604
|
+
}), f = L(
|
|
1605
|
+
async (h) => {
|
|
1606
|
+
if (!p) {
|
|
1607
|
+
M(h.id);
|
|
1596
1608
|
try {
|
|
1597
|
-
await s(
|
|
1598
|
-
} catch (
|
|
1599
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1609
|
+
await s(h);
|
|
1610
|
+
} catch (m) {
|
|
1611
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), M(null);
|
|
1600
1612
|
}
|
|
1601
1613
|
}
|
|
1602
1614
|
},
|
|
1603
|
-
[s,
|
|
1604
|
-
),
|
|
1605
|
-
(
|
|
1615
|
+
[s, p]
|
|
1616
|
+
), k = (h, m) => {
|
|
1617
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), f(m));
|
|
1606
1618
|
};
|
|
1607
|
-
return /* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ c("div", { className: R("flex flex-col h-full", r), children: [
|
|
1620
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1621
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1610
1622
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1611
|
-
/* @__PURE__ */ e(
|
|
1623
|
+
/* @__PURE__ */ e(Ye, { onClick: n })
|
|
1612
1624
|
] }),
|
|
1613
|
-
/* @__PURE__ */
|
|
1625
|
+
/* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
|
|
1614
1626
|
"Select a ",
|
|
1615
1627
|
l.slice(0, -1),
|
|
1616
1628
|
" to start messaging (",
|
|
1617
|
-
|
|
1629
|
+
N.length,
|
|
1618
1630
|
" available)",
|
|
1619
1631
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${l} total`
|
|
1620
1632
|
] }),
|
|
1621
1633
|
/* @__PURE__ */ e(
|
|
1622
|
-
|
|
1634
|
+
Ds,
|
|
1623
1635
|
{
|
|
1624
1636
|
searchQuery: g,
|
|
1625
1637
|
setSearchQuery: x,
|
|
1626
|
-
placeholder:
|
|
1638
|
+
placeholder: d
|
|
1627
1639
|
}
|
|
1628
1640
|
)
|
|
1629
1641
|
] }),
|
|
1630
|
-
|
|
1642
|
+
w && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1631
1643
|
"Error loading ",
|
|
1632
1644
|
l,
|
|
1633
1645
|
": ",
|
|
1634
|
-
|
|
1646
|
+
w
|
|
1635
1647
|
] }),
|
|
1636
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1648
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: y && N.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
1637
1649
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1638
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
|
|
1639
1651
|
"Loading ",
|
|
1640
1652
|
l,
|
|
1641
1653
|
"..."
|
|
1642
1654
|
] })
|
|
1643
|
-
] }) }) :
|
|
1644
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1645
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` :
|
|
1646
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" :
|
|
1647
|
-
] }) : /* @__PURE__ */
|
|
1648
|
-
|
|
1649
|
-
const
|
|
1655
|
+
] }) }) : N.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
1656
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Fe, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1657
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` : v.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1658
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1659
|
+
] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
|
|
1660
|
+
N.map((h) => {
|
|
1661
|
+
const m = h.name || h.email || h.id, i = h.email && h.name ? h.email : h.phone;
|
|
1650
1662
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1651
1663
|
"button",
|
|
1652
1664
|
{
|
|
1653
1665
|
type: "button",
|
|
1654
|
-
onClick: () =>
|
|
1655
|
-
onKeyDown: (
|
|
1666
|
+
onClick: () => f(h),
|
|
1667
|
+
onKeyDown: (E) => k(E, h),
|
|
1656
1668
|
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",
|
|
1657
|
-
children: /* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1669
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
1670
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1659
1671
|
/* @__PURE__ */ e(
|
|
1660
1672
|
ee,
|
|
1661
1673
|
{
|
|
1662
|
-
id:
|
|
1663
|
-
name:
|
|
1664
|
-
image:
|
|
1674
|
+
id: h.id,
|
|
1675
|
+
name: m,
|
|
1676
|
+
image: h.image,
|
|
1665
1677
|
size: 40
|
|
1666
1678
|
}
|
|
1667
1679
|
),
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1670
|
-
|
|
1680
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
1681
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1682
|
+
i && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: i })
|
|
1671
1683
|
] })
|
|
1672
1684
|
] }),
|
|
1673
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1685
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p === h.id ? /* @__PURE__ */ e(be, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Fe, { className: "h-5 w-5 text-stone" }) })
|
|
1674
1686
|
] })
|
|
1675
1687
|
}
|
|
1676
|
-
) },
|
|
1688
|
+
) }, h.id);
|
|
1677
1689
|
}),
|
|
1678
|
-
|
|
1690
|
+
y && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
1679
1691
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1680
1692
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1681
1693
|
] }) })
|
|
1682
1694
|
] }) })
|
|
1683
1695
|
] });
|
|
1684
|
-
},
|
|
1696
|
+
}, Rs = ({ className: t }) => /* @__PURE__ */ c(
|
|
1685
1697
|
"svg",
|
|
1686
1698
|
{
|
|
1687
1699
|
width: "140",
|
|
@@ -1691,7 +1703,7 @@ const Ds = ({
|
|
|
1691
1703
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1692
1704
|
className: t,
|
|
1693
1705
|
children: [
|
|
1694
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ c("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1695
1707
|
/* @__PURE__ */ e(
|
|
1696
1708
|
"path",
|
|
1697
1709
|
{
|
|
@@ -1720,7 +1732,7 @@ const Ds = ({
|
|
|
1720
1732
|
fill: "white"
|
|
1721
1733
|
}
|
|
1722
1734
|
),
|
|
1723
|
-
/* @__PURE__ */
|
|
1735
|
+
/* @__PURE__ */ c("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1724
1736
|
/* @__PURE__ */ e(
|
|
1725
1737
|
"path",
|
|
1726
1738
|
{
|
|
@@ -1760,8 +1772,8 @@ const Ds = ({
|
|
|
1760
1772
|
}
|
|
1761
1773
|
)
|
|
1762
1774
|
] }),
|
|
1763
|
-
/* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ c("defs", { children: [
|
|
1776
|
+
/* @__PURE__ */ c(
|
|
1765
1777
|
"filter",
|
|
1766
1778
|
{
|
|
1767
1779
|
id: "filter0_empty_state",
|
|
@@ -1815,17 +1827,17 @@ const Ds = ({
|
|
|
1815
1827
|
] })
|
|
1816
1828
|
]
|
|
1817
1829
|
}
|
|
1818
|
-
),
|
|
1819
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */ e(
|
|
1821
|
-
s && !t && /* @__PURE__ */
|
|
1830
|
+
), Je = A.memo(
|
|
1831
|
+
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1832
|
+
/* @__PURE__ */ e(Rs, {}),
|
|
1833
|
+
s && !t && /* @__PURE__ */ c("div", { className: "mt-8", children: [
|
|
1822
1834
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1823
1835
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1824
1836
|
] })
|
|
1825
1837
|
] }) })
|
|
1826
1838
|
);
|
|
1827
|
-
|
|
1828
|
-
const
|
|
1839
|
+
Je.displayName = "EmptyState";
|
|
1840
|
+
const Ce = A.memo(({ 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: [
|
|
1829
1841
|
/* @__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: "⚠️" }) }),
|
|
1830
1842
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1831
1843
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1839,216 +1851,217 @@ const be = A.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1839
1851
|
}
|
|
1840
1852
|
)
|
|
1841
1853
|
] }) }));
|
|
1842
|
-
|
|
1843
|
-
const
|
|
1854
|
+
Ce.displayName = "ErrorState";
|
|
1855
|
+
const Gs = ({
|
|
1844
1856
|
capabilities: t = {},
|
|
1845
1857
|
className: s,
|
|
1846
1858
|
renderMessageInputActions: n,
|
|
1847
|
-
onChannelSelect:
|
|
1859
|
+
onChannelSelect: a,
|
|
1848
1860
|
onParticipantSelect: l,
|
|
1849
|
-
initialParticipantFilter:
|
|
1850
|
-
initialParticipantData:
|
|
1851
|
-
CustomChannelEmptyState:
|
|
1861
|
+
initialParticipantFilter: d,
|
|
1862
|
+
initialParticipantData: r,
|
|
1863
|
+
CustomChannelEmptyState: u,
|
|
1852
1864
|
showChannelList: g = !0,
|
|
1853
1865
|
filters: x,
|
|
1854
|
-
channelListCustomEmptyStateIndicator:
|
|
1866
|
+
channelListCustomEmptyStateIndicator: v,
|
|
1855
1867
|
onDeleteConversationClick: b,
|
|
1856
|
-
onBlockParticipantClick:
|
|
1857
|
-
onReportParticipantClick:
|
|
1858
|
-
dmAgentEnabled:
|
|
1868
|
+
onBlockParticipantClick: y,
|
|
1869
|
+
onReportParticipantClick: o,
|
|
1870
|
+
dmAgentEnabled: w,
|
|
1859
1871
|
messageMetadata: I,
|
|
1860
|
-
onMessageSent:
|
|
1861
|
-
showStarButton:
|
|
1872
|
+
onMessageSent: p,
|
|
1873
|
+
showStarButton: M = !1,
|
|
1862
1874
|
chatbotVotingEnabled: C = !1,
|
|
1863
|
-
renderMessagePreview:
|
|
1864
|
-
renderChannelBanner:
|
|
1865
|
-
customChannelActions:
|
|
1875
|
+
renderMessagePreview: N,
|
|
1876
|
+
renderChannelBanner: f,
|
|
1877
|
+
customChannelActions: k,
|
|
1878
|
+
renderMessage: h
|
|
1866
1879
|
}) => {
|
|
1867
1880
|
const {
|
|
1868
|
-
service:
|
|
1869
|
-
client:
|
|
1870
|
-
isConnected:
|
|
1871
|
-
isLoading:
|
|
1872
|
-
error:
|
|
1873
|
-
refreshConnection:
|
|
1874
|
-
debug:
|
|
1875
|
-
} =
|
|
1876
|
-
participantSource:
|
|
1877
|
-
participantLabel:
|
|
1881
|
+
service: m,
|
|
1882
|
+
client: i,
|
|
1883
|
+
isConnected: E,
|
|
1884
|
+
isLoading: D,
|
|
1885
|
+
error: j,
|
|
1886
|
+
refreshConnection: W,
|
|
1887
|
+
debug: T
|
|
1888
|
+
} = Jt(), [q, G] = S(null), [X, te] = S(!1), [se, ne] = S(!1), [z, Q] = S(!1), [P, U] = S(/* @__PURE__ */ new Set()), [V, B] = S(0), [O, ae] = S(!1), [ie, K] = S(null), Y = Z(null), {
|
|
1889
|
+
participantSource: re,
|
|
1890
|
+
participantLabel: ce = "participants",
|
|
1878
1891
|
showDeleteConversation: ue = !0
|
|
1879
1892
|
} = t, me = A.useMemo(() => {
|
|
1880
|
-
const
|
|
1893
|
+
const _ = i == null ? void 0 : i.userID;
|
|
1881
1894
|
return {
|
|
1882
1895
|
...{
|
|
1883
1896
|
type: "messaging",
|
|
1884
1897
|
last_message_at: { $exists: !0 },
|
|
1885
|
-
...
|
|
1886
|
-
members: { $in: [
|
|
1898
|
+
..._ && {
|
|
1899
|
+
members: { $in: [_] },
|
|
1887
1900
|
hidden: !1
|
|
1888
1901
|
}
|
|
1889
1902
|
},
|
|
1890
1903
|
...x
|
|
1891
1904
|
};
|
|
1892
|
-
}, [x,
|
|
1893
|
-
if (!
|
|
1894
|
-
const
|
|
1895
|
-
if (
|
|
1905
|
+
}, [x, i == null ? void 0 : i.userID]), he = Z(null), oe = L(async () => {
|
|
1906
|
+
if (!i || !E) return;
|
|
1907
|
+
const _ = i.userID;
|
|
1908
|
+
if (_)
|
|
1896
1909
|
try {
|
|
1897
|
-
|
|
1898
|
-
const H = await
|
|
1910
|
+
T && console.log("[MessagingShell] Syncing channels for user:", _);
|
|
1911
|
+
const H = await i.queryChannels(
|
|
1899
1912
|
{
|
|
1900
1913
|
type: "messaging",
|
|
1901
|
-
members: { $in: [
|
|
1914
|
+
members: { $in: [_] }
|
|
1902
1915
|
},
|
|
1903
1916
|
{},
|
|
1904
1917
|
{ limit: 100 }
|
|
1905
|
-
),
|
|
1906
|
-
H.forEach((
|
|
1907
|
-
const
|
|
1908
|
-
Object.values(
|
|
1909
|
-
var
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1918
|
+
), F = /* @__PURE__ */ new Set();
|
|
1919
|
+
H.forEach(($) => {
|
|
1920
|
+
const we = $.state.members;
|
|
1921
|
+
Object.values(we).forEach((nt) => {
|
|
1922
|
+
var De;
|
|
1923
|
+
const pe = (De = nt.user) == null ? void 0 : De.id;
|
|
1924
|
+
pe && pe !== _ && F.add(pe);
|
|
1912
1925
|
});
|
|
1913
|
-
}), U((
|
|
1926
|
+
}), U(($) => $.size === F.size && [...$].every((we) => F.has(we)) ? $ : F), te(H.length > 0), ne(!0), he.current = _, T && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1914
1927
|
channelCount: H.length,
|
|
1915
|
-
memberCount:
|
|
1928
|
+
memberCount: F.size
|
|
1916
1929
|
});
|
|
1917
1930
|
} catch (H) {
|
|
1918
1931
|
console.error("[MessagingShell] Failed to sync channels:", H);
|
|
1919
1932
|
}
|
|
1920
|
-
}, [
|
|
1921
|
-
|
|
1922
|
-
if (!
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1925
|
-
}, [
|
|
1926
|
-
if (!
|
|
1933
|
+
}, [i, E, T]);
|
|
1934
|
+
J(() => {
|
|
1935
|
+
if (!i || !E) return;
|
|
1936
|
+
const _ = i.userID;
|
|
1937
|
+
_ && he.current !== _ && oe();
|
|
1938
|
+
}, [i, E, oe]), J(() => {
|
|
1939
|
+
if (!d || !i || !E) return;
|
|
1927
1940
|
(async () => {
|
|
1928
|
-
const H =
|
|
1941
|
+
const H = i.userID;
|
|
1929
1942
|
if (H)
|
|
1930
1943
|
try {
|
|
1931
|
-
|
|
1944
|
+
T && console.log(
|
|
1932
1945
|
"[MessagingShell] Loading initial conversation with:",
|
|
1933
|
-
|
|
1946
|
+
d
|
|
1934
1947
|
);
|
|
1935
|
-
const
|
|
1948
|
+
const F = await i.queryChannels(
|
|
1936
1949
|
{
|
|
1937
1950
|
type: "messaging",
|
|
1938
|
-
members: { $eq: [H,
|
|
1951
|
+
members: { $eq: [H, d] }
|
|
1939
1952
|
},
|
|
1940
1953
|
{},
|
|
1941
1954
|
{ limit: 1 }
|
|
1942
1955
|
);
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1956
|
+
if (F.length > 0)
|
|
1957
|
+
G(F[0]), ae(!0), K(null), a && a(F[0]), T && console.log(
|
|
1945
1958
|
"[MessagingShell] Initial conversation loaded:",
|
|
1946
|
-
|
|
1959
|
+
F[0].id
|
|
1947
1960
|
);
|
|
1948
|
-
else if (
|
|
1949
|
-
|
|
1961
|
+
else if (r && m) {
|
|
1962
|
+
T && console.log(
|
|
1950
1963
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1951
|
-
|
|
1964
|
+
r
|
|
1952
1965
|
);
|
|
1953
1966
|
try {
|
|
1954
|
-
const
|
|
1955
|
-
id:
|
|
1956
|
-
name:
|
|
1957
|
-
email:
|
|
1958
|
-
phone:
|
|
1967
|
+
const $ = await m.startChannelWithParticipant({
|
|
1968
|
+
id: r.id,
|
|
1969
|
+
name: r.name,
|
|
1970
|
+
email: r.email,
|
|
1971
|
+
phone: r.phone
|
|
1959
1972
|
});
|
|
1960
|
-
|
|
1973
|
+
G($), ae(!0), K(null), a && a($), T && console.log(
|
|
1961
1974
|
"[MessagingShell] Channel created and loaded:",
|
|
1962
|
-
|
|
1975
|
+
$.id
|
|
1963
1976
|
);
|
|
1964
|
-
} catch (
|
|
1977
|
+
} catch ($) {
|
|
1965
1978
|
console.error(
|
|
1966
1979
|
"[MessagingShell] Failed to create conversation:",
|
|
1967
|
-
|
|
1968
|
-
),
|
|
1980
|
+
$
|
|
1981
|
+
), K("Failed to create conversation");
|
|
1969
1982
|
}
|
|
1970
1983
|
} else
|
|
1971
|
-
|
|
1984
|
+
K(
|
|
1972
1985
|
"No conversation found with this account"
|
|
1973
|
-
),
|
|
1986
|
+
), T && console.log(
|
|
1974
1987
|
"[MessagingShell] No conversation found for:",
|
|
1975
|
-
|
|
1988
|
+
d
|
|
1976
1989
|
);
|
|
1977
|
-
} catch (
|
|
1990
|
+
} catch (F) {
|
|
1978
1991
|
console.error(
|
|
1979
1992
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1980
|
-
|
|
1981
|
-
),
|
|
1993
|
+
F
|
|
1994
|
+
), K("Failed to load conversation");
|
|
1982
1995
|
}
|
|
1983
1996
|
})();
|
|
1984
1997
|
}, [
|
|
1985
|
-
u,
|
|
1986
|
-
o,
|
|
1987
|
-
c,
|
|
1988
1998
|
d,
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1999
|
+
r,
|
|
2000
|
+
i,
|
|
2001
|
+
E,
|
|
2002
|
+
m,
|
|
2003
|
+
T,
|
|
2004
|
+
a
|
|
1992
2005
|
]);
|
|
1993
|
-
const
|
|
1994
|
-
(
|
|
1995
|
-
|
|
2006
|
+
const Qe = L(
|
|
2007
|
+
(_) => {
|
|
2008
|
+
G(_), a == null || a(_);
|
|
1996
2009
|
},
|
|
1997
|
-
[
|
|
1998
|
-
),
|
|
1999
|
-
|
|
2000
|
-
}, [
|
|
2001
|
-
async (
|
|
2010
|
+
[a]
|
|
2011
|
+
), Xe = L(() => {
|
|
2012
|
+
O || G(null);
|
|
2013
|
+
}, [O]), Ke = L(
|
|
2014
|
+
async (_) => {
|
|
2002
2015
|
var H;
|
|
2003
|
-
if (
|
|
2016
|
+
if (m)
|
|
2004
2017
|
try {
|
|
2005
|
-
|
|
2018
|
+
T && console.log(
|
|
2006
2019
|
"[MessagingShell] Starting conversation with:",
|
|
2007
|
-
|
|
2020
|
+
_.id
|
|
2008
2021
|
);
|
|
2009
|
-
const
|
|
2010
|
-
id:
|
|
2011
|
-
name:
|
|
2012
|
-
email:
|
|
2013
|
-
phone:
|
|
2022
|
+
const F = await m.startChannelWithParticipant({
|
|
2023
|
+
id: _.id,
|
|
2024
|
+
name: _.name,
|
|
2025
|
+
email: _.email,
|
|
2026
|
+
phone: _.phone
|
|
2014
2027
|
});
|
|
2015
2028
|
try {
|
|
2016
|
-
await
|
|
2017
|
-
} catch (
|
|
2018
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
2029
|
+
await F.show();
|
|
2030
|
+
} catch ($) {
|
|
2031
|
+
console.warn("[MessagingShell] Failed to unhide channel:", $);
|
|
2019
2032
|
}
|
|
2020
|
-
|
|
2021
|
-
} catch (
|
|
2022
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
2033
|
+
G(F), Q(!1), (H = Y.current) == null || H.close(), l == null || l(_);
|
|
2034
|
+
} catch (F) {
|
|
2035
|
+
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
2023
2036
|
}
|
|
2024
2037
|
},
|
|
2025
|
-
[
|
|
2026
|
-
),
|
|
2027
|
-
var
|
|
2028
|
-
|
|
2029
|
-
}, []),
|
|
2030
|
-
(
|
|
2031
|
-
|
|
2038
|
+
[m, l, T]
|
|
2039
|
+
), fe = L(() => {
|
|
2040
|
+
var _;
|
|
2041
|
+
Q(!1), (_ = Y.current) == null || _.close();
|
|
2042
|
+
}, []), et = L(
|
|
2043
|
+
(_) => {
|
|
2044
|
+
_.target === Y.current && fe();
|
|
2032
2045
|
},
|
|
2033
|
-
[
|
|
2034
|
-
),
|
|
2035
|
-
async (
|
|
2036
|
-
|
|
2046
|
+
[fe]
|
|
2047
|
+
), tt = L(
|
|
2048
|
+
async (_) => {
|
|
2049
|
+
T && console.log("[MessagingShell] Leaving conversation:", _.id), G(null), ae(!1), he.current = null, await oe();
|
|
2037
2050
|
},
|
|
2038
|
-
[oe,
|
|
2039
|
-
),
|
|
2040
|
-
async (
|
|
2041
|
-
|
|
2051
|
+
[oe, T]
|
|
2052
|
+
), st = L(
|
|
2053
|
+
async (_) => {
|
|
2054
|
+
T && console.log("[MessagingShell] Blocking participant:", _), G(null), ae(!1), he.current = null, await oe();
|
|
2042
2055
|
},
|
|
2043
|
-
[oe,
|
|
2044
|
-
),
|
|
2045
|
-
return
|
|
2046
|
-
|
|
2056
|
+
[oe, T]
|
|
2057
|
+
), ge = !!q;
|
|
2058
|
+
return D ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : j ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: j, onBack: W }) }) : !E || !i ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
2059
|
+
Ce,
|
|
2047
2060
|
{
|
|
2048
2061
|
message: "Not connected to messaging service",
|
|
2049
|
-
onBack:
|
|
2062
|
+
onBack: W
|
|
2050
2063
|
}
|
|
2051
|
-
) }) :
|
|
2064
|
+
) }) : ie ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: ie }) }) : /* @__PURE__ */ c(
|
|
2052
2065
|
"div",
|
|
2053
2066
|
{
|
|
2054
2067
|
className: R(
|
|
@@ -2056,28 +2069,28 @@ const js = ({
|
|
|
2056
2069
|
s
|
|
2057
2070
|
),
|
|
2058
2071
|
children: [
|
|
2059
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
|
|
2060
2073
|
/* @__PURE__ */ e(
|
|
2061
2074
|
"div",
|
|
2062
2075
|
{
|
|
2063
2076
|
className: R(
|
|
2064
2077
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
2065
2078
|
{
|
|
2066
|
-
"!hidden": g === !1 ||
|
|
2079
|
+
"!hidden": g === !1 || O,
|
|
2067
2080
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
2068
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !
|
|
2081
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !O && ge,
|
|
2069
2082
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
2070
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !
|
|
2083
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !O && !ge
|
|
2071
2084
|
}
|
|
2072
2085
|
),
|
|
2073
2086
|
children: /* @__PURE__ */ e(
|
|
2074
|
-
|
|
2087
|
+
We,
|
|
2075
2088
|
{
|
|
2076
|
-
onChannelSelect:
|
|
2077
|
-
selectedChannel:
|
|
2089
|
+
onChannelSelect: Qe,
|
|
2090
|
+
selectedChannel: q || void 0,
|
|
2078
2091
|
filters: me,
|
|
2079
|
-
customEmptyStateIndicator:
|
|
2080
|
-
renderMessagePreview:
|
|
2092
|
+
customEmptyStateIndicator: v,
|
|
2093
|
+
renderMessagePreview: N
|
|
2081
2094
|
}
|
|
2082
2095
|
)
|
|
2083
2096
|
}
|
|
@@ -2089,77 +2102,78 @@ const js = ({
|
|
|
2089
2102
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
2090
2103
|
{
|
|
2091
2104
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
2092
|
-
flex:
|
|
2105
|
+
flex: O || ge || d,
|
|
2093
2106
|
// Normal mode: hide on mobile when no channel selected
|
|
2094
|
-
"hidden lg:flex": !
|
|
2107
|
+
"hidden lg:flex": !O && !ge && !d
|
|
2095
2108
|
}
|
|
2096
2109
|
),
|
|
2097
|
-
children:
|
|
2098
|
-
|
|
2110
|
+
children: q ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
2111
|
+
Ze,
|
|
2099
2112
|
{
|
|
2100
|
-
channel:
|
|
2101
|
-
onBack:
|
|
2102
|
-
showBackButton: !
|
|
2113
|
+
channel: q,
|
|
2114
|
+
onBack: Xe,
|
|
2115
|
+
showBackButton: !O,
|
|
2103
2116
|
renderMessageInputActions: n,
|
|
2104
|
-
renderChannelBanner:
|
|
2105
|
-
onLeaveConversation:
|
|
2106
|
-
onBlockParticipant:
|
|
2107
|
-
CustomChannelEmptyState:
|
|
2117
|
+
renderChannelBanner: f,
|
|
2118
|
+
onLeaveConversation: tt,
|
|
2119
|
+
onBlockParticipant: st,
|
|
2120
|
+
CustomChannelEmptyState: u,
|
|
2108
2121
|
showDeleteConversation: ue,
|
|
2109
2122
|
onDeleteConversationClick: b,
|
|
2110
|
-
onBlockParticipantClick:
|
|
2111
|
-
onReportParticipantClick:
|
|
2112
|
-
dmAgentEnabled:
|
|
2123
|
+
onBlockParticipantClick: y,
|
|
2124
|
+
onReportParticipantClick: o,
|
|
2125
|
+
dmAgentEnabled: w,
|
|
2113
2126
|
messageMetadata: I,
|
|
2114
|
-
onMessageSent:
|
|
2115
|
-
showStarButton:
|
|
2127
|
+
onMessageSent: p,
|
|
2128
|
+
showStarButton: M,
|
|
2116
2129
|
chatbotVotingEnabled: C,
|
|
2117
|
-
customChannelActions:
|
|
2130
|
+
customChannelActions: k,
|
|
2131
|
+
renderMessage: h
|
|
2118
2132
|
},
|
|
2119
|
-
|
|
2120
|
-
) }) :
|
|
2133
|
+
q.id
|
|
2134
|
+
) }) : d ? (
|
|
2121
2135
|
// Show loading while creating/loading direct conversation channel
|
|
2122
|
-
/* @__PURE__ */ e(
|
|
2136
|
+
/* @__PURE__ */ e(Ne, {})
|
|
2123
2137
|
) : /* @__PURE__ */ e(
|
|
2124
|
-
|
|
2138
|
+
Je,
|
|
2125
2139
|
{
|
|
2126
|
-
hasChannels:
|
|
2140
|
+
hasChannels: X,
|
|
2127
2141
|
channelsLoaded: se
|
|
2128
2142
|
}
|
|
2129
2143
|
)
|
|
2130
2144
|
}
|
|
2131
2145
|
)
|
|
2132
2146
|
] }),
|
|
2133
|
-
|
|
2147
|
+
re && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
2134
2148
|
/* @__PURE__ */ e(
|
|
2135
2149
|
"dialog",
|
|
2136
2150
|
{
|
|
2137
|
-
ref:
|
|
2151
|
+
ref: Y,
|
|
2138
2152
|
className: "mes-dialog",
|
|
2139
|
-
onClick:
|
|
2140
|
-
onClose:
|
|
2153
|
+
onClick: et,
|
|
2154
|
+
onClose: fe,
|
|
2141
2155
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
2142
|
-
|
|
2156
|
+
Ts,
|
|
2143
2157
|
{
|
|
2144
|
-
participantSource:
|
|
2145
|
-
onSelectParticipant:
|
|
2146
|
-
onClose:
|
|
2147
|
-
existingParticipantIds:
|
|
2148
|
-
participantLabel:
|
|
2149
|
-
searchPlaceholder: `Search ${
|
|
2158
|
+
participantSource: re,
|
|
2159
|
+
onSelectParticipant: Ke,
|
|
2160
|
+
onClose: fe,
|
|
2161
|
+
existingParticipantIds: P,
|
|
2162
|
+
participantLabel: ce,
|
|
2163
|
+
searchPlaceholder: `Search ${ce}...`
|
|
2150
2164
|
},
|
|
2151
|
-
|
|
2165
|
+
V
|
|
2152
2166
|
) })
|
|
2153
2167
|
}
|
|
2154
2168
|
)
|
|
2155
2169
|
]
|
|
2156
2170
|
}
|
|
2157
2171
|
);
|
|
2158
|
-
},
|
|
2172
|
+
}, Ls = ({
|
|
2159
2173
|
question: t,
|
|
2160
2174
|
onClick: s,
|
|
2161
2175
|
loading: n = !1,
|
|
2162
|
-
className:
|
|
2176
|
+
className: a
|
|
2163
2177
|
}) => /* @__PURE__ */ e(
|
|
2164
2178
|
"button",
|
|
2165
2179
|
{
|
|
@@ -2173,40 +2187,40 @@ const js = ({
|
|
|
2173
2187
|
"hover:brightness-95 active:brightness-90": !n,
|
|
2174
2188
|
"opacity-50 cursor-not-allowed": n
|
|
2175
2189
|
},
|
|
2176
|
-
|
|
2190
|
+
a
|
|
2177
2191
|
),
|
|
2178
2192
|
children: t
|
|
2179
2193
|
}
|
|
2180
|
-
),
|
|
2194
|
+
), Vs = ({
|
|
2181
2195
|
faqs: t,
|
|
2182
2196
|
onFaqClick: s,
|
|
2183
2197
|
loadingFaqId: n,
|
|
2184
|
-
headerText:
|
|
2198
|
+
headerText: a,
|
|
2185
2199
|
className: l,
|
|
2186
|
-
avatarImage:
|
|
2187
|
-
avatarName:
|
|
2200
|
+
avatarImage: d,
|
|
2201
|
+
avatarName: r
|
|
2188
2202
|
}) => {
|
|
2189
|
-
const
|
|
2190
|
-
return
|
|
2191
|
-
(
|
|
2203
|
+
const u = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
2204
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c("div", { className: "flex gap-3 items-end", children: [
|
|
2205
|
+
(d || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2192
2206
|
ee,
|
|
2193
2207
|
{
|
|
2194
|
-
id:
|
|
2195
|
-
name:
|
|
2196
|
-
image:
|
|
2208
|
+
id: r || "account",
|
|
2209
|
+
name: r || "Account",
|
|
2210
|
+
image: d,
|
|
2197
2211
|
size: 24,
|
|
2198
2212
|
shape: "circle"
|
|
2199
2213
|
}
|
|
2200
2214
|
) }),
|
|
2201
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ c(
|
|
2202
2216
|
"div",
|
|
2203
2217
|
{
|
|
2204
2218
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
2205
2219
|
style: { backgroundColor: "#F1F0EE" },
|
|
2206
2220
|
children: [
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2221
|
+
a && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: a }),
|
|
2222
|
+
u.map((g) => /* @__PURE__ */ e(
|
|
2223
|
+
Ls,
|
|
2210
2224
|
{
|
|
2211
2225
|
question: g.question,
|
|
2212
2226
|
onClick: () => s(g.id),
|
|
@@ -2219,61 +2233,61 @@ const js = ({
|
|
|
2219
2233
|
)
|
|
2220
2234
|
] }) });
|
|
2221
2235
|
}, Hs = (t, s = {}) => {
|
|
2222
|
-
const { initialSearch: n = "", pageSize:
|
|
2223
|
-
if (
|
|
2224
|
-
const
|
|
2225
|
-
|
|
2236
|
+
const { initialSearch: n = "", pageSize: a = 20 } = s, [l, d] = S([]), [r, u] = S(!1), [g, x] = S(null), [v, b] = S(n), [y, o] = S(!0), [w, I] = S(), p = L(async (f = !1, k) => {
|
|
2237
|
+
if (r) return;
|
|
2238
|
+
const h = k !== void 0 ? k : v;
|
|
2239
|
+
u(!0), x(null);
|
|
2226
2240
|
try {
|
|
2227
|
-
const
|
|
2228
|
-
search:
|
|
2229
|
-
limit:
|
|
2230
|
-
cursor:
|
|
2241
|
+
const m = await t.loadParticipants({
|
|
2242
|
+
search: h || void 0,
|
|
2243
|
+
limit: a,
|
|
2244
|
+
cursor: f ? void 0 : w
|
|
2231
2245
|
});
|
|
2232
|
-
|
|
2233
|
-
(
|
|
2234
|
-
),
|
|
2235
|
-
} catch (
|
|
2236
|
-
const
|
|
2237
|
-
x(
|
|
2246
|
+
d(
|
|
2247
|
+
(i) => f ? m.participants : [...i, ...m.participants]
|
|
2248
|
+
), o(m.hasMore), I(m.nextCursor);
|
|
2249
|
+
} catch (m) {
|
|
2250
|
+
const i = m instanceof Error ? m.message : "Failed to load participants";
|
|
2251
|
+
x(i), console.error("[useParticipants] Load error:", m);
|
|
2238
2252
|
} finally {
|
|
2239
|
-
|
|
2253
|
+
u(!1);
|
|
2240
2254
|
}
|
|
2241
|
-
}, [t,
|
|
2242
|
-
|
|
2243
|
-
}, [
|
|
2244
|
-
b(
|
|
2245
|
-
}, [
|
|
2246
|
-
I(void 0),
|
|
2247
|
-
}, [
|
|
2248
|
-
return
|
|
2249
|
-
|
|
2255
|
+
}, [t, v, w, a, r]), M = L(() => {
|
|
2256
|
+
y && !r && p(!1);
|
|
2257
|
+
}, [y, r, p]), C = L((f) => {
|
|
2258
|
+
b(f), I(void 0), p(!0, f);
|
|
2259
|
+
}, [p]), N = L(() => {
|
|
2260
|
+
I(void 0), p(!0);
|
|
2261
|
+
}, [p]);
|
|
2262
|
+
return J(() => {
|
|
2263
|
+
p(!0);
|
|
2250
2264
|
}, [t.loadParticipants]), {
|
|
2251
2265
|
participants: l,
|
|
2252
|
-
loading:
|
|
2266
|
+
loading: r,
|
|
2253
2267
|
error: g,
|
|
2254
|
-
searchQuery:
|
|
2255
|
-
hasMore:
|
|
2268
|
+
searchQuery: v,
|
|
2269
|
+
hasMore: y,
|
|
2256
2270
|
totalCount: t.totalCount,
|
|
2257
|
-
loadMore:
|
|
2271
|
+
loadMore: M,
|
|
2258
2272
|
search: C,
|
|
2259
|
-
refresh:
|
|
2273
|
+
refresh: N
|
|
2260
2274
|
};
|
|
2261
2275
|
};
|
|
2262
2276
|
export {
|
|
2263
|
-
|
|
2277
|
+
xe as ActionButton,
|
|
2264
2278
|
ee as Avatar,
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2279
|
+
_s as ChannelEmptyState,
|
|
2280
|
+
We as ChannelList,
|
|
2281
|
+
Ze as ChannelView,
|
|
2282
|
+
Vs as FaqList,
|
|
2283
|
+
Ls as FaqListItem,
|
|
2284
|
+
ms as MessageVoteButtons,
|
|
2285
|
+
js as MessagingProvider,
|
|
2286
|
+
Gs as MessagingShell,
|
|
2287
|
+
Ts as ParticipantPicker,
|
|
2288
|
+
es as formatRelativeTime,
|
|
2289
|
+
cs as useMessageVote,
|
|
2290
|
+
Jt as useMessaging,
|
|
2277
2291
|
Hs as useParticipants
|
|
2278
2292
|
};
|
|
2279
2293
|
//# sourceMappingURL=index.js.map
|