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