@linktr.ee/messaging-react 1.8.5 โ†’ 1.8.6

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