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