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