@linktr.ee/messaging-react 1.8.7 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +579 -575
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +2 -0
- package/src/components/MessagingShell/index.tsx +2 -0
- package/src/types.ts +8 -0
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,107 +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__ */
|
|
810
|
+
/* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
809
811
|
/* @__PURE__ */ e(
|
|
810
|
-
|
|
812
|
+
$e,
|
|
811
813
|
{
|
|
812
814
|
hideDeletedMessages: !0,
|
|
813
815
|
hideNewMessageSeparator: !1,
|
|
814
816
|
messageActions: []
|
|
815
817
|
}
|
|
816
818
|
),
|
|
817
|
-
!
|
|
819
|
+
!w && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(d, {}) })
|
|
818
820
|
] }),
|
|
819
821
|
/* @__PURE__ */ e(
|
|
820
|
-
|
|
822
|
+
ss,
|
|
821
823
|
{
|
|
822
|
-
renderActions: () => n == null ? void 0 : n(
|
|
824
|
+
renderActions: () => n == null ? void 0 : n(a)
|
|
823
825
|
}
|
|
824
826
|
)
|
|
825
827
|
] }),
|
|
826
828
|
/* @__PURE__ */ e(
|
|
827
|
-
|
|
829
|
+
ts,
|
|
828
830
|
{
|
|
829
831
|
isOpen: l,
|
|
830
832
|
onClose: () => o(!1),
|
|
831
|
-
participant:
|
|
832
|
-
channel:
|
|
833
|
-
followerStatusLabel:
|
|
833
|
+
participant: I,
|
|
834
|
+
channel: a,
|
|
835
|
+
followerStatusLabel: N,
|
|
834
836
|
onLeaveConversation: r,
|
|
835
|
-
onBlockParticipant:
|
|
837
|
+
onBlockParticipant: i
|
|
836
838
|
}
|
|
837
839
|
)
|
|
838
840
|
] });
|
|
839
|
-
},
|
|
841
|
+
}, ls = ({
|
|
840
842
|
channel: t,
|
|
841
843
|
onBack: s,
|
|
842
844
|
showBackButton: n = !1,
|
|
843
845
|
renderMessageInputActions: r,
|
|
844
|
-
onLeaveConversation:
|
|
846
|
+
onLeaveConversation: i,
|
|
845
847
|
onBlockParticipant: d,
|
|
846
|
-
className:
|
|
848
|
+
className: a,
|
|
847
849
|
CustomChannelEmptyState: l = be
|
|
848
850
|
}) => /* @__PURE__ */ e(
|
|
849
851
|
"div",
|
|
850
852
|
{
|
|
851
|
-
className:
|
|
853
|
+
className: R(
|
|
852
854
|
"messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
|
|
853
|
-
|
|
855
|
+
a
|
|
854
856
|
),
|
|
855
|
-
children: /* @__PURE__ */ e(
|
|
856
|
-
|
|
857
|
+
children: /* @__PURE__ */ e(Be, { channel: t, children: /* @__PURE__ */ e(
|
|
858
|
+
rs,
|
|
857
859
|
{
|
|
858
860
|
onBack: s,
|
|
859
861
|
showBackButton: n,
|
|
860
862
|
renderMessageInputActions: r,
|
|
861
|
-
onLeaveConversation:
|
|
863
|
+
onLeaveConversation: i,
|
|
862
864
|
onBlockParticipant: d,
|
|
863
865
|
CustomChannelEmptyState: l
|
|
864
866
|
}
|
|
865
867
|
) })
|
|
866
868
|
}
|
|
867
869
|
);
|
|
868
|
-
function
|
|
870
|
+
function os({
|
|
869
871
|
searchQuery: t,
|
|
870
872
|
setSearchQuery: s,
|
|
871
873
|
placeholder: n
|
|
872
874
|
}) {
|
|
873
|
-
const r =
|
|
874
|
-
return /* @__PURE__ */
|
|
875
|
+
const r = $(null);
|
|
876
|
+
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
875
877
|
/* @__PURE__ */ e(
|
|
876
|
-
|
|
878
|
+
We,
|
|
877
879
|
{
|
|
878
880
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
879
881
|
weight: "bold"
|
|
@@ -886,7 +888,7 @@ function ls({
|
|
|
886
888
|
type: "text",
|
|
887
889
|
placeholder: n,
|
|
888
890
|
value: t,
|
|
889
|
-
onChange: (
|
|
891
|
+
onChange: (i) => s(i.target.value),
|
|
890
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"
|
|
891
893
|
}
|
|
892
894
|
),
|
|
@@ -895,8 +897,8 @@ function ls({
|
|
|
895
897
|
{
|
|
896
898
|
label: "Clear search",
|
|
897
899
|
onClick: () => {
|
|
898
|
-
var
|
|
899
|
-
s(""), (
|
|
900
|
+
var i;
|
|
901
|
+
s(""), (i = r.current) == null || i.focus();
|
|
900
902
|
},
|
|
901
903
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
902
904
|
children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -904,156 +906,156 @@ function ls({
|
|
|
904
906
|
)
|
|
905
907
|
] });
|
|
906
908
|
}
|
|
907
|
-
const
|
|
909
|
+
const as = ({
|
|
908
910
|
participantSource: t,
|
|
909
911
|
onSelectParticipant: s,
|
|
910
912
|
onClose: n,
|
|
911
913
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
912
|
-
participantLabel:
|
|
914
|
+
participantLabel: i = "participants",
|
|
913
915
|
searchPlaceholder: d = "Search participants...",
|
|
914
|
-
className:
|
|
916
|
+
className: a
|
|
915
917
|
}) => {
|
|
916
|
-
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(
|
|
917
919
|
null
|
|
918
|
-
),
|
|
919
|
-
|
|
920
|
+
), F = $(!1);
|
|
921
|
+
H(() => {
|
|
920
922
|
if (t.loading) {
|
|
921
923
|
l && console.log(
|
|
922
924
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
923
925
|
);
|
|
924
926
|
return;
|
|
925
927
|
}
|
|
926
|
-
if (
|
|
928
|
+
if (F.current) return;
|
|
927
929
|
(async () => {
|
|
928
|
-
l && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
930
|
+
l && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), b(null);
|
|
929
931
|
try {
|
|
930
|
-
const
|
|
932
|
+
const f = await t.loadParticipants({
|
|
931
933
|
search: "",
|
|
932
934
|
// Load all participants initially
|
|
933
935
|
limit: 100
|
|
934
936
|
});
|
|
935
|
-
|
|
937
|
+
N(f.participants), F.current = !0, l && console.log(
|
|
936
938
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
937
|
-
|
|
939
|
+
f.participants.length
|
|
938
940
|
);
|
|
939
|
-
} catch (
|
|
940
|
-
const
|
|
941
|
-
|
|
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);
|
|
942
944
|
} finally {
|
|
943
|
-
|
|
945
|
+
S(!1);
|
|
944
946
|
}
|
|
945
947
|
})();
|
|
946
948
|
}, [t.loading, l]);
|
|
947
|
-
const
|
|
948
|
-
var
|
|
949
|
+
const C = I.filter((u) => !r.has(u.id)).filter((u) => {
|
|
950
|
+
var x;
|
|
949
951
|
if (!o) return !0;
|
|
950
|
-
const
|
|
951
|
-
return
|
|
952
|
-
}),
|
|
953
|
-
async (
|
|
954
|
-
if (!
|
|
955
|
-
|
|
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);
|
|
956
958
|
try {
|
|
957
|
-
await s(
|
|
958
|
-
} catch (
|
|
959
|
-
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);
|
|
960
962
|
}
|
|
961
963
|
}
|
|
962
964
|
},
|
|
963
|
-
[s,
|
|
964
|
-
),
|
|
965
|
-
(
|
|
965
|
+
[s, E]
|
|
966
|
+
), p = (u, f) => {
|
|
967
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), T(f));
|
|
966
968
|
};
|
|
967
|
-
return /* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__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: [
|
|
970
972
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
971
973
|
/* @__PURE__ */ e(Ne, { onClick: n })
|
|
972
974
|
] }),
|
|
973
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
|
|
974
976
|
"Select a ",
|
|
975
|
-
|
|
977
|
+
i.slice(0, -1),
|
|
976
978
|
" to start messaging (",
|
|
977
|
-
|
|
979
|
+
C.length,
|
|
978
980
|
" available)",
|
|
979
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
981
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${i} total`
|
|
980
982
|
] }),
|
|
981
983
|
/* @__PURE__ */ e(
|
|
982
|
-
|
|
984
|
+
os,
|
|
983
985
|
{
|
|
984
986
|
searchQuery: o,
|
|
985
|
-
setSearchQuery:
|
|
987
|
+
setSearchQuery: w,
|
|
986
988
|
placeholder: d
|
|
987
989
|
}
|
|
988
990
|
)
|
|
989
991
|
] }),
|
|
990
|
-
|
|
992
|
+
g && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
991
993
|
"Error loading ",
|
|
992
|
-
|
|
994
|
+
i,
|
|
993
995
|
": ",
|
|
994
|
-
|
|
996
|
+
g
|
|
995
997
|
] }),
|
|
996
|
-
/* @__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: [
|
|
997
999
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
998
|
-
/* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
|
|
999
1001
|
"Loading ",
|
|
1000
|
-
|
|
1002
|
+
i,
|
|
1001
1003
|
"..."
|
|
1002
1004
|
] })
|
|
1003
|
-
] }) }) :
|
|
1005
|
+
] }) }) : C.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
1004
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" }) }),
|
|
1005
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${
|
|
1006
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" :
|
|
1007
|
-
] }) : /* @__PURE__ */
|
|
1008
|
-
|
|
1009
|
-
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;
|
|
1010
1012
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1011
1013
|
"button",
|
|
1012
1014
|
{
|
|
1013
1015
|
type: "button",
|
|
1014
|
-
onClick: () =>
|
|
1015
|
-
onKeyDown: (D) =>
|
|
1016
|
+
onClick: () => T(u),
|
|
1017
|
+
onKeyDown: (D) => p(D, u),
|
|
1016
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",
|
|
1017
|
-
children: /* @__PURE__ */
|
|
1018
|
-
/* @__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: [
|
|
1019
1021
|
/* @__PURE__ */ e(
|
|
1020
|
-
|
|
1022
|
+
J,
|
|
1021
1023
|
{
|
|
1022
|
-
id:
|
|
1023
|
-
name:
|
|
1024
|
-
image:
|
|
1024
|
+
id: u.id,
|
|
1025
|
+
name: f,
|
|
1026
|
+
image: u.image,
|
|
1025
1027
|
size: 40
|
|
1026
1028
|
}
|
|
1027
1029
|
),
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1030
|
-
|
|
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 })
|
|
1031
1033
|
] })
|
|
1032
1034
|
] }),
|
|
1033
|
-
/* @__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" }) })
|
|
1034
1036
|
] })
|
|
1035
1037
|
}
|
|
1036
|
-
) },
|
|
1038
|
+
) }, u.id);
|
|
1037
1039
|
}),
|
|
1038
|
-
|
|
1040
|
+
m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
1039
1041
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1040
1042
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1041
1043
|
] }) })
|
|
1042
1044
|
] }) })
|
|
1043
1045
|
] });
|
|
1044
|
-
},
|
|
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: [
|
|
1045
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: "💬" }) }),
|
|
1046
1048
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
1047
|
-
/* @__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: [
|
|
1048
1050
|
"Choose a conversation from the list or",
|
|
1049
1051
|
" ",
|
|
1050
|
-
s && /* @__PURE__ */
|
|
1052
|
+
s && /* @__PURE__ */ c(me, { onClick: s, children: [
|
|
1051
1053
|
"start a new conversation with a ",
|
|
1052
1054
|
n.slice(0, -1),
|
|
1053
1055
|
"."
|
|
1054
1056
|
] })
|
|
1055
|
-
] }) : s && /* @__PURE__ */
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
+
] }) : s && /* @__PURE__ */ c(se, { children: [
|
|
1058
|
+
/* @__PURE__ */ c(me, { onClick: s, children: [
|
|
1057
1059
|
"Start a new conversation with one of your ",
|
|
1058
1060
|
n
|
|
1059
1061
|
] }),
|
|
@@ -1071,7 +1073,7 @@ const os = ({
|
|
|
1071
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",
|
|
1072
1074
|
children: s
|
|
1073
1075
|
}
|
|
1074
|
-
), 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: [
|
|
1075
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: "⚠️" }) }),
|
|
1076
1078
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1077
1079
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1084,12 +1086,12 @@ const os = ({
|
|
|
1084
1086
|
children: "Go Back"
|
|
1085
1087
|
}
|
|
1086
1088
|
)
|
|
1087
|
-
] }) }),
|
|
1089
|
+
] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */ c(
|
|
1088
1090
|
"div",
|
|
1089
1091
|
{
|
|
1090
|
-
className:
|
|
1092
|
+
className: R("flex items-center justify-center h-full", t),
|
|
1091
1093
|
children: [
|
|
1092
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1093
1095
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1094
1096
|
"animateTransform",
|
|
1095
1097
|
{
|
|
@@ -1127,86 +1129,87 @@ const os = ({
|
|
|
1127
1129
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1128
1130
|
]
|
|
1129
1131
|
}
|
|
1130
|
-
),
|
|
1131
|
-
/* @__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" }),
|
|
1132
1134
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1133
|
-
] }) }),
|
|
1135
|
+
] }) }), vs = ({
|
|
1134
1136
|
capabilities: t = {},
|
|
1135
1137
|
className: s,
|
|
1136
1138
|
renderMessageInputActions: n,
|
|
1137
1139
|
onChannelSelect: r,
|
|
1138
|
-
onParticipantSelect:
|
|
1140
|
+
onParticipantSelect: i,
|
|
1139
1141
|
initialParticipantFilter: d,
|
|
1140
|
-
initialParticipantData:
|
|
1142
|
+
initialParticipantData: a,
|
|
1141
1143
|
CustomChannelEmptyState: l,
|
|
1142
1144
|
showChannelList: o = !0,
|
|
1143
|
-
filters:
|
|
1145
|
+
filters: w,
|
|
1146
|
+
channelListCustomEmptyStateIndicator: I
|
|
1144
1147
|
}) => {
|
|
1145
1148
|
const {
|
|
1146
|
-
service:
|
|
1149
|
+
service: N,
|
|
1147
1150
|
client: m,
|
|
1148
|
-
isConnected:
|
|
1149
|
-
isLoading:
|
|
1150
|
-
error:
|
|
1151
|
-
refreshConnection:
|
|
1152
|
-
debug:
|
|
1153
|
-
} =
|
|
1154
|
-
showStartConversation:
|
|
1155
|
-
participantSource:
|
|
1156
|
-
participantLabel:
|
|
1157
|
-
} = t,
|
|
1158
|
-
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;
|
|
1159
1162
|
return {
|
|
1160
1163
|
...{
|
|
1161
1164
|
type: "messaging",
|
|
1162
1165
|
last_message_at: { $exists: !0 },
|
|
1163
|
-
...
|
|
1164
|
-
members: { $in: [
|
|
1166
|
+
...h && {
|
|
1167
|
+
members: { $in: [h] },
|
|
1165
1168
|
hidden: !1
|
|
1166
1169
|
}
|
|
1167
1170
|
},
|
|
1168
|
-
...
|
|
1171
|
+
...w
|
|
1169
1172
|
};
|
|
1170
|
-
}, [
|
|
1171
|
-
if (!m || !
|
|
1172
|
-
const
|
|
1173
|
-
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)
|
|
1174
1177
|
try {
|
|
1175
|
-
|
|
1178
|
+
v && console.log("[MessagingShell] Syncing channels for user:", h);
|
|
1176
1179
|
const L = await m.queryChannels(
|
|
1177
1180
|
{
|
|
1178
1181
|
type: "messaging",
|
|
1179
|
-
members: { $in: [
|
|
1182
|
+
members: { $in: [h] }
|
|
1180
1183
|
},
|
|
1181
1184
|
{},
|
|
1182
1185
|
{ limit: 100 }
|
|
1183
1186
|
), U = /* @__PURE__ */ new Set();
|
|
1184
|
-
L.forEach((
|
|
1185
|
-
const
|
|
1186
|
-
Object.values(
|
|
1187
|
+
L.forEach((z) => {
|
|
1188
|
+
const Se = z.state.members;
|
|
1189
|
+
Object.values(Se).forEach((ke) => {
|
|
1187
1190
|
var oe;
|
|
1188
|
-
const re = (oe =
|
|
1189
|
-
re && re !==
|
|
1191
|
+
const re = (oe = ke.user) == null ? void 0 : oe.id;
|
|
1192
|
+
re && re !== h && U.add(re);
|
|
1190
1193
|
});
|
|
1191
|
-
}),
|
|
1194
|
+
}), D(U), p(L.length > 0), j.current = h, v && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1192
1195
|
channelCount: L.length,
|
|
1193
1196
|
memberCount: U.size
|
|
1194
1197
|
});
|
|
1195
1198
|
} catch (L) {
|
|
1196
1199
|
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1197
1200
|
}
|
|
1198
|
-
}, [m,
|
|
1199
|
-
|
|
1200
|
-
if (!m || !
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
}, [m,
|
|
1204
|
-
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;
|
|
1205
1208
|
(async () => {
|
|
1206
1209
|
const L = m.userID;
|
|
1207
1210
|
if (L)
|
|
1208
1211
|
try {
|
|
1209
|
-
|
|
1212
|
+
v && console.log(
|
|
1210
1213
|
"[MessagingShell] Loading initial conversation with:",
|
|
1211
1214
|
d
|
|
1212
1215
|
);
|
|
@@ -1219,36 +1222,36 @@ const os = ({
|
|
|
1219
1222
|
{ limit: 1 }
|
|
1220
1223
|
);
|
|
1221
1224
|
if (U.length > 0)
|
|
1222
|
-
|
|
1225
|
+
C(U[0]), W(!0), G(null), r && r(U[0]), v && console.log(
|
|
1223
1226
|
"[MessagingShell] Initial conversation loaded:",
|
|
1224
1227
|
U[0].id
|
|
1225
1228
|
);
|
|
1226
|
-
else if (
|
|
1227
|
-
|
|
1229
|
+
else if (a && N) {
|
|
1230
|
+
v && console.log(
|
|
1228
1231
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1229
|
-
|
|
1232
|
+
a
|
|
1230
1233
|
);
|
|
1231
1234
|
try {
|
|
1232
|
-
const
|
|
1233
|
-
id:
|
|
1234
|
-
name:
|
|
1235
|
-
email:
|
|
1236
|
-
phone:
|
|
1235
|
+
const z = await N.startChannelWithParticipant({
|
|
1236
|
+
id: a.id,
|
|
1237
|
+
name: a.name,
|
|
1238
|
+
email: a.email,
|
|
1239
|
+
phone: a.phone
|
|
1237
1240
|
});
|
|
1238
|
-
|
|
1241
|
+
C(z), W(!0), G(null), r && r(z), v && console.log(
|
|
1239
1242
|
"[MessagingShell] Channel created and loaded:",
|
|
1240
|
-
|
|
1243
|
+
z.id
|
|
1241
1244
|
);
|
|
1242
|
-
} catch (
|
|
1245
|
+
} catch (z) {
|
|
1243
1246
|
console.error(
|
|
1244
1247
|
"[MessagingShell] Failed to create conversation:",
|
|
1245
|
-
|
|
1246
|
-
),
|
|
1248
|
+
z
|
|
1249
|
+
), G("Failed to create conversation");
|
|
1247
1250
|
}
|
|
1248
1251
|
} else
|
|
1249
|
-
|
|
1252
|
+
G(
|
|
1250
1253
|
"No conversation found with this account"
|
|
1251
|
-
),
|
|
1254
|
+
), v && console.log(
|
|
1252
1255
|
"[MessagingShell] No conversation found for:",
|
|
1253
1256
|
d
|
|
1254
1257
|
);
|
|
@@ -1256,103 +1259,104 @@ const os = ({
|
|
|
1256
1259
|
console.error(
|
|
1257
1260
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1258
1261
|
U
|
|
1259
|
-
),
|
|
1262
|
+
), G("Failed to load conversation");
|
|
1260
1263
|
}
|
|
1261
1264
|
})();
|
|
1262
1265
|
}, [
|
|
1263
1266
|
d,
|
|
1264
|
-
|
|
1267
|
+
a,
|
|
1265
1268
|
m,
|
|
1266
|
-
|
|
1269
|
+
S,
|
|
1270
|
+
N,
|
|
1267
1271
|
v,
|
|
1268
|
-
f,
|
|
1269
1272
|
r
|
|
1270
1273
|
]);
|
|
1271
|
-
const
|
|
1272
|
-
(
|
|
1273
|
-
|
|
1274
|
+
const ve = P(
|
|
1275
|
+
(h) => {
|
|
1276
|
+
C(h), r == null || r(h);
|
|
1274
1277
|
},
|
|
1275
1278
|
[r]
|
|
1276
|
-
),
|
|
1277
|
-
|
|
1278
|
-
}, [
|
|
1279
|
-
var
|
|
1280
|
-
|
|
1281
|
-
}, [
|
|
1282
|
-
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) => {
|
|
1283
1286
|
var L;
|
|
1284
|
-
if (
|
|
1287
|
+
if (N)
|
|
1285
1288
|
try {
|
|
1286
|
-
|
|
1289
|
+
v && console.log(
|
|
1287
1290
|
"[MessagingShell] Starting conversation with:",
|
|
1288
|
-
|
|
1291
|
+
h.id
|
|
1289
1292
|
);
|
|
1290
|
-
const U = await
|
|
1291
|
-
id:
|
|
1292
|
-
name:
|
|
1293
|
-
email:
|
|
1294
|
-
phone:
|
|
1293
|
+
const U = await N.startChannelWithParticipant({
|
|
1294
|
+
id: h.id,
|
|
1295
|
+
name: h.name,
|
|
1296
|
+
email: h.email,
|
|
1297
|
+
phone: h.phone
|
|
1295
1298
|
});
|
|
1296
1299
|
try {
|
|
1297
1300
|
await U.show();
|
|
1298
|
-
} catch (
|
|
1299
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1301
|
+
} catch (z) {
|
|
1302
|
+
console.warn("[MessagingShell] Failed to unhide channel:", z);
|
|
1300
1303
|
}
|
|
1301
|
-
|
|
1304
|
+
C(U), f(!1), (L = V.current) == null || L.close(), i == null || i(h);
|
|
1302
1305
|
} catch (U) {
|
|
1303
1306
|
console.error("[MessagingShell] Failed to start conversation:", U);
|
|
1304
1307
|
}
|
|
1305
1308
|
},
|
|
1306
|
-
[
|
|
1309
|
+
[N, i, v]
|
|
1307
1310
|
), te = P(() => {
|
|
1308
|
-
var
|
|
1309
|
-
|
|
1310
|
-
}, []),
|
|
1311
|
-
async (
|
|
1312
|
-
|
|
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();
|
|
1313
1316
|
},
|
|
1314
|
-
[
|
|
1315
|
-
),
|
|
1316
|
-
async (
|
|
1317
|
-
|
|
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();
|
|
1318
1321
|
},
|
|
1319
|
-
[
|
|
1320
|
-
), Z = !!
|
|
1321
|
-
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(
|
|
1322
1325
|
le,
|
|
1323
1326
|
{
|
|
1324
1327
|
message: "Not connected to messaging service",
|
|
1325
|
-
onBack:
|
|
1328
|
+
onBack: E
|
|
1326
1329
|
}
|
|
1327
|
-
) }) :
|
|
1330
|
+
) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */ c(
|
|
1328
1331
|
"div",
|
|
1329
1332
|
{
|
|
1330
|
-
className:
|
|
1333
|
+
className: R(
|
|
1331
1334
|
"messaging-shell h-full bg-white overflow-hidden",
|
|
1332
1335
|
s
|
|
1333
1336
|
),
|
|
1334
1337
|
children: [
|
|
1335
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
|
|
1336
1339
|
/* @__PURE__ */ e(
|
|
1337
1340
|
"div",
|
|
1338
1341
|
{
|
|
1339
|
-
className:
|
|
1342
|
+
className: R(
|
|
1340
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",
|
|
1341
1344
|
{
|
|
1342
1345
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1343
|
-
"!hidden": o === !1 ||
|
|
1346
|
+
"!hidden": o === !1 || O,
|
|
1344
1347
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1345
|
-
"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,
|
|
1346
1349
|
// Normal mode: show when no channel selected
|
|
1347
|
-
"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
|
|
1348
1351
|
}
|
|
1349
1352
|
),
|
|
1350
1353
|
children: /* @__PURE__ */ e(
|
|
1351
|
-
|
|
1354
|
+
Ke,
|
|
1352
1355
|
{
|
|
1353
|
-
onChannelSelect:
|
|
1354
|
-
selectedChannel:
|
|
1355
|
-
filters:
|
|
1356
|
+
onChannelSelect: ve,
|
|
1357
|
+
selectedChannel: F || void 0,
|
|
1358
|
+
filters: A,
|
|
1359
|
+
customEmptyStateIndicator: I
|
|
1356
1360
|
}
|
|
1357
1361
|
)
|
|
1358
1362
|
}
|
|
@@ -1360,66 +1364,66 @@ const os = ({
|
|
|
1360
1364
|
/* @__PURE__ */ e(
|
|
1361
1365
|
"div",
|
|
1362
1366
|
{
|
|
1363
|
-
className:
|
|
1367
|
+
className: R(
|
|
1364
1368
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1365
1369
|
{
|
|
1366
1370
|
// In direct conversation mode, always show (full width)
|
|
1367
|
-
flex:
|
|
1371
|
+
flex: O || Z,
|
|
1368
1372
|
// Normal mode: hide on mobile when no channel selected
|
|
1369
|
-
"hidden lg:flex": !
|
|
1373
|
+
"hidden lg:flex": !O && !Z
|
|
1370
1374
|
}
|
|
1371
1375
|
),
|
|
1372
|
-
children:
|
|
1373
|
-
|
|
1376
|
+
children: F ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1377
|
+
ls,
|
|
1374
1378
|
{
|
|
1375
|
-
channel:
|
|
1376
|
-
onBack:
|
|
1377
|
-
showBackButton: !
|
|
1379
|
+
channel: F,
|
|
1380
|
+
onBack: Ce,
|
|
1381
|
+
showBackButton: !O,
|
|
1378
1382
|
renderMessageInputActions: n,
|
|
1379
|
-
onLeaveConversation:
|
|
1380
|
-
onBlockParticipant:
|
|
1383
|
+
onLeaveConversation: ye,
|
|
1384
|
+
onBlockParticipant: Ie,
|
|
1381
1385
|
CustomChannelEmptyState: l
|
|
1382
1386
|
},
|
|
1383
|
-
|
|
1387
|
+
F.id
|
|
1384
1388
|
) }) : /* @__PURE__ */ e(
|
|
1385
|
-
|
|
1389
|
+
is,
|
|
1386
1390
|
{
|
|
1387
|
-
hasChannels:
|
|
1388
|
-
onStartConversation:
|
|
1389
|
-
participantLabel:
|
|
1391
|
+
hasChannels: T,
|
|
1392
|
+
onStartConversation: X ? we : void 0,
|
|
1393
|
+
participantLabel: M
|
|
1390
1394
|
}
|
|
1391
1395
|
)
|
|
1392
1396
|
}
|
|
1393
1397
|
)
|
|
1394
1398
|
] }),
|
|
1395
|
-
|
|
1399
|
+
k && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1396
1400
|
/* @__PURE__ */ e(
|
|
1397
1401
|
"dialog",
|
|
1398
1402
|
{
|
|
1399
|
-
ref:
|
|
1403
|
+
ref: V,
|
|
1400
1404
|
className: "mes-dialog",
|
|
1401
|
-
onClick: (
|
|
1402
|
-
|
|
1405
|
+
onClick: (h) => {
|
|
1406
|
+
h.target === V.current && te();
|
|
1403
1407
|
},
|
|
1404
1408
|
onClose: te,
|
|
1405
1409
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1406
|
-
|
|
1410
|
+
as,
|
|
1407
1411
|
{
|
|
1408
|
-
participantSource:
|
|
1409
|
-
onSelectParticipant:
|
|
1412
|
+
participantSource: k,
|
|
1413
|
+
onSelectParticipant: Ee,
|
|
1410
1414
|
onClose: te,
|
|
1411
|
-
existingParticipantIds:
|
|
1412
|
-
participantLabel:
|
|
1413
|
-
searchPlaceholder: `Search ${
|
|
1415
|
+
existingParticipantIds: x,
|
|
1416
|
+
participantLabel: M,
|
|
1417
|
+
searchPlaceholder: `Search ${M}...`
|
|
1414
1418
|
},
|
|
1415
|
-
|
|
1419
|
+
q
|
|
1416
1420
|
) })
|
|
1417
1421
|
}
|
|
1418
1422
|
)
|
|
1419
1423
|
]
|
|
1420
1424
|
}
|
|
1421
1425
|
);
|
|
1422
|
-
},
|
|
1426
|
+
}, us = ({
|
|
1423
1427
|
question: t,
|
|
1424
1428
|
onClick: s,
|
|
1425
1429
|
loading: n = !1,
|
|
@@ -1431,7 +1435,7 @@ const os = ({
|
|
|
1431
1435
|
onClick: s,
|
|
1432
1436
|
disabled: n,
|
|
1433
1437
|
style: { backgroundColor: "#E6E5E3" },
|
|
1434
|
-
className:
|
|
1438
|
+
className: R(
|
|
1435
1439
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1436
1440
|
{
|
|
1437
1441
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1441,27 +1445,27 @@ const os = ({
|
|
|
1441
1445
|
),
|
|
1442
1446
|
children: t
|
|
1443
1447
|
}
|
|
1444
|
-
),
|
|
1448
|
+
), Cs = ({
|
|
1445
1449
|
faqs: t,
|
|
1446
1450
|
onFaqClick: s,
|
|
1447
1451
|
loadingFaqId: n,
|
|
1448
1452
|
headerText: r,
|
|
1449
|
-
className:
|
|
1453
|
+
className: i,
|
|
1450
1454
|
avatarImage: d,
|
|
1451
|
-
avatarName:
|
|
1455
|
+
avatarName: a
|
|
1452
1456
|
}) => {
|
|
1453
|
-
const l = t.filter((o) => o.enabled).sort((o,
|
|
1454
|
-
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
1455
|
-
(d ||
|
|
1456
|
-
|
|
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,
|
|
1457
1461
|
{
|
|
1458
|
-
id:
|
|
1459
|
-
name:
|
|
1462
|
+
id: a || "account",
|
|
1463
|
+
name: a || "Account",
|
|
1460
1464
|
image: d,
|
|
1461
1465
|
size: 24
|
|
1462
1466
|
}
|
|
1463
1467
|
) }),
|
|
1464
|
-
/* @__PURE__ */
|
|
1468
|
+
/* @__PURE__ */ c(
|
|
1465
1469
|
"div",
|
|
1466
1470
|
{
|
|
1467
1471
|
className: "flex-1 rounded-lg p-4 space-y-3",
|
|
@@ -1469,7 +1473,7 @@ const os = ({
|
|
|
1469
1473
|
children: [
|
|
1470
1474
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1471
1475
|
l.map((o) => /* @__PURE__ */ e(
|
|
1472
|
-
|
|
1476
|
+
us,
|
|
1473
1477
|
{
|
|
1474
1478
|
question: o.question,
|
|
1475
1479
|
onClick: () => s(o.id),
|
|
@@ -1481,59 +1485,59 @@ const os = ({
|
|
|
1481
1485
|
}
|
|
1482
1486
|
)
|
|
1483
1487
|
] }) });
|
|
1484
|
-
},
|
|
1485
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1486
|
-
if (
|
|
1487
|
-
const
|
|
1488
|
-
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);
|
|
1489
1493
|
try {
|
|
1490
|
-
const
|
|
1491
|
-
search:
|
|
1494
|
+
const f = await t.loadParticipants({
|
|
1495
|
+
search: u || void 0,
|
|
1492
1496
|
limit: r,
|
|
1493
|
-
cursor:
|
|
1497
|
+
cursor: T ? void 0 : g
|
|
1494
1498
|
});
|
|
1495
1499
|
d(
|
|
1496
|
-
(
|
|
1497
|
-
),
|
|
1498
|
-
} catch (
|
|
1499
|
-
const
|
|
1500
|
-
|
|
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);
|
|
1501
1505
|
} finally {
|
|
1502
1506
|
l(!1);
|
|
1503
1507
|
}
|
|
1504
|
-
}, [t,
|
|
1505
|
-
|
|
1506
|
-
}, [
|
|
1507
|
-
|
|
1508
|
-
}, [
|
|
1509
|
-
|
|
1510
|
-
}, [
|
|
1511
|
-
return
|
|
1512
|
-
|
|
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);
|
|
1513
1517
|
}, [t.loadParticipants]), {
|
|
1514
|
-
participants:
|
|
1515
|
-
loading:
|
|
1518
|
+
participants: i,
|
|
1519
|
+
loading: a,
|
|
1516
1520
|
error: o,
|
|
1517
|
-
searchQuery:
|
|
1518
|
-
hasMore:
|
|
1521
|
+
searchQuery: I,
|
|
1522
|
+
hasMore: m,
|
|
1519
1523
|
totalCount: t.totalCount,
|
|
1520
|
-
loadMore:
|
|
1521
|
-
search:
|
|
1522
|
-
refresh:
|
|
1524
|
+
loadMore: v,
|
|
1525
|
+
search: F,
|
|
1526
|
+
refresh: C
|
|
1523
1527
|
};
|
|
1524
1528
|
};
|
|
1525
1529
|
export {
|
|
1526
|
-
|
|
1530
|
+
J as Avatar,
|
|
1527
1531
|
be as ChannelEmptyState,
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
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
|
|
1538
1542
|
};
|
|
1539
1543
|
//# sourceMappingURL=index.js.map
|