@linktr.ee/messaging-react 1.20.0 โ 1.21.0-rc-1771294922
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/dist/index.js +432 -428
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +7 -0
- package/src/types.ts +8 -0
package/dist/index.js
CHANGED
|
@@ -24,8 +24,8 @@ const Le = Je({
|
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
26
|
const r = T(
|
|
27
|
-
(
|
|
28
|
-
c && console.log(`๐ฅ [MessagingProvider] ${
|
|
27
|
+
(u, ...N) => {
|
|
28
|
+
c && console.log(`๐ฅ [MessagingProvider] ${u}`, ...N);
|
|
29
29
|
},
|
|
30
30
|
[c]
|
|
31
31
|
);
|
|
@@ -35,84 +35,84 @@ const Le = Je({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [d, b] = k(null), [
|
|
38
|
+
const [d, b] = k(null), [m, M] = k(null), [x, g] = k(!1), [l, I] = k(!1), [_, y] = k(null), E = V(!1), h = V({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: a,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: o
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
43
|
+
}), p = V(0);
|
|
44
|
+
p.current++, r("๐ RENDER INFO", {
|
|
45
|
+
renderCount: p.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: h.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: h.current.apiKey !== a,
|
|
50
|
+
serviceConfigChanged: h.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: h.current.capabilities !== o
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), h.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: a,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: o
|
|
58
58
|
}, W(() => {
|
|
59
|
-
const
|
|
59
|
+
const u = p.current;
|
|
60
60
|
if (r("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
-
renderCount:
|
|
61
|
+
renderCount: u,
|
|
62
62
|
apiKey: !!a,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: h.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: h.current.apiKey === a
|
|
69
69
|
}
|
|
70
70
|
}), !a || !n) {
|
|
71
71
|
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
-
renderCount:
|
|
72
|
+
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
r("๐ CREATING NEW SERVICE", {
|
|
78
|
-
renderCount:
|
|
78
|
+
renderCount: u,
|
|
79
79
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: h.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const N = new Xe({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: a,
|
|
85
85
|
debug: c
|
|
86
86
|
});
|
|
87
|
-
return b(
|
|
88
|
-
renderCount:
|
|
89
|
-
serviceInstance: !!
|
|
87
|
+
return b(N), r("โ
SERVICE SET", {
|
|
88
|
+
renderCount: u,
|
|
89
|
+
serviceInstance: !!N
|
|
90
90
|
}), () => {
|
|
91
91
|
r("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [a, n, c, r]);
|
|
97
|
-
const
|
|
97
|
+
const C = V(null);
|
|
98
98
|
W(() => {
|
|
99
|
-
var
|
|
99
|
+
var N, R;
|
|
100
100
|
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!d,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
105
|
-
isConnected:
|
|
104
|
+
isConnecting: E.current,
|
|
105
|
+
isConnected: x,
|
|
106
106
|
dependencies: { service: !!d, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !d || !s) {
|
|
108
108
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (E.current) {
|
|
112
112
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
115
|
+
if (((N = C.current) == null ? void 0 : N.serviceId) === d && ((R = C.current) == null ? void 0 : R.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,40 +120,40 @@ const Le = Je({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
r("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
r("๐ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, I(!0), y(null);
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const w = await d.connectUser(s);
|
|
127
|
+
M(w), g(!0), C.current = { serviceId: d, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: w.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
|
|
131
|
+
} catch (w) {
|
|
132
|
+
const F = w instanceof Error ? w.message : "Connection failed";
|
|
133
|
+
y(F), r("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: F
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
I(!1), E.current = !1, r("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: x
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [d, s, r,
|
|
144
|
+
}, [d, s, r, x]), W(() => (r("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!d,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: x
|
|
147
147
|
}), () => {
|
|
148
|
-
d &&
|
|
148
|
+
d && x ? (r(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), C.current = null, d.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!d,
|
|
153
|
-
isConnected:
|
|
153
|
+
isConnected: x
|
|
154
154
|
});
|
|
155
|
-
}), [d,
|
|
156
|
-
const
|
|
155
|
+
}), [d, x, r]);
|
|
156
|
+
const v = T(async () => {
|
|
157
157
|
if (r("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!d,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,55 +161,55 @@ const Le = Je({
|
|
|
161
161
|
r("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }), I(!0);
|
|
165
165
|
try {
|
|
166
166
|
r("๐ DISCONNECTING FOR REFRESH"), await d.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
const
|
|
171
|
-
|
|
167
|
+
const u = await d.connectUser(s);
|
|
168
|
+
M(u), g(!0), y(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (u) {
|
|
170
|
+
const N = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
+
y(N), r("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: N
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
I(!1), r("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [d, s, r]),
|
|
178
|
+
}, [d, s, r]), f = B.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!d,
|
|
180
|
-
hasClient: !!
|
|
181
|
-
isConnected:
|
|
180
|
+
hasClient: !!m,
|
|
181
|
+
isConnected: x,
|
|
182
182
|
isLoading: l,
|
|
183
|
-
hasError: !!
|
|
183
|
+
hasError: !!_,
|
|
184
184
|
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
186
|
service: d,
|
|
187
|
-
client:
|
|
188
|
-
isConnected:
|
|
187
|
+
client: m,
|
|
188
|
+
isConnected: x,
|
|
189
189
|
isLoading: l,
|
|
190
|
-
error:
|
|
190
|
+
error: _,
|
|
191
191
|
capabilities: o,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: v,
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
195
|
d,
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
m,
|
|
197
|
+
x,
|
|
198
198
|
l,
|
|
199
|
-
|
|
199
|
+
_,
|
|
200
200
|
o,
|
|
201
|
-
|
|
201
|
+
v,
|
|
202
202
|
c,
|
|
203
203
|
r
|
|
204
204
|
]);
|
|
205
205
|
return r("๐ RENDER END", {
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(Le.Provider, { value:
|
|
206
|
+
renderCount: p.current,
|
|
207
|
+
willRenderChat: !!(m && x),
|
|
208
|
+
contextValueReady: !!f
|
|
209
|
+
}), /* @__PURE__ */ e(Le.Provider, { value: f, children: m && x ? /* @__PURE__ */ e(
|
|
210
210
|
Ke,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: m,
|
|
213
213
|
customClasses: {
|
|
214
214
|
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
215
|
},
|
|
@@ -365,26 +365,26 @@ const Q = ({
|
|
|
365
365
|
unread: o,
|
|
366
366
|
renderMessagePreview: c
|
|
367
367
|
}) => {
|
|
368
|
-
var
|
|
368
|
+
var p, C, v, f, u, N;
|
|
369
369
|
const r = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
|
|
370
370
|
t && n(t);
|
|
371
|
-
},
|
|
371
|
+
}, m = Object.values(((p = t == null ? void 0 : t.state) == null ? void 0 : p.members) || {}).find(
|
|
372
372
|
(R) => {
|
|
373
|
-
var
|
|
374
|
-
return ((
|
|
373
|
+
var w, F;
|
|
374
|
+
return ((w = R.user) == null ? void 0 : w.id) && R.user.id !== ((F = t == null ? void 0 : t._client) == null ? void 0 : F.userID);
|
|
375
375
|
}
|
|
376
|
-
),
|
|
377
|
-
var
|
|
378
|
-
if (
|
|
379
|
-
const R = (
|
|
376
|
+
), M = ((C = m == null ? void 0 : m.user) == null ? void 0 : C.name) || "Conversation", x = (v = m == null ? void 0 : m.user) == null ? void 0 : v.image, g = (u = (f = t == null ? void 0 : t.state) == null ? void 0 : f.messages) == null ? void 0 : u[t.state.messages.length - 1], I = (() => {
|
|
377
|
+
var w;
|
|
378
|
+
if (g != null && g.text) return g.text;
|
|
379
|
+
const R = (w = g == null ? void 0 : g.attachments) == null ? void 0 : w[0];
|
|
380
380
|
return R ? R.og_scrape_url ? R.og_scrape_url : R.type === "image" ? "๐ท Sent an image" : R.type === "video" ? "๐ฅ Sent a video" : R.type === "audio" ? "๐ต Sent audio" : R.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
381
|
-
})(),
|
|
381
|
+
})(), _ = g != null && g.created_at ? Vs(new Date(g.created_at)) : "", y = g ? ye(g) : !1, E = c ? c(g, I) : `${y ? "โจ " : ""}${I}`, h = o ?? 0;
|
|
382
382
|
return a && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
383
383
|
channelId: t == null ? void 0 : t.id,
|
|
384
384
|
isSelected: r,
|
|
385
|
-
participantName:
|
|
386
|
-
unreadCount:
|
|
387
|
-
hasTimestamp: !!
|
|
385
|
+
participantName: M,
|
|
386
|
+
unreadCount: h,
|
|
387
|
+
hasTimestamp: !!_
|
|
388
388
|
}), /* @__PURE__ */ e(
|
|
389
389
|
"button",
|
|
390
390
|
{
|
|
@@ -401,9 +401,9 @@ const Q = ({
|
|
|
401
401
|
/* @__PURE__ */ e(
|
|
402
402
|
Q,
|
|
403
403
|
{
|
|
404
|
-
id: ((
|
|
405
|
-
name:
|
|
406
|
-
image:
|
|
404
|
+
id: ((N = m == null ? void 0 : m.user) == null ? void 0 : N.id) || t.id || "unknown",
|
|
405
|
+
name: M,
|
|
406
|
+
image: x,
|
|
407
407
|
size: 44,
|
|
408
408
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
409
409
|
}
|
|
@@ -417,14 +417,14 @@ const Q = ({
|
|
|
417
417
|
"text-sm font-medium truncate",
|
|
418
418
|
r ? "text-primary" : "text-charcoal"
|
|
419
419
|
),
|
|
420
|
-
children:
|
|
420
|
+
children: M
|
|
421
421
|
}
|
|
422
422
|
),
|
|
423
|
-
|
|
423
|
+
_ && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: _ })
|
|
424
424
|
] }),
|
|
425
425
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
426
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children:
|
|
427
|
-
|
|
426
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: E }),
|
|
427
|
+
h > 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: h > 99 ? "99+" : h })
|
|
428
428
|
] })
|
|
429
429
|
] })
|
|
430
430
|
] })
|
|
@@ -450,10 +450,10 @@ const Ue = B.memo(
|
|
|
450
450
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
451
451
|
filters: n
|
|
452
452
|
});
|
|
453
|
-
const b = B.useMemo(() => (
|
|
453
|
+
const b = B.useMemo(() => (M) => /* @__PURE__ */ e(
|
|
454
454
|
Oe,
|
|
455
455
|
{
|
|
456
|
-
...
|
|
456
|
+
...M,
|
|
457
457
|
selectedChannel: s,
|
|
458
458
|
onChannelSelect: t,
|
|
459
459
|
debug: d,
|
|
@@ -614,27 +614,27 @@ const st = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
614
614
|
groupedByUser: r,
|
|
615
615
|
handleAction: d,
|
|
616
616
|
handleOpenThread: b,
|
|
617
|
-
handleRetry:
|
|
618
|
-
highlighted:
|
|
619
|
-
isMessageAIGenerated:
|
|
620
|
-
isMyMessage:
|
|
617
|
+
handleRetry: m,
|
|
618
|
+
highlighted: M,
|
|
619
|
+
isMessageAIGenerated: x,
|
|
620
|
+
isMyMessage: g,
|
|
621
621
|
message: l,
|
|
622
|
-
renderText:
|
|
623
|
-
threadList:
|
|
624
|
-
} = t, { client:
|
|
625
|
-
Attachment:
|
|
626
|
-
EditMessageModal:
|
|
622
|
+
renderText: I,
|
|
623
|
+
threadList: _
|
|
624
|
+
} = t, { client: y } = Fe("CustomMessage"), [E, h] = k(!1), p = ns(l.id), { selected: C, voteUp: v, voteDown: f } = et(l), {
|
|
625
|
+
Attachment: u = as,
|
|
626
|
+
EditMessageModal: N = ls,
|
|
627
627
|
MessageBlocked: R = os,
|
|
628
|
-
MessageBouncePrompt:
|
|
629
|
-
MessageDeleted:
|
|
628
|
+
MessageBouncePrompt: w = is,
|
|
629
|
+
MessageDeleted: F = cs,
|
|
630
630
|
MessageIsThreadReplyInChannelButtonIndicator: $ = ds,
|
|
631
631
|
MessageRepliesCountButton: te = us,
|
|
632
632
|
ReminderNotification: X = ms,
|
|
633
633
|
StreamedMessageText: K = hs,
|
|
634
634
|
PinIndicator: q
|
|
635
635
|
} = rs("CustomMessage"), ne = fs(l), Z = gs(l), ee = be(
|
|
636
|
-
() =>
|
|
637
|
-
[
|
|
636
|
+
() => x == null ? void 0 : x(l),
|
|
637
|
+
[x, l]
|
|
638
638
|
), G = be(
|
|
639
639
|
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
640
640
|
[l]
|
|
@@ -642,48 +642,48 @@ const st = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
642
642
|
if (xs(l))
|
|
643
643
|
return null;
|
|
644
644
|
if (l.deleted_at || l.type === "deleted")
|
|
645
|
-
return /* @__PURE__ */ e(
|
|
645
|
+
return /* @__PURE__ */ e(F, { message: l });
|
|
646
646
|
if (bs(l))
|
|
647
647
|
return /* @__PURE__ */ e(R, {});
|
|
648
|
-
const
|
|
648
|
+
const P = !_ && !!l.reply_count, U = !_ && l.show_in_channel && l.parent_id, L = l.status === "failed" && ((re = l.error) == null ? void 0 : re.status) !== 403, j = Cs(l);
|
|
649
649
|
let z;
|
|
650
|
-
|
|
650
|
+
L ? z = () => m(l) : j && (z = () => h(!0));
|
|
651
651
|
const Y = D(
|
|
652
652
|
"str-chat__message str-chat__message-simple",
|
|
653
653
|
`str-chat__message--${l.type}`,
|
|
654
654
|
`str-chat__message--${l.status}`,
|
|
655
|
-
|
|
655
|
+
g() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
656
656
|
l.text ? "str-chat__message--has-text" : "has-no-text",
|
|
657
657
|
{
|
|
658
658
|
"str-chat__message--has-attachment": ne,
|
|
659
|
-
"str-chat__message--highlighted":
|
|
659
|
+
"str-chat__message--highlighted": M,
|
|
660
660
|
"str-chat__message--pinned pinned-message": l.pinned,
|
|
661
661
|
"str-chat__message--with-reactions": Z,
|
|
662
662
|
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((le = l == null ? void 0 : l.error) == null ? void 0 : le.status) !== 403,
|
|
663
|
-
"str-chat__message-with-thread-link":
|
|
663
|
+
"str-chat__message-with-thread-link": P || U,
|
|
664
664
|
"str-chat__virtual-message__wrapper--end": o,
|
|
665
665
|
"str-chat__virtual-message__wrapper--first": c,
|
|
666
666
|
"str-chat__virtual-message__wrapper--group": r
|
|
667
667
|
}
|
|
668
|
-
), J = l.poll_id &&
|
|
668
|
+
), J = l.poll_id && y.polls.fromState(l.poll_id), ae = Qs(l);
|
|
669
669
|
return /* @__PURE__ */ i(ve, { children: [
|
|
670
670
|
a && /* @__PURE__ */ e(
|
|
671
|
-
|
|
671
|
+
N,
|
|
672
672
|
{
|
|
673
673
|
additionalMessageInputProps: s
|
|
674
674
|
}
|
|
675
675
|
),
|
|
676
|
-
|
|
676
|
+
E && /* @__PURE__ */ e(
|
|
677
677
|
Ns,
|
|
678
678
|
{
|
|
679
|
-
MessageBouncePrompt:
|
|
680
|
-
onClose: () =>
|
|
681
|
-
open:
|
|
679
|
+
MessageBouncePrompt: w,
|
|
680
|
+
onClose: () => h(!1),
|
|
681
|
+
open: E
|
|
682
682
|
}
|
|
683
683
|
),
|
|
684
684
|
/* @__PURE__ */ i("div", { className: Y, children: [
|
|
685
685
|
q && /* @__PURE__ */ e(q, {}),
|
|
686
|
-
!!
|
|
686
|
+
!!p && /* @__PURE__ */ e(X, { reminder: p }),
|
|
687
687
|
l.user && /* @__PURE__ */ e(
|
|
688
688
|
Q,
|
|
689
689
|
{
|
|
@@ -697,7 +697,7 @@ const st = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
697
697
|
"div",
|
|
698
698
|
{
|
|
699
699
|
className: D("str-chat__message-inner", {
|
|
700
|
-
"str-chat__simple-message--error-failed":
|
|
700
|
+
"str-chat__simple-message--error-failed": L || j
|
|
701
701
|
}),
|
|
702
702
|
"data-testid": "message-inner",
|
|
703
703
|
onClick: z,
|
|
@@ -717,7 +717,7 @@ const st = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
717
717
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
718
718
|
J && /* @__PURE__ */ e(vs, { poll: J }),
|
|
719
719
|
G != null && G.length && !l.quoted_message ? /* @__PURE__ */ e(
|
|
720
|
-
|
|
720
|
+
u,
|
|
721
721
|
{
|
|
722
722
|
actionHandler: d,
|
|
723
723
|
attachments: G
|
|
@@ -727,24 +727,24 @@ const st = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
727
727
|
K,
|
|
728
728
|
{
|
|
729
729
|
message: l,
|
|
730
|
-
renderText:
|
|
730
|
+
renderText: I
|
|
731
731
|
}
|
|
732
|
-
) : /* @__PURE__ */ e(ws, { message: l, renderText:
|
|
732
|
+
) : /* @__PURE__ */ e(ws, { message: l, renderText: I }),
|
|
733
733
|
/* @__PURE__ */ e(ps, {})
|
|
734
734
|
] }),
|
|
735
735
|
/* @__PURE__ */ e(Te, { message: l }),
|
|
736
736
|
n && ye(l) && /* @__PURE__ */ e(
|
|
737
737
|
nt,
|
|
738
738
|
{
|
|
739
|
-
selected:
|
|
740
|
-
onVoteUp:
|
|
741
|
-
onVoteDown:
|
|
739
|
+
selected: C,
|
|
740
|
+
onVoteUp: v,
|
|
741
|
+
onVoteDown: f
|
|
742
742
|
}
|
|
743
743
|
)
|
|
744
744
|
] })
|
|
745
745
|
}
|
|
746
746
|
),
|
|
747
|
-
|
|
747
|
+
P && /* @__PURE__ */ e(
|
|
748
748
|
te,
|
|
749
749
|
{
|
|
750
750
|
onClick: b,
|
|
@@ -921,33 +921,33 @@ const gt = ({
|
|
|
921
921
|
canShowInfo: a,
|
|
922
922
|
showStarButton: o = !1
|
|
923
923
|
}) => {
|
|
924
|
-
var
|
|
924
|
+
var g, l, I, _, y, E;
|
|
925
925
|
const { channel: c } = we(), r = B.useMemo(() => Object.values(c.state.members || {}).find(
|
|
926
|
-
(
|
|
927
|
-
var
|
|
928
|
-
return ((
|
|
926
|
+
(p) => {
|
|
927
|
+
var C;
|
|
928
|
+
return ((C = p.user) == null ? void 0 : C.id) && p.user.id !== c._client.userID;
|
|
929
929
|
}
|
|
930
|
-
), [c._client.userID, c.state.members]), d = ((
|
|
931
|
-
!!((
|
|
930
|
+
), [c._client.userID, c.state.members]), d = ((g = r == null ? void 0 : r.user) == null ? void 0 : g.name) || ((l = r == null ? void 0 : r.user) == null ? void 0 : l.id) || "Unknown member", b = (I = r == null ? void 0 : r.user) == null ? void 0 : I.image, [m, M] = k(
|
|
931
|
+
!!((_ = c.state.membership) != null && _.pinned_at)
|
|
932
932
|
);
|
|
933
933
|
W(() => {
|
|
934
|
-
const
|
|
935
|
-
var
|
|
936
|
-
|
|
937
|
-
|
|
934
|
+
const h = (p) => {
|
|
935
|
+
var C;
|
|
936
|
+
M(
|
|
937
|
+
p != null && p.member ? !!p.member.pinned_at : !!((C = c.state.membership) != null && C.pinned_at)
|
|
938
938
|
);
|
|
939
939
|
};
|
|
940
|
-
return c.on("member.updated",
|
|
941
|
-
c.off("member.updated",
|
|
940
|
+
return c.on("member.updated", h), () => {
|
|
941
|
+
c.off("member.updated", h);
|
|
942
942
|
};
|
|
943
943
|
}, [c]);
|
|
944
|
-
const
|
|
944
|
+
const x = async () => {
|
|
945
945
|
try {
|
|
946
|
-
|
|
947
|
-
} catch (
|
|
946
|
+
m ? await c.unpin() : await c.pin();
|
|
947
|
+
} catch (h) {
|
|
948
948
|
console.error(
|
|
949
949
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
950
|
-
|
|
950
|
+
h
|
|
951
951
|
);
|
|
952
952
|
}
|
|
953
953
|
};
|
|
@@ -970,7 +970,7 @@ const gt = ({
|
|
|
970
970
|
/* @__PURE__ */ e(
|
|
971
971
|
Q,
|
|
972
972
|
{
|
|
973
|
-
id: ((
|
|
973
|
+
id: ((y = r == null ? void 0 : r.user) == null ? void 0 : y.id) || c.id || "unknown",
|
|
974
974
|
name: d,
|
|
975
975
|
image: b,
|
|
976
976
|
size: 40
|
|
@@ -983,17 +983,17 @@ const gt = ({
|
|
|
983
983
|
"button",
|
|
984
984
|
{
|
|
985
985
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
986
|
-
onClick:
|
|
986
|
+
onClick: x,
|
|
987
987
|
type: "button",
|
|
988
|
-
"aria-label":
|
|
988
|
+
"aria-label": m ? "Unstar conversation" : "Star conversation",
|
|
989
989
|
children: /* @__PURE__ */ e(
|
|
990
990
|
_e,
|
|
991
991
|
{
|
|
992
992
|
className: D("size-5", {
|
|
993
|
-
"text-yellow-600":
|
|
994
|
-
"text-black/90": !
|
|
993
|
+
"text-yellow-600": m,
|
|
994
|
+
"text-black/90": !m
|
|
995
995
|
}),
|
|
996
|
-
weight:
|
|
996
|
+
weight: m ? "duotone" : "regular"
|
|
997
997
|
}
|
|
998
998
|
)
|
|
999
999
|
}
|
|
@@ -1025,7 +1025,7 @@ const gt = ({
|
|
|
1025
1025
|
/* @__PURE__ */ e(
|
|
1026
1026
|
Q,
|
|
1027
1027
|
{
|
|
1028
|
-
id: ((
|
|
1028
|
+
id: ((E = r == null ? void 0 : r.user) == null ? void 0 : E.id) || c.id || "unknown",
|
|
1029
1029
|
name: d,
|
|
1030
1030
|
image: b,
|
|
1031
1031
|
size: 40
|
|
@@ -1038,17 +1038,17 @@ const gt = ({
|
|
|
1038
1038
|
"button",
|
|
1039
1039
|
{
|
|
1040
1040
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
1041
|
-
onClick:
|
|
1041
|
+
onClick: x,
|
|
1042
1042
|
type: "button",
|
|
1043
|
-
"aria-label":
|
|
1043
|
+
"aria-label": m ? "Unstar conversation" : "Star conversation",
|
|
1044
1044
|
children: /* @__PURE__ */ e(
|
|
1045
1045
|
_e,
|
|
1046
1046
|
{
|
|
1047
1047
|
className: D("size-5", {
|
|
1048
|
-
"text-yellow-600":
|
|
1049
|
-
"text-black/90": !
|
|
1048
|
+
"text-yellow-600": m,
|
|
1049
|
+
"text-black/90": !m
|
|
1050
1050
|
}),
|
|
1051
|
-
weight:
|
|
1051
|
+
weight: m ? "duotone" : "regular"
|
|
1052
1052
|
}
|
|
1053
1053
|
)
|
|
1054
1054
|
}
|
|
@@ -1076,77 +1076,77 @@ const gt = ({
|
|
|
1076
1076
|
onBlockParticipant: r,
|
|
1077
1077
|
showDeleteConversation: d = !0,
|
|
1078
1078
|
onDeleteConversationClick: b,
|
|
1079
|
-
onBlockParticipantClick:
|
|
1080
|
-
onReportParticipantClick:
|
|
1079
|
+
onBlockParticipantClick: m,
|
|
1080
|
+
onReportParticipantClick: M
|
|
1081
1081
|
}) => {
|
|
1082
1082
|
var X, K, q, ne, Z, ee, G;
|
|
1083
|
-
const { service:
|
|
1084
|
-
var
|
|
1085
|
-
if (!(!
|
|
1083
|
+
const { service: x, debug: g } = fe(), [l, I] = k(!1), [_, y] = k(!1), [E, h] = k(!1), p = T(async () => {
|
|
1084
|
+
var P;
|
|
1085
|
+
if (!(!x || !((P = n == null ? void 0 : n.user) != null && P.id)))
|
|
1086
1086
|
try {
|
|
1087
|
-
const
|
|
1087
|
+
const L = (await x.getBlockedUsers()).some(
|
|
1088
1088
|
(j) => {
|
|
1089
1089
|
var z;
|
|
1090
1090
|
return j.blocked_user_id === ((z = n == null ? void 0 : n.user) == null ? void 0 : z.id);
|
|
1091
1091
|
}
|
|
1092
1092
|
);
|
|
1093
|
-
|
|
1093
|
+
I(L);
|
|
1094
1094
|
} catch (U) {
|
|
1095
1095
|
console.error(
|
|
1096
1096
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
1097
1097
|
U
|
|
1098
1098
|
);
|
|
1099
1099
|
}
|
|
1100
|
-
}, [
|
|
1100
|
+
}, [x, (X = n == null ? void 0 : n.user) == null ? void 0 : X.id]);
|
|
1101
1101
|
W(() => {
|
|
1102
|
-
|
|
1103
|
-
}, [
|
|
1104
|
-
const
|
|
1105
|
-
var
|
|
1106
|
-
if (!
|
|
1107
|
-
b == null || b(),
|
|
1102
|
+
p();
|
|
1103
|
+
}, [p]);
|
|
1104
|
+
const C = async () => {
|
|
1105
|
+
var P;
|
|
1106
|
+
if (!_) {
|
|
1107
|
+
b == null || b(), g && console.log("[ChannelInfoDialog] Leave conversation", a.cid), y(!0);
|
|
1108
1108
|
try {
|
|
1109
|
-
const U = ((
|
|
1109
|
+
const U = ((P = a._client) == null ? void 0 : P.userID) ?? null;
|
|
1110
1110
|
await a.hide(U, !1), c && await c(a), s();
|
|
1111
1111
|
} catch (U) {
|
|
1112
1112
|
console.error("[ChannelInfoDialog] Failed to leave conversation", U);
|
|
1113
1113
|
} finally {
|
|
1114
|
-
|
|
1114
|
+
y(!1);
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
|
-
},
|
|
1118
|
-
var
|
|
1119
|
-
if (!(
|
|
1120
|
-
|
|
1117
|
+
}, v = async () => {
|
|
1118
|
+
var P, U, L;
|
|
1119
|
+
if (!(E || !x)) {
|
|
1120
|
+
m == null || m(), g && console.log("[ChannelInfoDialog] Block member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), h(!0);
|
|
1121
1121
|
try {
|
|
1122
|
-
await
|
|
1122
|
+
await x.blockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
|
|
1123
1123
|
} catch (j) {
|
|
1124
1124
|
console.error("[ChannelInfoDialog] Failed to block member", j);
|
|
1125
1125
|
} finally {
|
|
1126
|
-
|
|
1126
|
+
h(!1);
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
},
|
|
1130
|
-
var
|
|
1131
|
-
if (!(
|
|
1132
|
-
|
|
1129
|
+
}, f = async () => {
|
|
1130
|
+
var P, U, L;
|
|
1131
|
+
if (!(E || !x)) {
|
|
1132
|
+
m == null || m(), g && console.log("[ChannelInfoDialog] Unblock member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), h(!0);
|
|
1133
1133
|
try {
|
|
1134
|
-
await
|
|
1134
|
+
await x.unBlockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
|
|
1135
1135
|
} catch (j) {
|
|
1136
1136
|
console.error("[ChannelInfoDialog] Failed to unblock member", j);
|
|
1137
1137
|
} finally {
|
|
1138
|
-
|
|
1138
|
+
h(!1);
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
},
|
|
1142
|
-
|
|
1141
|
+
}, u = () => {
|
|
1142
|
+
M == null || M(), s(), window.open(
|
|
1143
1143
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1144
1144
|
"_blank",
|
|
1145
1145
|
"noopener,noreferrer"
|
|
1146
1146
|
);
|
|
1147
1147
|
};
|
|
1148
1148
|
if (!n) return null;
|
|
1149
|
-
const
|
|
1149
|
+
const N = ((K = n.user) == null ? void 0 : K.name) || ((q = n.user) == null ? void 0 : q.id) || "Unknown member", R = (ne = n.user) == null ? void 0 : ne.image, w = (Z = n.user) == null ? void 0 : Z.email, F = (ee = n.user) == null ? void 0 : ee.username, $ = w || (F ? `linktr.ee/${F}` : void 0), te = ((G = n.user) == null ? void 0 : G.id) || "unknown";
|
|
1150
1150
|
return (
|
|
1151
1151
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1152
1152
|
/* @__PURE__ */ e(
|
|
@@ -1155,8 +1155,8 @@ const gt = ({
|
|
|
1155
1155
|
ref: t,
|
|
1156
1156
|
className: "mes-dialog group",
|
|
1157
1157
|
onClose: s,
|
|
1158
|
-
onClick: (
|
|
1159
|
-
|
|
1158
|
+
onClick: (P) => {
|
|
1159
|
+
P.target === t.current && s();
|
|
1160
1160
|
},
|
|
1161
1161
|
children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
1162
1162
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
@@ -1174,14 +1174,14 @@ const gt = ({
|
|
|
1174
1174
|
Q,
|
|
1175
1175
|
{
|
|
1176
1176
|
id: te,
|
|
1177
|
-
name:
|
|
1177
|
+
name: N,
|
|
1178
1178
|
image: R,
|
|
1179
1179
|
size: 88,
|
|
1180
1180
|
shape: "circle"
|
|
1181
1181
|
}
|
|
1182
1182
|
),
|
|
1183
1183
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1184
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1184
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: N }),
|
|
1185
1185
|
$ && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: $ }),
|
|
1186
1186
|
o && /* @__PURE__ */ e(
|
|
1187
1187
|
"span",
|
|
@@ -1205,11 +1205,11 @@ const gt = ({
|
|
|
1205
1205
|
d && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1206
1206
|
de,
|
|
1207
1207
|
{
|
|
1208
|
-
onClick:
|
|
1209
|
-
disabled:
|
|
1210
|
-
"aria-busy":
|
|
1208
|
+
onClick: C,
|
|
1209
|
+
disabled: _,
|
|
1210
|
+
"aria-busy": _,
|
|
1211
1211
|
children: [
|
|
1212
|
-
|
|
1212
|
+
_ ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(As, { className: "h-5 w-5" }),
|
|
1213
1213
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1214
1214
|
]
|
|
1215
1215
|
}
|
|
@@ -1217,27 +1217,27 @@ const gt = ({
|
|
|
1217
1217
|
/* @__PURE__ */ e("li", { children: l ? /* @__PURE__ */ i(
|
|
1218
1218
|
de,
|
|
1219
1219
|
{
|
|
1220
|
-
onClick:
|
|
1221
|
-
disabled:
|
|
1222
|
-
"aria-busy":
|
|
1220
|
+
onClick: f,
|
|
1221
|
+
disabled: E,
|
|
1222
|
+
"aria-busy": E,
|
|
1223
1223
|
children: [
|
|
1224
|
-
|
|
1224
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Me, { className: "h-5 w-5" }),
|
|
1225
1225
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1226
1226
|
]
|
|
1227
1227
|
}
|
|
1228
1228
|
) : /* @__PURE__ */ i(
|
|
1229
1229
|
de,
|
|
1230
1230
|
{
|
|
1231
|
-
onClick:
|
|
1232
|
-
disabled:
|
|
1233
|
-
"aria-busy":
|
|
1231
|
+
onClick: v,
|
|
1232
|
+
disabled: E,
|
|
1233
|
+
"aria-busy": E,
|
|
1234
1234
|
children: [
|
|
1235
|
-
|
|
1235
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Me, { className: "h-5 w-5" }),
|
|
1236
1236
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1237
1237
|
]
|
|
1238
1238
|
}
|
|
1239
1239
|
) }),
|
|
1240
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(de, { variant: "danger", onClick:
|
|
1240
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(de, { variant: "danger", onClick: u, children: [
|
|
1241
1241
|
/* @__PURE__ */ e($s, { className: "h-5 w-5" }),
|
|
1242
1242
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1243
1243
|
] }) })
|
|
@@ -1257,33 +1257,34 @@ const gt = ({
|
|
|
1257
1257
|
onDeleteConversationClick: r,
|
|
1258
1258
|
onBlockParticipantClick: d,
|
|
1259
1259
|
onReportParticipantClick: b,
|
|
1260
|
-
showStarButton:
|
|
1261
|
-
chatbotVotingEnabled:
|
|
1260
|
+
showStarButton: m = !1,
|
|
1261
|
+
chatbotVotingEnabled: M = !1,
|
|
1262
|
+
renderChannelBanner: x
|
|
1262
1263
|
}) => {
|
|
1263
|
-
const { channel:
|
|
1264
|
-
(
|
|
1265
|
-
var
|
|
1266
|
-
return ((
|
|
1264
|
+
const { channel: g } = we(), l = V(null), I = B.useMemo(() => Object.values(g.state.members || {}).find(
|
|
1265
|
+
(p) => {
|
|
1266
|
+
var C;
|
|
1267
|
+
return ((C = p.user) == null ? void 0 : C.id) && p.user.id !== g._client.userID;
|
|
1267
1268
|
}
|
|
1268
|
-
), [
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1271
|
-
return String(
|
|
1272
|
-
if (
|
|
1273
|
-
return
|
|
1274
|
-
}, [
|
|
1275
|
-
var
|
|
1276
|
-
(
|
|
1269
|
+
), [g._client.userID, g.state.members]), _ = B.useMemo(() => {
|
|
1270
|
+
const h = g.data ?? {};
|
|
1271
|
+
if (h.followerStatus)
|
|
1272
|
+
return String(h.followerStatus);
|
|
1273
|
+
if (h.isFollower !== void 0)
|
|
1274
|
+
return h.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1275
|
+
}, [g.data]), y = T(() => {
|
|
1276
|
+
var h;
|
|
1277
|
+
(h = l.current) == null || h.showModal();
|
|
1277
1278
|
}, []), E = T(() => {
|
|
1278
|
-
var
|
|
1279
|
-
(
|
|
1279
|
+
var h;
|
|
1280
|
+
(h = l.current) == null || h.close();
|
|
1280
1281
|
}, []);
|
|
1281
1282
|
return /* @__PURE__ */ i(ve, { children: [
|
|
1282
1283
|
/* @__PURE__ */ e(
|
|
1283
1284
|
Ps,
|
|
1284
1285
|
{
|
|
1285
1286
|
overrides: {
|
|
1286
|
-
Message: (
|
|
1287
|
+
Message: (h) => /* @__PURE__ */ e(lt, { ...h, chatbotVotingEnabled: M })
|
|
1287
1288
|
},
|
|
1288
1289
|
children: /* @__PURE__ */ i(Os, { children: [
|
|
1289
1290
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
@@ -1291,11 +1292,12 @@ const gt = ({
|
|
|
1291
1292
|
{
|
|
1292
1293
|
onBack: t,
|
|
1293
1294
|
showBackButton: s,
|
|
1294
|
-
onShowInfo:
|
|
1295
|
-
canShowInfo: !!
|
|
1296
|
-
showStarButton:
|
|
1295
|
+
onShowInfo: y,
|
|
1296
|
+
canShowInfo: !!I,
|
|
1297
|
+
showStarButton: m
|
|
1297
1298
|
}
|
|
1298
1299
|
) }),
|
|
1300
|
+
x == null ? void 0 : x(),
|
|
1299
1301
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1300
1302
|
Us,
|
|
1301
1303
|
{
|
|
@@ -1307,7 +1309,7 @@ const gt = ({
|
|
|
1307
1309
|
/* @__PURE__ */ e(
|
|
1308
1310
|
ut,
|
|
1309
1311
|
{
|
|
1310
|
-
renderActions: () => n == null ? void 0 : n(
|
|
1312
|
+
renderActions: () => n == null ? void 0 : n(g)
|
|
1311
1313
|
}
|
|
1312
1314
|
)
|
|
1313
1315
|
] })
|
|
@@ -1316,11 +1318,11 @@ const gt = ({
|
|
|
1316
1318
|
/* @__PURE__ */ e(
|
|
1317
1319
|
xt,
|
|
1318
1320
|
{
|
|
1319
|
-
dialogRef:
|
|
1321
|
+
dialogRef: l,
|
|
1320
1322
|
onClose: E,
|
|
1321
|
-
participant:
|
|
1322
|
-
channel:
|
|
1323
|
-
followerStatusLabel:
|
|
1323
|
+
participant: I,
|
|
1324
|
+
channel: g,
|
|
1325
|
+
followerStatusLabel: _,
|
|
1324
1326
|
onLeaveConversation: a,
|
|
1325
1327
|
onBlockParticipant: o,
|
|
1326
1328
|
showDeleteConversation: c,
|
|
@@ -1341,34 +1343,35 @@ const gt = ({
|
|
|
1341
1343
|
className: r,
|
|
1342
1344
|
CustomChannelEmptyState: d = ht,
|
|
1343
1345
|
showDeleteConversation: b = !0,
|
|
1344
|
-
onDeleteConversationClick:
|
|
1345
|
-
onBlockParticipantClick:
|
|
1346
|
-
onReportParticipantClick:
|
|
1347
|
-
dmAgentEnabled:
|
|
1346
|
+
onDeleteConversationClick: m,
|
|
1347
|
+
onBlockParticipantClick: M,
|
|
1348
|
+
onReportParticipantClick: x,
|
|
1349
|
+
dmAgentEnabled: g,
|
|
1348
1350
|
messageMetadata: l,
|
|
1349
|
-
onMessageSent:
|
|
1350
|
-
showStarButton:
|
|
1351
|
-
chatbotVotingEnabled:
|
|
1351
|
+
onMessageSent: I,
|
|
1352
|
+
showStarButton: _ = !1,
|
|
1353
|
+
chatbotVotingEnabled: y = !1,
|
|
1354
|
+
renderChannelBanner: E
|
|
1352
1355
|
}) => {
|
|
1353
|
-
const
|
|
1354
|
-
async (
|
|
1355
|
-
var
|
|
1356
|
-
const
|
|
1357
|
-
...
|
|
1358
|
-
...
|
|
1356
|
+
const h = T(
|
|
1357
|
+
async (p, C, v) => {
|
|
1358
|
+
var F;
|
|
1359
|
+
const f = ((F = t.data) == null ? void 0 : F.chatbot_paused) === !0, u = g && !f, N = {
|
|
1360
|
+
...C,
|
|
1361
|
+
...u && { silent: !0 },
|
|
1359
1362
|
...l && {
|
|
1360
1363
|
metadata: {
|
|
1361
|
-
...
|
|
1364
|
+
...C.metadata ?? {},
|
|
1362
1365
|
...l
|
|
1363
1366
|
}
|
|
1364
1367
|
}
|
|
1365
|
-
},
|
|
1366
|
-
...
|
|
1367
|
-
...
|
|
1368
|
-
},
|
|
1369
|
-
return
|
|
1368
|
+
}, R = {
|
|
1369
|
+
...v,
|
|
1370
|
+
...u && { skip_push: !0 }
|
|
1371
|
+
}, w = await t.sendMessage(N, R);
|
|
1372
|
+
return I == null || I(w), w;
|
|
1370
1373
|
},
|
|
1371
|
-
[t,
|
|
1374
|
+
[t, g, l, I]
|
|
1372
1375
|
);
|
|
1373
1376
|
return /* @__PURE__ */ e(
|
|
1374
1377
|
"div",
|
|
@@ -1385,7 +1388,7 @@ const gt = ({
|
|
|
1385
1388
|
EmptyStateIndicator: d,
|
|
1386
1389
|
LoadingIndicator: he,
|
|
1387
1390
|
DateSeparator: Xs,
|
|
1388
|
-
doSendMessageRequest:
|
|
1391
|
+
doSendMessageRequest: h,
|
|
1389
1392
|
children: /* @__PURE__ */ e(
|
|
1390
1393
|
bt,
|
|
1391
1394
|
{
|
|
@@ -1396,11 +1399,12 @@ const gt = ({
|
|
|
1396
1399
|
onBlockParticipant: c,
|
|
1397
1400
|
CustomChannelEmptyState: d,
|
|
1398
1401
|
showDeleteConversation: b,
|
|
1399
|
-
onDeleteConversationClick:
|
|
1400
|
-
onBlockParticipantClick:
|
|
1401
|
-
onReportParticipantClick:
|
|
1402
|
-
showStarButton:
|
|
1403
|
-
chatbotVotingEnabled:
|
|
1402
|
+
onDeleteConversationClick: m,
|
|
1403
|
+
onBlockParticipantClick: M,
|
|
1404
|
+
onReportParticipantClick: x,
|
|
1405
|
+
showStarButton: _,
|
|
1406
|
+
chatbotVotingEnabled: y,
|
|
1407
|
+
renderChannelBanner: E
|
|
1404
1408
|
}
|
|
1405
1409
|
)
|
|
1406
1410
|
}
|
|
@@ -1458,9 +1462,9 @@ const Nt = ({
|
|
|
1458
1462
|
searchPlaceholder: c = "Search participants...",
|
|
1459
1463
|
className: r
|
|
1460
1464
|
}) => {
|
|
1461
|
-
const { debug: d } = fe(), [b,
|
|
1465
|
+
const { debug: d } = fe(), [b, m] = k(""), [M, x] = k([]), [g, l] = k(!1), [I, _] = k(null), [y, E] = k(
|
|
1462
1466
|
null
|
|
1463
|
-
),
|
|
1467
|
+
), h = V(!1);
|
|
1464
1468
|
W(() => {
|
|
1465
1469
|
if (t.loading) {
|
|
1466
1470
|
d && console.log(
|
|
@@ -1468,46 +1472,46 @@ const Nt = ({
|
|
|
1468
1472
|
);
|
|
1469
1473
|
return;
|
|
1470
1474
|
}
|
|
1471
|
-
if (
|
|
1475
|
+
if (h.current) return;
|
|
1472
1476
|
(async () => {
|
|
1473
|
-
d && console.log("[ParticipantPicker] Loading initial participants..."), l(!0),
|
|
1477
|
+
d && console.log("[ParticipantPicker] Loading initial participants..."), l(!0), _(null);
|
|
1474
1478
|
try {
|
|
1475
|
-
const
|
|
1479
|
+
const u = await t.loadParticipants({
|
|
1476
1480
|
search: "",
|
|
1477
1481
|
// Load all participants initially
|
|
1478
1482
|
limit: 100
|
|
1479
1483
|
});
|
|
1480
|
-
|
|
1484
|
+
x(u.participants), h.current = !0, d && console.log(
|
|
1481
1485
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1482
|
-
|
|
1486
|
+
u.participants.length
|
|
1483
1487
|
);
|
|
1484
|
-
} catch (
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1488
|
+
} catch (u) {
|
|
1489
|
+
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
1490
|
+
_(N), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1487
1491
|
} finally {
|
|
1488
1492
|
l(!1);
|
|
1489
1493
|
}
|
|
1490
1494
|
})();
|
|
1491
1495
|
}, [t.loading, d]);
|
|
1492
|
-
const
|
|
1493
|
-
var
|
|
1496
|
+
const p = M.filter((f) => !a.has(f.id)).filter((f) => {
|
|
1497
|
+
var N;
|
|
1494
1498
|
if (!b) return !0;
|
|
1495
|
-
const
|
|
1496
|
-
return
|
|
1497
|
-
}),
|
|
1498
|
-
async (
|
|
1499
|
-
if (!
|
|
1500
|
-
|
|
1499
|
+
const u = b.toLowerCase();
|
|
1500
|
+
return f.name.toLowerCase().includes(u) || ((N = f.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
|
|
1501
|
+
}), C = T(
|
|
1502
|
+
async (f) => {
|
|
1503
|
+
if (!y) {
|
|
1504
|
+
E(f.id);
|
|
1501
1505
|
try {
|
|
1502
|
-
await s(
|
|
1503
|
-
} catch (
|
|
1504
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1506
|
+
await s(f);
|
|
1507
|
+
} catch (u) {
|
|
1508
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), E(null);
|
|
1505
1509
|
}
|
|
1506
1510
|
}
|
|
1507
1511
|
},
|
|
1508
|
-
[s,
|
|
1509
|
-
),
|
|
1510
|
-
(
|
|
1512
|
+
[s, y]
|
|
1513
|
+
), v = (f, u) => {
|
|
1514
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), C(u));
|
|
1511
1515
|
};
|
|
1512
1516
|
return /* @__PURE__ */ i("div", { className: D("flex flex-col h-full", r), children: [
|
|
1513
1517
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1519,7 +1523,7 @@ const Nt = ({
|
|
|
1519
1523
|
"Select a ",
|
|
1520
1524
|
o.slice(0, -1),
|
|
1521
1525
|
" to start messaging (",
|
|
1522
|
-
|
|
1526
|
+
p.length,
|
|
1523
1527
|
" available)",
|
|
1524
1528
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${o} total`
|
|
1525
1529
|
] }),
|
|
@@ -1527,60 +1531,60 @@ const Nt = ({
|
|
|
1527
1531
|
Ct,
|
|
1528
1532
|
{
|
|
1529
1533
|
searchQuery: b,
|
|
1530
|
-
setSearchQuery:
|
|
1534
|
+
setSearchQuery: m,
|
|
1531
1535
|
placeholder: c
|
|
1532
1536
|
}
|
|
1533
1537
|
)
|
|
1534
1538
|
] }),
|
|
1535
|
-
|
|
1539
|
+
I && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1536
1540
|
"Error loading ",
|
|
1537
1541
|
o,
|
|
1538
1542
|
": ",
|
|
1539
|
-
|
|
1543
|
+
I
|
|
1540
1544
|
] }),
|
|
1541
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1545
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: g && p.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1542
1546
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1543
1547
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1544
1548
|
"Loading ",
|
|
1545
1549
|
o,
|
|
1546
1550
|
"..."
|
|
1547
1551
|
] })
|
|
1548
|
-
] }) }) :
|
|
1552
|
+
] }) }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1549
1553
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ke, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1550
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: b ? `No ${o} found` :
|
|
1551
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: b ? "Try a different search term" :
|
|
1554
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: b ? `No ${o} found` : M.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1555
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: b ? "Try a different search term" : M.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1552
1556
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1553
|
-
|
|
1554
|
-
const
|
|
1557
|
+
p.map((f) => {
|
|
1558
|
+
const u = f.name || f.email || f.id, N = f.email && f.name ? f.email : f.phone;
|
|
1555
1559
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1556
1560
|
"button",
|
|
1557
1561
|
{
|
|
1558
1562
|
type: "button",
|
|
1559
|
-
onClick: () =>
|
|
1560
|
-
onKeyDown: (R) =>
|
|
1563
|
+
onClick: () => C(f),
|
|
1564
|
+
onKeyDown: (R) => v(R, f),
|
|
1561
1565
|
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",
|
|
1562
1566
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1563
1567
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1564
1568
|
/* @__PURE__ */ e(
|
|
1565
1569
|
Q,
|
|
1566
1570
|
{
|
|
1567
|
-
id:
|
|
1568
|
-
name:
|
|
1569
|
-
image:
|
|
1571
|
+
id: f.id,
|
|
1572
|
+
name: u,
|
|
1573
|
+
image: f.image,
|
|
1570
1574
|
size: 40
|
|
1571
1575
|
}
|
|
1572
1576
|
),
|
|
1573
1577
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1574
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1575
|
-
|
|
1578
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1579
|
+
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1576
1580
|
] })
|
|
1577
1581
|
] }),
|
|
1578
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1582
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: y === f.id ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ke, { className: "h-5 w-5 text-stone" }) })
|
|
1579
1583
|
] })
|
|
1580
1584
|
}
|
|
1581
|
-
) },
|
|
1585
|
+
) }, f.id);
|
|
1582
1586
|
}),
|
|
1583
|
-
|
|
1587
|
+
g && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1584
1588
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1585
1589
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1586
1590
|
] }) })
|
|
@@ -1755,87 +1759,87 @@ const Rt = ({
|
|
|
1755
1759
|
initialParticipantData: r,
|
|
1756
1760
|
CustomChannelEmptyState: d,
|
|
1757
1761
|
showChannelList: b = !0,
|
|
1758
|
-
filters:
|
|
1759
|
-
channelListCustomEmptyStateIndicator:
|
|
1760
|
-
onDeleteConversationClick:
|
|
1761
|
-
onBlockParticipantClick:
|
|
1762
|
+
filters: m,
|
|
1763
|
+
channelListCustomEmptyStateIndicator: M,
|
|
1764
|
+
onDeleteConversationClick: x,
|
|
1765
|
+
onBlockParticipantClick: g,
|
|
1762
1766
|
onReportParticipantClick: l,
|
|
1763
|
-
dmAgentEnabled:
|
|
1764
|
-
messageMetadata:
|
|
1765
|
-
onMessageSent:
|
|
1766
|
-
showStarButton:
|
|
1767
|
-
chatbotVotingEnabled:
|
|
1768
|
-
renderMessagePreview:
|
|
1767
|
+
dmAgentEnabled: I,
|
|
1768
|
+
messageMetadata: _,
|
|
1769
|
+
onMessageSent: y,
|
|
1770
|
+
showStarButton: E = !1,
|
|
1771
|
+
chatbotVotingEnabled: h = !1,
|
|
1772
|
+
renderMessagePreview: p
|
|
1769
1773
|
}) => {
|
|
1770
1774
|
const {
|
|
1771
|
-
service:
|
|
1772
|
-
client:
|
|
1773
|
-
isConnected:
|
|
1774
|
-
isLoading:
|
|
1775
|
-
error:
|
|
1775
|
+
service: C,
|
|
1776
|
+
client: v,
|
|
1777
|
+
isConnected: f,
|
|
1778
|
+
isLoading: u,
|
|
1779
|
+
error: N,
|
|
1776
1780
|
refreshConnection: R,
|
|
1777
|
-
debug:
|
|
1778
|
-
} = Hs(), [
|
|
1781
|
+
debug: w
|
|
1782
|
+
} = Hs(), [F, $] = k(null), [te, X] = k(!1), [K, q] = k(!1), [ne, Z] = k(!1), [ee, G] = k(/* @__PURE__ */ new Set()), [P, U] = k(0), [L, j] = k(!1), [z, Y] = k(null), J = V(null), {
|
|
1779
1783
|
participantSource: ae,
|
|
1780
1784
|
participantLabel: re = "participants",
|
|
1781
1785
|
showDeleteConversation: le = !0
|
|
1782
1786
|
} = t, ze = B.useMemo(() => {
|
|
1783
|
-
const
|
|
1787
|
+
const S = v == null ? void 0 : v.userID;
|
|
1784
1788
|
return {
|
|
1785
1789
|
...{
|
|
1786
1790
|
type: "messaging",
|
|
1787
1791
|
last_message_at: { $exists: !0 },
|
|
1788
|
-
...
|
|
1789
|
-
members: { $in: [
|
|
1792
|
+
...S && {
|
|
1793
|
+
members: { $in: [S] },
|
|
1790
1794
|
hidden: !1
|
|
1791
1795
|
}
|
|
1792
1796
|
},
|
|
1793
|
-
...
|
|
1797
|
+
...m
|
|
1794
1798
|
};
|
|
1795
|
-
}, [
|
|
1796
|
-
if (!
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
1799
|
+
}, [m, v == null ? void 0 : v.userID]), oe = V(null), se = T(async () => {
|
|
1800
|
+
if (!v || !f) return;
|
|
1801
|
+
const S = v.userID;
|
|
1802
|
+
if (S)
|
|
1799
1803
|
try {
|
|
1800
|
-
|
|
1801
|
-
const H = await
|
|
1804
|
+
w && console.log("[MessagingShell] Syncing channels for user:", S);
|
|
1805
|
+
const H = await v.queryChannels(
|
|
1802
1806
|
{
|
|
1803
1807
|
type: "messaging",
|
|
1804
|
-
members: { $in: [
|
|
1808
|
+
members: { $in: [S] }
|
|
1805
1809
|
},
|
|
1806
1810
|
{},
|
|
1807
1811
|
{ limit: 100 }
|
|
1808
|
-
),
|
|
1812
|
+
), O = /* @__PURE__ */ new Set();
|
|
1809
1813
|
H.forEach((A) => {
|
|
1810
1814
|
const ge = A.state.members;
|
|
1811
1815
|
Object.values(ge).forEach((Ye) => {
|
|
1812
1816
|
var Ee;
|
|
1813
1817
|
const xe = (Ee = Ye.user) == null ? void 0 : Ee.id;
|
|
1814
|
-
xe && xe !==
|
|
1818
|
+
xe && xe !== S && O.add(xe);
|
|
1815
1819
|
});
|
|
1816
|
-
}), G((A) => A.size ===
|
|
1820
|
+
}), G((A) => A.size === O.size && [...A].every((ge) => O.has(ge)) ? A : O), X(H.length > 0), q(!0), oe.current = S, w && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1817
1821
|
channelCount: H.length,
|
|
1818
|
-
memberCount:
|
|
1822
|
+
memberCount: O.size
|
|
1819
1823
|
});
|
|
1820
1824
|
} catch (H) {
|
|
1821
1825
|
console.error("[MessagingShell] Failed to sync channels:", H);
|
|
1822
1826
|
}
|
|
1823
|
-
}, [
|
|
1827
|
+
}, [v, f, w]);
|
|
1824
1828
|
W(() => {
|
|
1825
|
-
if (!
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
}, [
|
|
1829
|
-
if (!c || !
|
|
1829
|
+
if (!v || !f) return;
|
|
1830
|
+
const S = v.userID;
|
|
1831
|
+
S && oe.current !== S && se();
|
|
1832
|
+
}, [v, f, se]), W(() => {
|
|
1833
|
+
if (!c || !v || !f) return;
|
|
1830
1834
|
(async () => {
|
|
1831
|
-
const H =
|
|
1835
|
+
const H = v.userID;
|
|
1832
1836
|
if (H)
|
|
1833
1837
|
try {
|
|
1834
|
-
|
|
1838
|
+
w && console.log(
|
|
1835
1839
|
"[MessagingShell] Loading initial conversation with:",
|
|
1836
1840
|
c
|
|
1837
1841
|
);
|
|
1838
|
-
const
|
|
1842
|
+
const O = await v.queryChannels(
|
|
1839
1843
|
{
|
|
1840
1844
|
type: "messaging",
|
|
1841
1845
|
members: { $eq: [H, c] }
|
|
@@ -1843,24 +1847,24 @@ const Rt = ({
|
|
|
1843
1847
|
{},
|
|
1844
1848
|
{ limit: 1 }
|
|
1845
1849
|
);
|
|
1846
|
-
if (
|
|
1847
|
-
$(
|
|
1850
|
+
if (O.length > 0)
|
|
1851
|
+
$(O[0]), j(!0), Y(null), a && a(O[0]), w && console.log(
|
|
1848
1852
|
"[MessagingShell] Initial conversation loaded:",
|
|
1849
|
-
|
|
1853
|
+
O[0].id
|
|
1850
1854
|
);
|
|
1851
|
-
else if (r &&
|
|
1852
|
-
|
|
1855
|
+
else if (r && C) {
|
|
1856
|
+
w && console.log(
|
|
1853
1857
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1854
1858
|
r
|
|
1855
1859
|
);
|
|
1856
1860
|
try {
|
|
1857
|
-
const A = await
|
|
1861
|
+
const A = await C.startChannelWithParticipant({
|
|
1858
1862
|
id: r.id,
|
|
1859
1863
|
name: r.name,
|
|
1860
1864
|
email: r.email,
|
|
1861
1865
|
phone: r.phone
|
|
1862
1866
|
});
|
|
1863
|
-
$(A), j(!0), Y(null), a && a(A),
|
|
1867
|
+
$(A), j(!0), Y(null), a && a(A), w && console.log(
|
|
1864
1868
|
"[MessagingShell] Channel created and loaded:",
|
|
1865
1869
|
A.id
|
|
1866
1870
|
);
|
|
@@ -1873,79 +1877,79 @@ const Rt = ({
|
|
|
1873
1877
|
} else
|
|
1874
1878
|
Y(
|
|
1875
1879
|
"No conversation found with this account"
|
|
1876
|
-
),
|
|
1880
|
+
), w && console.log(
|
|
1877
1881
|
"[MessagingShell] No conversation found for:",
|
|
1878
1882
|
c
|
|
1879
1883
|
);
|
|
1880
|
-
} catch (
|
|
1884
|
+
} catch (O) {
|
|
1881
1885
|
console.error(
|
|
1882
1886
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1883
|
-
|
|
1887
|
+
O
|
|
1884
1888
|
), Y("Failed to load conversation");
|
|
1885
1889
|
}
|
|
1886
1890
|
})();
|
|
1887
1891
|
}, [
|
|
1888
1892
|
c,
|
|
1889
1893
|
r,
|
|
1890
|
-
|
|
1891
|
-
|
|
1894
|
+
v,
|
|
1895
|
+
f,
|
|
1896
|
+
C,
|
|
1892
1897
|
w,
|
|
1893
|
-
y,
|
|
1894
1898
|
a
|
|
1895
1899
|
]);
|
|
1896
1900
|
const He = T(
|
|
1897
|
-
(
|
|
1898
|
-
$(
|
|
1901
|
+
(S) => {
|
|
1902
|
+
$(S), a == null || a(S);
|
|
1899
1903
|
},
|
|
1900
1904
|
[a]
|
|
1901
1905
|
), Ge = T(() => {
|
|
1902
|
-
|
|
1903
|
-
}, [
|
|
1904
|
-
async (
|
|
1906
|
+
L || $(null);
|
|
1907
|
+
}, [L]), Ve = T(
|
|
1908
|
+
async (S) => {
|
|
1905
1909
|
var H;
|
|
1906
|
-
if (
|
|
1910
|
+
if (C)
|
|
1907
1911
|
try {
|
|
1908
|
-
|
|
1912
|
+
w && console.log(
|
|
1909
1913
|
"[MessagingShell] Starting conversation with:",
|
|
1910
|
-
|
|
1914
|
+
S.id
|
|
1911
1915
|
);
|
|
1912
|
-
const
|
|
1913
|
-
id:
|
|
1914
|
-
name:
|
|
1915
|
-
email:
|
|
1916
|
-
phone:
|
|
1916
|
+
const O = await C.startChannelWithParticipant({
|
|
1917
|
+
id: S.id,
|
|
1918
|
+
name: S.name,
|
|
1919
|
+
email: S.email,
|
|
1920
|
+
phone: S.phone
|
|
1917
1921
|
});
|
|
1918
1922
|
try {
|
|
1919
|
-
await
|
|
1923
|
+
await O.show();
|
|
1920
1924
|
} catch (A) {
|
|
1921
1925
|
console.warn("[MessagingShell] Failed to unhide channel:", A);
|
|
1922
1926
|
}
|
|
1923
|
-
$(
|
|
1924
|
-
} catch (
|
|
1925
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1927
|
+
$(O), Z(!1), (H = J.current) == null || H.close(), o == null || o(S);
|
|
1928
|
+
} catch (O) {
|
|
1929
|
+
console.error("[MessagingShell] Failed to start conversation:", O);
|
|
1926
1930
|
}
|
|
1927
1931
|
},
|
|
1928
|
-
[
|
|
1932
|
+
[C, o, w]
|
|
1929
1933
|
), ie = T(() => {
|
|
1930
|
-
var
|
|
1931
|
-
Z(!1), (
|
|
1934
|
+
var S;
|
|
1935
|
+
Z(!1), (S = J.current) == null || S.close();
|
|
1932
1936
|
}, []), We = T(
|
|
1933
|
-
(
|
|
1934
|
-
|
|
1937
|
+
(S) => {
|
|
1938
|
+
S.target === J.current && ie();
|
|
1935
1939
|
},
|
|
1936
1940
|
[ie]
|
|
1937
1941
|
), qe = T(
|
|
1938
|
-
async (
|
|
1939
|
-
|
|
1942
|
+
async (S) => {
|
|
1943
|
+
w && console.log("[MessagingShell] Leaving conversation:", S.id), $(null), j(!1), oe.current = null, await se();
|
|
1940
1944
|
},
|
|
1941
|
-
[se,
|
|
1945
|
+
[se, w]
|
|
1942
1946
|
), Ze = T(
|
|
1943
|
-
async (
|
|
1944
|
-
|
|
1947
|
+
async (S) => {
|
|
1948
|
+
w && console.log("[MessagingShell] Blocking participant:", S), $(null), j(!1), oe.current = null, await se();
|
|
1945
1949
|
},
|
|
1946
|
-
[se,
|
|
1947
|
-
), ce = !!
|
|
1948
|
-
return
|
|
1950
|
+
[se, w]
|
|
1951
|
+
), ce = !!F;
|
|
1952
|
+
return u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(he, {}) }) : N ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(me, { message: N, onBack: R }) }) : !f || !v ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1949
1953
|
me,
|
|
1950
1954
|
{
|
|
1951
1955
|
message: "Not connected to messaging service",
|
|
@@ -1966,21 +1970,21 @@ const Rt = ({
|
|
|
1966
1970
|
className: D(
|
|
1967
1971
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1968
1972
|
{
|
|
1969
|
-
"!hidden": b === !1 ||
|
|
1973
|
+
"!hidden": b === !1 || L,
|
|
1970
1974
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1971
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl": b !== !1 && !
|
|
1975
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": b !== !1 && !L && ce,
|
|
1972
1976
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1973
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": b !== !1 && !
|
|
1977
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": b !== !1 && !L && !ce
|
|
1974
1978
|
}
|
|
1975
1979
|
),
|
|
1976
1980
|
children: /* @__PURE__ */ e(
|
|
1977
1981
|
Ue,
|
|
1978
1982
|
{
|
|
1979
1983
|
onChannelSelect: He,
|
|
1980
|
-
selectedChannel:
|
|
1984
|
+
selectedChannel: F || void 0,
|
|
1981
1985
|
filters: ze,
|
|
1982
|
-
customEmptyStateIndicator:
|
|
1983
|
-
renderMessagePreview:
|
|
1986
|
+
customEmptyStateIndicator: M,
|
|
1987
|
+
renderMessagePreview: p
|
|
1984
1988
|
}
|
|
1985
1989
|
)
|
|
1986
1990
|
}
|
|
@@ -1992,32 +1996,32 @@ const Rt = ({
|
|
|
1992
1996
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1993
1997
|
{
|
|
1994
1998
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1995
|
-
flex:
|
|
1999
|
+
flex: L || ce || c,
|
|
1996
2000
|
// Normal mode: hide on mobile when no channel selected
|
|
1997
|
-
"hidden lg:flex": !
|
|
2001
|
+
"hidden lg:flex": !L && !ce && !c
|
|
1998
2002
|
}
|
|
1999
2003
|
),
|
|
2000
|
-
children:
|
|
2004
|
+
children: F ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
2001
2005
|
Ae,
|
|
2002
2006
|
{
|
|
2003
|
-
channel:
|
|
2007
|
+
channel: F,
|
|
2004
2008
|
onBack: Ge,
|
|
2005
|
-
showBackButton: !
|
|
2009
|
+
showBackButton: !L,
|
|
2006
2010
|
renderMessageInputActions: n,
|
|
2007
2011
|
onLeaveConversation: qe,
|
|
2008
2012
|
onBlockParticipant: Ze,
|
|
2009
2013
|
CustomChannelEmptyState: d,
|
|
2010
2014
|
showDeleteConversation: le,
|
|
2011
|
-
onDeleteConversationClick:
|
|
2012
|
-
onBlockParticipantClick:
|
|
2015
|
+
onDeleteConversationClick: x,
|
|
2016
|
+
onBlockParticipantClick: g,
|
|
2013
2017
|
onReportParticipantClick: l,
|
|
2014
|
-
dmAgentEnabled:
|
|
2015
|
-
messageMetadata:
|
|
2016
|
-
onMessageSent:
|
|
2017
|
-
showStarButton:
|
|
2018
|
-
chatbotVotingEnabled:
|
|
2018
|
+
dmAgentEnabled: I,
|
|
2019
|
+
messageMetadata: _,
|
|
2020
|
+
onMessageSent: y,
|
|
2021
|
+
showStarButton: E,
|
|
2022
|
+
chatbotVotingEnabled: h
|
|
2019
2023
|
},
|
|
2020
|
-
|
|
2024
|
+
F.id
|
|
2021
2025
|
) }) : c ? (
|
|
2022
2026
|
// Show loading while creating/loading direct conversation channel
|
|
2023
2027
|
/* @__PURE__ */ e(he, {})
|
|
@@ -2049,7 +2053,7 @@ const Rt = ({
|
|
|
2049
2053
|
participantLabel: re,
|
|
2050
2054
|
searchPlaceholder: `Search ${re}...`
|
|
2051
2055
|
},
|
|
2052
|
-
|
|
2056
|
+
P
|
|
2053
2057
|
) })
|
|
2054
2058
|
}
|
|
2055
2059
|
)
|
|
@@ -2087,7 +2091,7 @@ const Rt = ({
|
|
|
2087
2091
|
avatarImage: c,
|
|
2088
2092
|
avatarName: r
|
|
2089
2093
|
}) => {
|
|
2090
|
-
const d = t.filter((b) => b.enabled).sort((b,
|
|
2094
|
+
const d = t.filter((b) => b.enabled).sort((b, m) => (b.order ?? 0) - (m.order ?? 0));
|
|
2091
2095
|
return d.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
2092
2096
|
(c || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2093
2097
|
Q,
|
|
@@ -2120,44 +2124,44 @@ const Rt = ({
|
|
|
2120
2124
|
)
|
|
2121
2125
|
] }) });
|
|
2122
2126
|
}, Tt = (t, s = {}) => {
|
|
2123
|
-
const { initialSearch: n = "", pageSize: a = 20 } = s, [o, c] = k([]), [r, d] = k(!1), [b,
|
|
2127
|
+
const { initialSearch: n = "", pageSize: a = 20 } = s, [o, c] = k([]), [r, d] = k(!1), [b, m] = k(null), [M, x] = k(n), [g, l] = k(!0), [I, _] = k(), y = T(async (C = !1, v) => {
|
|
2124
2128
|
if (r) return;
|
|
2125
|
-
const
|
|
2126
|
-
d(!0),
|
|
2129
|
+
const f = v !== void 0 ? v : M;
|
|
2130
|
+
d(!0), m(null);
|
|
2127
2131
|
try {
|
|
2128
|
-
const
|
|
2129
|
-
search:
|
|
2132
|
+
const u = await t.loadParticipants({
|
|
2133
|
+
search: f || void 0,
|
|
2130
2134
|
limit: a,
|
|
2131
|
-
cursor:
|
|
2135
|
+
cursor: C ? void 0 : I
|
|
2132
2136
|
});
|
|
2133
2137
|
c(
|
|
2134
|
-
(
|
|
2135
|
-
), l(
|
|
2136
|
-
} catch (
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2138
|
+
(N) => C ? u.participants : [...N, ...u.participants]
|
|
2139
|
+
), l(u.hasMore), _(u.nextCursor);
|
|
2140
|
+
} catch (u) {
|
|
2141
|
+
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
2142
|
+
m(N), console.error("[useParticipants] Load error:", u);
|
|
2139
2143
|
} finally {
|
|
2140
2144
|
d(!1);
|
|
2141
2145
|
}
|
|
2142
|
-
}, [t,
|
|
2143
|
-
|
|
2144
|
-
}, [
|
|
2145
|
-
|
|
2146
|
-
}, [
|
|
2147
|
-
|
|
2148
|
-
}, [
|
|
2146
|
+
}, [t, M, I, a, r]), E = T(() => {
|
|
2147
|
+
g && !r && y(!1);
|
|
2148
|
+
}, [g, r, y]), h = T((C) => {
|
|
2149
|
+
x(C), _(void 0), y(!0, C);
|
|
2150
|
+
}, [y]), p = T(() => {
|
|
2151
|
+
_(void 0), y(!0);
|
|
2152
|
+
}, [y]);
|
|
2149
2153
|
return W(() => {
|
|
2150
|
-
|
|
2154
|
+
y(!0);
|
|
2151
2155
|
}, [t.loadParticipants]), {
|
|
2152
2156
|
participants: o,
|
|
2153
2157
|
loading: r,
|
|
2154
2158
|
error: b,
|
|
2155
|
-
searchQuery:
|
|
2156
|
-
hasMore:
|
|
2159
|
+
searchQuery: M,
|
|
2160
|
+
hasMore: g,
|
|
2157
2161
|
totalCount: t.totalCount,
|
|
2158
|
-
loadMore:
|
|
2159
|
-
search:
|
|
2160
|
-
refresh:
|
|
2162
|
+
loadMore: E,
|
|
2163
|
+
search: h,
|
|
2164
|
+
refresh: p
|
|
2161
2165
|
};
|
|
2162
2166
|
};
|
|
2163
2167
|
export {
|