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