@linktr.ee/messaging-react 1.6.5 โ†’ 1.6.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
1
  import { jsx as e, jsxs as d, Fragment as oe } from "react/jsx-runtime";
2
2
  import D from "classnames";
3
- import X, { createContext as we, useContext as Ee, useCallback as F, useState as E, useRef as _, useEffect as $ } from "react";
3
+ import X, { createContext as Ee, useContext as ye, useCallback as M, useState as E, useRef as H, useEffect as _ } from "react";
4
4
  import { StreamChatService as Ie } from "@linktr.ee/messaging-core";
5
- import { Chat as ye, useChatContext as Se, ChannelList as Re, Channel as ke, useChannelStateContext as me, Window as Te, MessageList as Pe, MessageInput as De } from "stream-chat-react";
6
- import { NotePencilIcon as Oe, XIcon as he, ArrowLeftIcon as Me, DotsThreeIcon as Fe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
- const fe = we({
5
+ import { Chat as Se, useChatContext as Re, ChannelList as ke, Channel as Fe, useChannelStateContext as me, Window as Te, MessageList as De, MessageInput as Pe } from "stream-chat-react";
6
+ import { NotePencilIcon as Oe, XIcon as he, ArrowLeftIcon as Me, DotsThreeIcon as pe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as je, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
+ const fe = Ee({
8
8
  service: null,
9
9
  client: null,
10
10
  isConnected: !1,
@@ -15,7 +15,7 @@ const fe = we({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), se = () => Ee(fe), ls = ({
18
+ }), se = () => ye(fe), os = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
@@ -24,9 +24,9 @@ const fe = we({
24
24
  customization: c = {},
25
25
  debug: a = !1
26
26
  }) => {
27
- const l = F(
28
- (w, ...O) => {
29
- a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${w}`, ...O);
27
+ const l = M(
28
+ (w, ...P) => {
29
+ a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${w}`, ...P);
30
30
  },
31
31
  [a]
32
32
  );
@@ -37,30 +37,30 @@ const fe = we({
37
37
  capabilities: Object.keys(i),
38
38
  customization: Object.keys(c)
39
39
  });
40
- const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null), M = _(!1), y = _({
40
+ const [r, b] = E(null), [u, g] = E(null), [m, y] = E(!1), [N, h] = E(!1), [v, S] = E(null), O = H(!1), I = H({
41
41
  userId: s == null ? void 0 : s.id,
42
42
  apiKey: o,
43
43
  serviceConfig: n,
44
44
  capabilities: i,
45
45
  customization: c
46
- }), k = _(0);
46
+ }), k = H(0);
47
47
  k.current++, l("๐Ÿ“Š RENDER INFO", {
48
48
  renderCount: k.current,
49
49
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
50
50
  propChanges: {
51
- userChanged: y.current.userId !== (s == null ? void 0 : s.id),
52
- apiKeyChanged: y.current.apiKey !== o,
53
- serviceConfigChanged: y.current.serviceConfig !== n,
54
- capabilitiesChanged: y.current.capabilities !== i,
55
- customizationChanged: y.current.customization !== c
51
+ userChanged: I.current.userId !== (s == null ? void 0 : s.id),
52
+ apiKeyChanged: I.current.apiKey !== o,
53
+ serviceConfigChanged: I.current.serviceConfig !== n,
54
+ capabilitiesChanged: I.current.capabilities !== i,
55
+ customizationChanged: I.current.customization !== c
56
56
  }
57
- }), y.current = {
57
+ }), I.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
59
  apiKey: o,
60
60
  serviceConfig: n,
61
61
  capabilities: i,
62
62
  customization: c
63
- }, $(() => {
63
+ }, _(() => {
64
64
  const w = k.current;
65
65
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
66
  renderCount: w,
@@ -69,8 +69,8 @@ const fe = we({
69
69
  dependencies: {
70
70
  apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
71
71
  serviceConfigRef: n,
72
- serviceConfigStable: y.current.serviceConfig === n,
73
- apiKeyStable: y.current.apiKey === o
72
+ serviceConfigStable: I.current.serviceConfig === n,
73
+ apiKeyStable: I.current.apiKey === o
74
74
  }
75
75
  }), !o || !n) {
76
76
  l("โš ๏ธ SERVICE INIT SKIPPED", {
@@ -82,42 +82,42 @@ const fe = we({
82
82
  l("๐Ÿš€ CREATING NEW SERVICE", {
83
83
  renderCount: w,
84
84
  apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
85
- serviceConfigChanged: y.current.serviceConfig !== n
85
+ serviceConfigChanged: I.current.serviceConfig !== n
86
86
  });
87
- const O = new Ie({
87
+ const P = new Ie({
88
88
  ...n,
89
89
  apiKey: o,
90
90
  debug: a
91
91
  });
92
- return b(O), l("โœ… SERVICE SET", {
92
+ return b(P), l("โœ… SERVICE SET", {
93
93
  renderCount: w,
94
- serviceInstance: !!O
94
+ serviceInstance: !!P
95
95
  }), () => {
96
96
  l("๐Ÿงน SERVICE CLEANUP", {
97
97
  renderCount: w,
98
98
  reason: "Effect cleanup"
99
- }), O.disconnectUser().catch(console.error);
99
+ }), P.disconnectUser().catch(console.error);
100
100
  };
101
101
  }, [o, n, a, l]);
102
- const T = _(null);
103
- $(() => {
104
- var O, L;
102
+ const F = H(null);
103
+ _(() => {
104
+ var P, U;
105
105
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
106
106
  hasService: !!r,
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
- isConnecting: M.current,
109
+ isConnecting: O.current,
110
110
  isConnected: m,
111
111
  dependencies: { service: !!r, userId: s == null ? void 0 : s.id }
112
112
  }), !r || !s) {
113
113
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
114
114
  return;
115
115
  }
116
- if (M.current) {
116
+ if (O.current) {
117
117
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
118
118
  return;
119
119
  }
120
- if (((O = T.current) == null ? void 0 : O.serviceId) === r && ((L = T.current) == null ? void 0 : L.userId) === s.id) {
120
+ if (((P = F.current) == null ? void 0 : P.serviceId) === r && ((U = F.current) == null ? void 0 : U.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 = we({
125
125
  return;
126
126
  }
127
127
  (async () => {
128
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), M.current = !0, h(!0), S(null);
128
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), O.current = !0, h(!0), S(null);
129
129
  try {
130
130
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
- const p = await r.connectUser(s);
132
- g(p), I(!0), T.current = { serviceId: r, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
131
+ const L = await r.connectUser(s);
132
+ g(L), y(!0), F.current = { serviceId: r, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
- clientId: p.userID
134
+ clientId: L.userID
135
135
  });
136
- } catch (p) {
137
- const H = p instanceof Error ? p.message : "Connection failed";
138
- S(H), l("โŒ USER CONNECTION ERROR", {
136
+ } catch (L) {
137
+ const $ = L instanceof Error ? L.message : "Connection failed";
138
+ S($), l("โŒ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
- error: H
140
+ error: $
141
141
  });
142
142
  } finally {
143
- h(!1), M.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
143
+ h(!1), O.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
144
144
  userId: s.id,
145
145
  isConnected: m
146
146
  });
147
147
  }
148
148
  })();
149
- }, [r, s, l, m]), $(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
149
+ }, [r, s, l, m]), _(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
150
150
  hasService: !!r,
151
151
  isConnected: m
152
152
  }), () => {
153
153
  r && m ? (l(
154
154
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
155
155
  "Cleaning up connection on unmount"
156
- ), T.current = null, r.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
156
+ ), F.current = null, r.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
157
157
  hasService: !!r,
158
158
  isConnected: m
159
159
  });
160
160
  }), [r, m, l]);
161
- const f = F(async () => {
161
+ const f = M(async () => {
162
162
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
163
  hasService: !!r,
164
164
  hasUser: !!s
@@ -170,12 +170,12 @@ const fe = we({
170
170
  try {
171
171
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await r.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
172
172
  const w = await r.connectUser(s);
173
- g(w), I(!0), S(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
173
+ g(w), y(!0), S(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
174
  } catch (w) {
175
- const O = w instanceof Error ? w.message : "Refresh failed";
176
- S(O), l("โŒ CONNECTION REFRESH ERROR", {
175
+ const P = w instanceof Error ? w.message : "Refresh failed";
176
+ S(P), l("โŒ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
- error: O
178
+ error: P
179
179
  });
180
180
  } finally {
181
181
  h(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
@@ -214,8 +214,8 @@ const fe = we({
214
214
  renderCount: k.current,
215
215
  willRenderChat: !!(u && m),
216
216
  contextValueReady: !!x
217
- }), /* @__PURE__ */ e(fe.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(ye, { client: u, children: t }) : t });
218
- }, je = () => se();
217
+ }), /* @__PURE__ */ e(fe.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(Se, { client: u, children: t }) : t });
218
+ }, Ae = () => se();
219
219
  function ne({ label: t, className: s, children: n, ...o }) {
220
220
  return /* @__PURE__ */ d(
221
221
  "button",
@@ -265,7 +265,7 @@ const de = [
265
265
  "๐Ÿˆ"
266
266
  // Melon
267
267
  ];
268
- function Ae(t) {
268
+ function Be(t) {
269
269
  let s = 0;
270
270
  for (let n = 0; n < t.length; n++) {
271
271
  const o = t.charCodeAt(n);
@@ -273,8 +273,8 @@ function Ae(t) {
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function Be(t) {
277
- const n = Ae(t) % de.length;
276
+ function He(t) {
277
+ const n = Be(t) % de.length;
278
278
  return de[n];
279
279
  }
280
280
  const J = ({
@@ -283,7 +283,7 @@ const J = ({
283
283
  size: n = 40,
284
284
  className: o
285
285
  }) => {
286
- const i = Be(t), c = "#FBFAF9", l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
286
+ const i = He(t), c = "#FBFAF9", l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
287
287
  return /* @__PURE__ */ e(
288
288
  "div",
289
289
  {
@@ -317,15 +317,15 @@ const J = ({
317
317
  }
318
318
  );
319
319
  }, _e = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: o = !1, unread: i }) => {
320
- var h, v, S, M, y, k;
320
+ var h, v, S, O, I, k;
321
321
  const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
322
322
  t && n(t);
323
323
  }, r = Object.values(((h = t == null ? void 0 : t.state) == null ? void 0 : h.members) || {}).find(
324
- (T) => {
324
+ (F) => {
325
325
  var f, x;
326
- return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
326
+ return ((f = F.user) == null ? void 0 : f.id) && F.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
327
327
  }
328
- ), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : y[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", I = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
328
+ ), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (I = (O = t == null ? void 0 : t.state) == null ? void 0 : O.messages) == null ? void 0 : I[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", y = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
329
329
  hour: "2-digit",
330
330
  minute: "2-digit"
331
331
  }) : "", N = i ?? 0;
@@ -334,7 +334,7 @@ const J = ({
334
334
  isSelected: c,
335
335
  participantName: b,
336
336
  unreadCount: N,
337
- hasTimestamp: !!I
337
+ hasTimestamp: !!y
338
338
  }), /* @__PURE__ */ e(
339
339
  "button",
340
340
  {
@@ -369,7 +369,7 @@ const J = ({
369
369
  children: b
370
370
  }
371
371
  ),
372
- I && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: I })
372
+ y && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: y })
373
373
  ] }),
374
374
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
375
375
  /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: m }),
@@ -397,7 +397,7 @@ const J = ({
397
397
  showStartConversation: n,
398
398
  participantLabel: i
399
399
  });
400
- const { client: r } = Se();
400
+ const { client: r } = Re();
401
401
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“ก CHAT CONTEXT", {
402
402
  renderCount: a.current,
403
403
  hasClient: !!r,
@@ -443,17 +443,17 @@ const J = ({
443
443
  hasClient: !!r,
444
444
  clientUserId: r == null ? void 0 : r.userID
445
445
  }), /* @__PURE__ */ e(
446
- Re,
446
+ ke,
447
447
  {
448
448
  filters: b,
449
449
  sort: { last_message_at: -1 },
450
450
  options: { limit: 30 },
451
451
  Preview: (g) => {
452
- var m, I;
452
+ var m, y;
453
453
  return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
454
454
  channelId: (m = g.channel) == null ? void 0 : m.id,
455
455
  selectedChannelId: s == null ? void 0 : s.id,
456
- isSelected: (s == null ? void 0 : s.id) === ((I = g.channel) == null ? void 0 : I.id)
456
+ isSelected: (s == null ? void 0 : s.id) === ((y = g.channel) == null ? void 0 : y.id)
457
457
  }), /* @__PURE__ */ e(
458
458
  _e,
459
459
  {
@@ -490,15 +490,18 @@ const J = ({
490
490
  function ge({ onClick: t }) {
491
491
  return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
492
492
  }
493
- const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
493
+ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
494
+ /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐Ÿ‘€" }),
495
+ /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
496
+ ] }) }), Ge = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
494
497
  t && t(),
495
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(De, { focus: !0, maxRows: 4 }) })
496
- ] }), Ge = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: o }) => {
498
+ /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Pe, { focus: !0, maxRows: 4 }) })
499
+ ] }), Ve = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: o }) => {
497
500
  var r, b, u, g;
498
501
  const { channel: i } = me(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
499
- (I) => {
502
+ (y) => {
500
503
  var N;
501
- return ((N = I.user) == null ? void 0 : N.id) && I.user.id !== i._client.userID;
504
+ return ((N = y.user) == null ? void 0 : N.id) && y.user.id !== i._client.userID;
502
505
  }
503
506
  ), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member", l = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
504
507
  return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
@@ -524,9 +527,9 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
524
527
  ),
525
528
  /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: a }) })
526
529
  ] }),
527
- o && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Fe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
530
+ o && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(pe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
528
531
  ] });
529
- }, Ve = ({
532
+ }, We = ({
530
533
  isOpen: t,
531
534
  onClose: s,
532
535
  participant: n,
@@ -535,13 +538,13 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
535
538
  onLeaveConversation: c,
536
539
  onBlockParticipant: a
537
540
  }) => {
538
- var p, H, G, V, Q, W, z;
539
- const { service: l, debug: r } = se(), b = _(null), [u, g] = E(!1), [m, I] = E(!1), [N, h] = E(!1);
540
- $(() => {
541
+ var L, $, G, V, Q, W, z;
542
+ const { service: l, debug: r } = se(), b = H(null), [u, g] = E(!1), [m, y] = E(!1), [N, h] = E(!1);
543
+ _(() => {
541
544
  const R = b.current;
542
545
  R && (t ? R.showModal() : R.close());
543
546
  }, [t]);
544
- const v = F(async () => {
547
+ const v = M(async () => {
545
548
  var R;
546
549
  if (!(!l || !((R = n == null ? void 0 : n.user) != null && R.id)))
547
550
  try {
@@ -552,47 +555,47 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
552
555
  }
553
556
  );
554
557
  g(A);
555
- } catch (P) {
558
+ } catch (T) {
556
559
  console.error(
557
560
  "[ChannelInfoDialog] Failed to check blocked status:",
558
- P
561
+ T
559
562
  );
560
563
  }
561
- }, [l, (p = n == null ? void 0 : n.user) == null ? void 0 : p.id]);
562
- $(() => {
564
+ }, [l, (L = n == null ? void 0 : n.user) == null ? void 0 : L.id]);
565
+ _(() => {
563
566
  t && v();
564
567
  }, [t, v]);
565
568
  const S = async () => {
566
569
  var R;
567
570
  if (!m) {
568
- r && console.log("[ChannelInfoDialog] Leave conversation", o.cid), I(!0);
571
+ r && console.log("[ChannelInfoDialog] Leave conversation", o.cid), y(!0);
569
572
  try {
570
- const P = ((R = o._client) == null ? void 0 : R.userID) ?? null;
571
- await o.hide(P, !1), c && await c(o), s();
572
- } catch (P) {
573
- console.error("[ChannelInfoDialog] Failed to leave conversation", P);
573
+ const T = ((R = o._client) == null ? void 0 : R.userID) ?? null;
574
+ await o.hide(T, !1), c && await c(o), s();
575
+ } catch (T) {
576
+ console.error("[ChannelInfoDialog] Failed to leave conversation", T);
574
577
  } finally {
575
- I(!1);
578
+ y(!1);
576
579
  }
577
580
  }
578
- }, M = async () => {
579
- var R, P, A;
581
+ }, O = async () => {
582
+ var R, T, A;
580
583
  if (!(N || !l)) {
581
584
  r && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
582
585
  try {
583
- await l.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
586
+ await l.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
584
587
  } catch (q) {
585
588
  console.error("[ChannelInfoDialog] Failed to block member", q);
586
589
  } finally {
587
590
  h(!1);
588
591
  }
589
592
  }
590
- }, y = async () => {
591
- var R, P, A;
593
+ }, I = async () => {
594
+ var R, T, A;
592
595
  if (!(N || !l)) {
593
596
  r && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
594
597
  try {
595
- await l.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
598
+ await l.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
596
599
  } catch (q) {
597
600
  console.error("[ChannelInfoDialog] Failed to unblock member", q);
598
601
  } finally {
@@ -607,7 +610,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
607
610
  );
608
611
  };
609
612
  if (!n) return null;
610
- const T = ((H = n.user) == null ? void 0 : H.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, O = x || (w ? `linktr.ee/${w}` : void 0), L = ((z = n.user) == null ? void 0 : z.id) || "unknown";
613
+ const F = (($ = n.user) == null ? void 0 : $.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, P = x || (w ? `linktr.ee/${w}` : void 0), U = ((z = n.user) == null ? void 0 : z.id) || "unknown";
611
614
  return (
612
615
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
613
616
  /* @__PURE__ */ e(
@@ -624,21 +627,35 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
624
627
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
625
628
  /* @__PURE__ */ e(ge, { onClick: s })
626
629
  ] }),
627
- /* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
628
- /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
630
+ /* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
631
+ /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]", style: { backgroundColor: "#FBFAF9" }, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
629
632
  /* @__PURE__ */ e(
630
633
  J,
631
634
  {
632
- id: L,
633
- name: T,
635
+ id: U,
636
+ name: F,
634
637
  image: f,
635
- size: 64
638
+ size: 88,
639
+ className: "!rounded-full"
636
640
  }
637
641
  ),
638
- /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
639
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
640
- O && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: O }),
641
- i && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: i })
642
+ /* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
643
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: F }),
644
+ P && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: P }),
645
+ i && /* @__PURE__ */ e(
646
+ "span",
647
+ {
648
+ className: "mt-1 rounded-full text-xs font-normal w-fit",
649
+ style: {
650
+ padding: "4px 8px",
651
+ backgroundColor: i === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
652
+ color: i === "Subscribed to you" ? "#008236" : "#78716C",
653
+ lineHeight: "133.333%",
654
+ letterSpacing: "0.21px"
655
+ },
656
+ children: i
657
+ }
658
+ )
642
659
  ] })
643
660
  ] }) }),
644
661
  /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
@@ -657,7 +674,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
657
674
  /* @__PURE__ */ e("li", { children: u ? /* @__PURE__ */ d(
658
675
  K,
659
676
  {
660
- onClick: y,
677
+ onClick: I,
661
678
  disabled: N,
662
679
  "aria-busy": N,
663
680
  children: [
@@ -668,7 +685,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
668
685
  ) : /* @__PURE__ */ d(
669
686
  K,
670
687
  {
671
- onClick: M,
688
+ onClick: O,
672
689
  disabled: N,
673
690
  "aria-busy": N,
674
691
  children: [
@@ -687,28 +704,31 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
687
704
  }
688
705
  )
689
706
  );
690
- }, We = ({
707
+ }, ze = ({
691
708
  onBack: t,
692
709
  showBackButton: s,
693
710
  renderMessageInputActions: n,
694
711
  onLeaveConversation: o,
695
712
  onBlockParticipant: i,
696
- CustomChannelEmptyState: c
713
+ CustomChannelEmptyState: c = xe
697
714
  }) => {
698
- var m, I;
699
- const { channel: a } = me(), [l, r] = E(!1), b = (((I = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : I.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
715
+ var m, y;
716
+ const { channel: a } = me(), [l, r] = E(!1), b = (((y = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : y.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
700
717
  (h) => {
701
718
  var v;
702
719
  return ((v = h.user) == null ? void 0 : v.id) && h.user.id !== a._client.userID;
703
720
  }
704
721
  ), [a._client.userID, a.state.members]), g = X.useMemo(() => {
705
722
  const N = a.data ?? {};
706
- return N.followerStatus ? String(N.followerStatus) : N.isFollower ? "Subscribed to you" : void 0;
723
+ if (N.followerStatus)
724
+ return String(N.followerStatus);
725
+ if (N.isFollower !== void 0)
726
+ return N.isFollower ? "Subscribed to you" : "Not subscribed";
707
727
  }, [a.data]);
708
728
  return /* @__PURE__ */ d(oe, { children: [
709
729
  /* @__PURE__ */ d(Te, { children: [
710
730
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
711
- Ge,
731
+ Ve,
712
732
  {
713
733
  onBack: t,
714
734
  showBackButton: s,
@@ -717,18 +737,18 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
717
737
  }
718
738
  ) }),
719
739
  /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
720
- /* @__PURE__ */ e(Pe, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
721
- !b && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(c, {}) })
740
+ /* @__PURE__ */ e(De, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
741
+ !b && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(c, {}) })
722
742
  ] }),
723
743
  /* @__PURE__ */ e(
724
- He,
744
+ Ge,
725
745
  {
726
746
  renderActions: () => n == null ? void 0 : n(a)
727
747
  }
728
748
  )
729
749
  ] }),
730
750
  /* @__PURE__ */ e(
731
- Ve,
751
+ We,
732
752
  {
733
753
  isOpen: l,
734
754
  onClose: () => r(!1),
@@ -740,7 +760,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
740
760
  }
741
761
  )
742
762
  ] });
743
- }, ze = ({
763
+ }, qe = ({
744
764
  channel: t,
745
765
  onBack: s,
746
766
  showBackButton: n = !1,
@@ -748,7 +768,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
748
768
  onLeaveConversation: i,
749
769
  onBlockParticipant: c,
750
770
  className: a,
751
- CustomChannelEmptyState: l
771
+ CustomChannelEmptyState: l = xe
752
772
  }) => /* @__PURE__ */ e(
753
773
  "div",
754
774
  {
@@ -756,8 +776,8 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
756
776
  "messaging-channel-view h-full flex flex-col",
757
777
  a
758
778
  ),
759
- children: /* @__PURE__ */ e(ke, { channel: t, children: /* @__PURE__ */ e(
760
- We,
779
+ children: /* @__PURE__ */ e(Fe, { channel: t, children: /* @__PURE__ */ e(
780
+ ze,
761
781
  {
762
782
  onBack: s,
763
783
  showBackButton: n,
@@ -769,15 +789,15 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
769
789
  ) })
770
790
  }
771
791
  );
772
- function qe({
792
+ function Xe({
773
793
  searchQuery: t,
774
794
  setSearchQuery: s,
775
795
  placeholder: n
776
796
  }) {
777
- const o = _(null);
797
+ const o = H(null);
778
798
  return /* @__PURE__ */ d("div", { className: "relative", children: [
779
799
  /* @__PURE__ */ e(
780
- pe,
800
+ je,
781
801
  {
782
802
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
783
803
  weight: "bold"
@@ -808,7 +828,7 @@ function qe({
808
828
  )
809
829
  ] });
810
830
  }
811
- const Xe = ({
831
+ const Qe = ({
812
832
  participantSource: t,
813
833
  onSelectParticipant: s,
814
834
  onClose: n,
@@ -817,26 +837,26 @@ const Xe = ({
817
837
  searchPlaceholder: c = "Search participants...",
818
838
  className: a
819
839
  }) => {
820
- const { debug: l } = se(), [r, b] = E(""), [u, g] = E([]), [m, I] = E(!1), [N, h] = E(null), [v, S] = E(
840
+ const { debug: l } = se(), [r, b] = E(""), [u, g] = E([]), [m, y] = E(!1), [N, h] = E(null), [v, S] = E(
821
841
  null
822
- ), M = _(!1);
823
- $(() => {
842
+ ), O = H(!1);
843
+ _(() => {
824
844
  if (t.loading) {
825
845
  l && console.log(
826
846
  "[ParticipantPicker] Waiting for participant source to finish loading..."
827
847
  );
828
848
  return;
829
849
  }
830
- if (M.current) return;
850
+ if (O.current) return;
831
851
  (async () => {
832
- l && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), h(null);
852
+ l && console.log("[ParticipantPicker] Loading initial participants..."), y(!0), h(null);
833
853
  try {
834
854
  const x = await t.loadParticipants({
835
855
  search: "",
836
856
  // Load all participants initially
837
857
  limit: 100
838
858
  });
839
- g(x.participants), M.current = !0, l && console.log(
859
+ g(x.participants), O.current = !0, l && console.log(
840
860
  "[ParticipantPicker] Participants loaded successfully:",
841
861
  x.participants.length
842
862
  );
@@ -844,16 +864,16 @@ const Xe = ({
844
864
  const w = x instanceof Error ? x.message : "Failed to load participants";
845
865
  h(w), console.error("[ParticipantPicker] Failed to load participants:", x);
846
866
  } finally {
847
- I(!1);
867
+ y(!1);
848
868
  }
849
869
  })();
850
870
  }, [t.loading, l]);
851
- const y = u.filter((f) => !o.has(f.id)).filter((f) => {
871
+ const I = u.filter((f) => !o.has(f.id)).filter((f) => {
852
872
  var w;
853
873
  if (!r) return !0;
854
874
  const x = r.toLowerCase();
855
875
  return f.name.toLowerCase().includes(x) || ((w = f.email) == null ? void 0 : w.toLowerCase().includes(x)) || !1;
856
- }), k = F(
876
+ }), k = M(
857
877
  async (f) => {
858
878
  if (!v) {
859
879
  S(f.id);
@@ -865,7 +885,7 @@ const Xe = ({
865
885
  }
866
886
  },
867
887
  [s, v]
868
- ), T = (f, x) => {
888
+ ), F = (f, x) => {
869
889
  (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k(x));
870
890
  };
871
891
  return /* @__PURE__ */ d("div", { className: D("flex flex-col h-full", a), children: [
@@ -878,12 +898,12 @@ const Xe = ({
878
898
  "Select a ",
879
899
  i.slice(0, -1),
880
900
  " to start messaging (",
881
- y.length,
901
+ I.length,
882
902
  " available)",
883
903
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${i} total`
884
904
  ] }),
885
905
  /* @__PURE__ */ e(
886
- qe,
906
+ Xe,
887
907
  {
888
908
  searchQuery: r,
889
909
  setSearchQuery: b,
@@ -897,26 +917,26 @@ const Xe = ({
897
917
  ": ",
898
918
  N
899
919
  ] }),
900
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
920
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && I.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
901
921
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
902
922
  /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
903
923
  "Loading ",
904
924
  i,
905
925
  "..."
906
926
  ] })
907
- ] }) }) : y.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
927
+ ] }) }) : I.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
908
928
  /* @__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" }) }),
909
929
  /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: r ? `No ${i} found` : u.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
910
930
  /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: r ? "Try a different search term" : u.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
911
931
  ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
912
- y.map((f) => {
932
+ I.map((f) => {
913
933
  const x = f.name || f.email || f.id, w = f.email && f.name ? f.email : f.phone;
914
934
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
915
935
  "button",
916
936
  {
917
937
  type: "button",
918
938
  onClick: () => k(f),
919
- onKeyDown: (O) => T(O, f),
939
+ onKeyDown: (P) => F(P, f),
920
940
  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",
921
941
  children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
922
942
  /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
@@ -945,7 +965,7 @@ const Xe = ({
945
965
  ] }) })
946
966
  ] }) })
947
967
  ] });
948
- }, Qe = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
968
+ }, 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__ */ d("div", { className: "text-center max-w-sm", children: [
949
969
  /* @__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: "๐Ÿ’ฌ" }) }),
950
970
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
951
971
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(oe, { children: [
@@ -988,7 +1008,7 @@ const Xe = ({
988
1008
  children: "Go Back"
989
1009
  }
990
1010
  )
991
- ] }) }), Ze = ({ className: t, message: s }) => /* @__PURE__ */ d(
1011
+ ] }) }), Je = ({ className: t, message: s }) => /* @__PURE__ */ d(
992
1012
  "div",
993
1013
  {
994
1014
  className: D("flex items-center justify-center h-full", t),
@@ -1031,10 +1051,10 @@ const Xe = ({
1031
1051
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1032
1052
  ]
1033
1053
  }
1034
- ), Je = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1035
- /* @__PURE__ */ e(Ze, { className: "w-6 h-6" }),
1054
+ ), Ye = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1055
+ /* @__PURE__ */ e(Je, { className: "w-6 h-6" }),
1036
1056
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1037
- ] }) }), os = ({
1057
+ ] }) }), as = ({
1038
1058
  capabilities: t = {},
1039
1059
  className: s,
1040
1060
  renderMessageInputActions: n,
@@ -1050,14 +1070,14 @@ const Xe = ({
1050
1070
  client: u,
1051
1071
  isConnected: g,
1052
1072
  isLoading: m,
1053
- error: I,
1073
+ error: y,
1054
1074
  refreshConnection: N,
1055
1075
  debug: h
1056
- } = je(), [v, S] = E(null), [M, y] = E(!1), [k, T] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, O] = E(0), [L, p] = E(!1), [H, G] = E(null), V = _(null), {
1076
+ } = Ae(), [v, S] = E(null), [O, I] = E(!1), [k, F] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, P] = E(0), [U, L] = E(!1), [$, G] = E(null), V = H(null), {
1057
1077
  showStartConversation: Q = !1,
1058
1078
  participantSource: W,
1059
1079
  participantLabel: z = "participants"
1060
- } = t, R = _(null), P = F(async () => {
1080
+ } = t, R = H(null), T = M(async () => {
1061
1081
  if (!u || !g) return;
1062
1082
  const C = u.userID;
1063
1083
  if (C)
@@ -1070,27 +1090,27 @@ const Xe = ({
1070
1090
  },
1071
1091
  {},
1072
1092
  { limit: 100 }
1073
- ), U = /* @__PURE__ */ new Set();
1093
+ ), p = /* @__PURE__ */ new Set();
1074
1094
  j.forEach((B) => {
1075
- const Ce = B.state.members;
1076
- Object.values(Ce).forEach((ve) => {
1095
+ const ve = B.state.members;
1096
+ Object.values(ve).forEach((we) => {
1077
1097
  var ae;
1078
- const re = (ae = ve.user) == null ? void 0 : ae.id;
1079
- re && re !== C && U.add(re);
1098
+ const re = (ae = we.user) == null ? void 0 : ae.id;
1099
+ re && re !== C && p.add(re);
1080
1100
  });
1081
- }), x(U), y(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
1101
+ }), x(p), I(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
1082
1102
  channelCount: j.length,
1083
- memberCount: U.size
1103
+ memberCount: p.size
1084
1104
  });
1085
1105
  } catch (j) {
1086
1106
  console.error("[MessagingShell] Failed to sync channels:", j);
1087
1107
  }
1088
1108
  }, [u, g, h]);
1089
- $(() => {
1109
+ _(() => {
1090
1110
  if (!u || !g) return;
1091
1111
  const C = u.userID;
1092
- C && R.current !== C && P();
1093
- }, [u, g, P]), $(() => {
1112
+ C && R.current !== C && T();
1113
+ }, [u, g, T]), _(() => {
1094
1114
  if (!c || !u || !g) return;
1095
1115
  (async () => {
1096
1116
  const j = u.userID;
@@ -1100,7 +1120,7 @@ const Xe = ({
1100
1120
  "[MessagingShell] Loading initial conversation with:",
1101
1121
  c
1102
1122
  );
1103
- const U = await u.queryChannels(
1123
+ const p = await u.queryChannels(
1104
1124
  {
1105
1125
  type: "messaging",
1106
1126
  members: { $eq: [j, c] }
@@ -1108,10 +1128,10 @@ const Xe = ({
1108
1128
  {},
1109
1129
  { limit: 1 }
1110
1130
  );
1111
- if (U.length > 0)
1112
- S(U[0]), p(!0), G(null), o && o(U[0]), h && console.log(
1131
+ if (p.length > 0)
1132
+ S(p[0]), L(!0), G(null), o && o(p[0]), h && console.log(
1113
1133
  "[MessagingShell] Initial conversation loaded:",
1114
- U[0].id
1134
+ p[0].id
1115
1135
  );
1116
1136
  else if (a && b) {
1117
1137
  h && console.log(
@@ -1125,7 +1145,7 @@ const Xe = ({
1125
1145
  email: a.email,
1126
1146
  phone: a.phone
1127
1147
  });
1128
- S(B), p(!0), G(null), o && o(B), h && console.log(
1148
+ S(B), L(!0), G(null), o && o(B), h && console.log(
1129
1149
  "[MessagingShell] Channel created and loaded:",
1130
1150
  B.id
1131
1151
  );
@@ -1142,10 +1162,10 @@ const Xe = ({
1142
1162
  "[MessagingShell] No conversation found for:",
1143
1163
  c
1144
1164
  );
1145
- } catch (U) {
1165
+ } catch (p) {
1146
1166
  console.error(
1147
1167
  "[MessagingShell] Failed to load initial conversation:",
1148
- U
1168
+ p
1149
1169
  ), G("Failed to load conversation");
1150
1170
  }
1151
1171
  })();
@@ -1158,17 +1178,17 @@ const Xe = ({
1158
1178
  h,
1159
1179
  o
1160
1180
  ]);
1161
- const A = F(
1181
+ const A = M(
1162
1182
  (C) => {
1163
1183
  S(C), o == null || o(C);
1164
1184
  },
1165
1185
  [o]
1166
- ), q = F(() => {
1167
- L || S(null);
1168
- }, [L]), Z = F(() => {
1186
+ ), q = M(() => {
1187
+ U || S(null);
1188
+ }, [U]), Z = M(() => {
1169
1189
  var C;
1170
- W && (O((j) => j + 1), T(!0), (C = V.current) == null || C.showModal());
1171
- }, [W]), xe = F(
1190
+ W && (P((j) => j + 1), F(!0), (C = V.current) == null || C.showModal());
1191
+ }, [W]), Ne = M(
1172
1192
  async (C) => {
1173
1193
  var j;
1174
1194
  if (b)
@@ -1177,44 +1197,44 @@ const Xe = ({
1177
1197
  "[MessagingShell] Starting conversation with:",
1178
1198
  C.id
1179
1199
  );
1180
- const U = await b.startChannelWithParticipant({
1200
+ const p = await b.startChannelWithParticipant({
1181
1201
  id: C.id,
1182
1202
  name: C.name,
1183
1203
  email: C.email,
1184
1204
  phone: C.phone
1185
1205
  });
1186
1206
  try {
1187
- await U.show();
1207
+ await p.show();
1188
1208
  } catch (B) {
1189
1209
  console.warn("[MessagingShell] Failed to unhide channel:", B);
1190
1210
  }
1191
- S(U), T(!1), (j = V.current) == null || j.close(), i == null || i(C);
1192
- } catch (U) {
1193
- console.error("[MessagingShell] Failed to start conversation:", U);
1211
+ S(p), F(!1), (j = V.current) == null || j.close(), i == null || i(C);
1212
+ } catch (p) {
1213
+ console.error("[MessagingShell] Failed to start conversation:", p);
1194
1214
  }
1195
1215
  },
1196
1216
  [b, i, h]
1197
- ), te = F(() => {
1217
+ ), te = M(() => {
1198
1218
  var C;
1199
- T(!1), (C = V.current) == null || C.close();
1200
- }, []), Ne = F(
1219
+ F(!1), (C = V.current) == null || C.close();
1220
+ }, []), be = M(
1201
1221
  async (C) => {
1202
- h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), p(!1), R.current = null, await P();
1222
+ h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), L(!1), R.current = null, await T();
1203
1223
  },
1204
- [P, h]
1205
- ), be = F(
1224
+ [T, h]
1225
+ ), Ce = M(
1206
1226
  async (C) => {
1207
- h && console.log("[MessagingShell] Blocking participant:", C), S(null), p(!1), R.current = null, await P();
1227
+ h && console.log("[MessagingShell] Blocking participant:", C), S(null), L(!1), R.current = null, await T();
1208
1228
  },
1209
- [P, h]
1229
+ [T, h]
1210
1230
  ), Y = !!v;
1211
- return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Je, {}) }) : I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1231
+ return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Ye, {}) }) : y ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: y, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1212
1232
  le,
1213
1233
  {
1214
1234
  message: "Not connected to messaging service",
1215
1235
  onBack: N
1216
1236
  }
1217
- ) }) : H ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: H }) }) : /* @__PURE__ */ d(
1237
+ ) }) : $ ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: $ }) }) : /* @__PURE__ */ d(
1218
1238
  "div",
1219
1239
  {
1220
1240
  className: D(
@@ -1230,11 +1250,11 @@ const Xe = ({
1230
1250
  "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",
1231
1251
  {
1232
1252
  // Explicitly hidden via prop or in direct conversation mode
1233
- "!hidden": r === !1 || L,
1253
+ "!hidden": r === !1 || U,
1234
1254
  // Normal mode: hide on mobile when channel selected, show on desktop
1235
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !L && Y,
1255
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !U && Y,
1236
1256
  // Normal mode: show when no channel selected
1237
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !L && !Y
1257
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !U && !Y
1238
1258
  }
1239
1259
  ),
1240
1260
  children: /* @__PURE__ */ e(
@@ -1256,27 +1276,27 @@ const Xe = ({
1256
1276
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1257
1277
  {
1258
1278
  // In direct conversation mode, always show (full width)
1259
- flex: L || Y,
1279
+ flex: U || Y,
1260
1280
  // Normal mode: hide on mobile when no channel selected
1261
- "hidden lg:flex": !L && !Y
1281
+ "hidden lg:flex": !U && !Y
1262
1282
  }
1263
1283
  ),
1264
1284
  children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1265
- ze,
1285
+ qe,
1266
1286
  {
1267
1287
  channel: v,
1268
1288
  onBack: q,
1269
- showBackButton: !L,
1289
+ showBackButton: !U,
1270
1290
  renderMessageInputActions: n,
1271
- onLeaveConversation: Ne,
1272
- onBlockParticipant: be,
1291
+ onLeaveConversation: be,
1292
+ onBlockParticipant: Ce,
1273
1293
  CustomChannelEmptyState: l
1274
1294
  },
1275
1295
  v.id
1276
1296
  ) }) : /* @__PURE__ */ e(
1277
- Qe,
1297
+ Ze,
1278
1298
  {
1279
- hasChannels: M,
1299
+ hasChannels: O,
1280
1300
  onStartConversation: Q ? Z : void 0,
1281
1301
  participantLabel: z
1282
1302
  }
@@ -1295,10 +1315,10 @@ const Xe = ({
1295
1315
  },
1296
1316
  onClose: te,
1297
1317
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1298
- Xe,
1318
+ Qe,
1299
1319
  {
1300
1320
  participantSource: W,
1301
- onSelectParticipant: xe,
1321
+ onSelectParticipant: Ne,
1302
1322
  onClose: te,
1303
1323
  existingParticipantIds: f,
1304
1324
  participantLabel: z,
@@ -1311,7 +1331,7 @@ const Xe = ({
1311
1331
  ]
1312
1332
  }
1313
1333
  );
1314
- }, Ye = ({
1334
+ }, Ke = ({
1315
1335
  question: t,
1316
1336
  onClick: s,
1317
1337
  loading: n = !1,
@@ -1333,7 +1353,7 @@ const Xe = ({
1333
1353
  ),
1334
1354
  children: t
1335
1355
  }
1336
- ), as = ({
1356
+ ), is = ({
1337
1357
  faqs: t,
1338
1358
  onFaqClick: s,
1339
1359
  loadingFaqId: n,
@@ -1361,7 +1381,7 @@ const Xe = ({
1361
1381
  children: [
1362
1382
  o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
1363
1383
  l.map((r) => /* @__PURE__ */ e(
1364
- Ye,
1384
+ Ke,
1365
1385
  {
1366
1386
  question: r.question,
1367
1387
  onClick: () => s(r.id),
@@ -1373,10 +1393,10 @@ const Xe = ({
1373
1393
  }
1374
1394
  )
1375
1395
  ] }) });
1376
- }, is = (t, s = {}) => {
1377
- const { initialSearch: n = "", pageSize: o = 20 } = s, [i, c] = E([]), [a, l] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, I] = E(!0), [N, h] = E(), v = F(async (k = !1, T) => {
1396
+ }, cs = (t, s = {}) => {
1397
+ const { initialSearch: n = "", pageSize: o = 20 } = s, [i, c] = E([]), [a, l] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, y] = E(!0), [N, h] = E(), v = M(async (k = !1, F) => {
1378
1398
  if (a) return;
1379
- const f = T !== void 0 ? T : u;
1399
+ const f = F !== void 0 ? F : u;
1380
1400
  l(!0), b(null);
1381
1401
  try {
1382
1402
  const x = await t.loadParticipants({
@@ -1386,21 +1406,21 @@ const Xe = ({
1386
1406
  });
1387
1407
  c(
1388
1408
  (w) => k ? x.participants : [...w, ...x.participants]
1389
- ), I(x.hasMore), h(x.nextCursor);
1409
+ ), y(x.hasMore), h(x.nextCursor);
1390
1410
  } catch (x) {
1391
1411
  const w = x instanceof Error ? x.message : "Failed to load participants";
1392
1412
  b(w), console.error("[useParticipants] Load error:", x);
1393
1413
  } finally {
1394
1414
  l(!1);
1395
1415
  }
1396
- }, [t, u, N, o, a]), S = F(() => {
1416
+ }, [t, u, N, o, a]), S = M(() => {
1397
1417
  m && !a && v(!1);
1398
- }, [m, a, v]), M = F((k) => {
1418
+ }, [m, a, v]), O = M((k) => {
1399
1419
  g(k), h(void 0), v(!0, k);
1400
- }, [v]), y = F(() => {
1420
+ }, [v]), I = M(() => {
1401
1421
  h(void 0), v(!0);
1402
1422
  }, [v]);
1403
- return $(() => {
1423
+ return _(() => {
1404
1424
  v(!0);
1405
1425
  }, [t.loadParticipants]), {
1406
1426
  participants: i,
@@ -1410,20 +1430,21 @@ const Xe = ({
1410
1430
  hasMore: m,
1411
1431
  totalCount: t.totalCount,
1412
1432
  loadMore: S,
1413
- search: M,
1414
- refresh: y
1433
+ search: O,
1434
+ refresh: I
1415
1435
  };
1416
1436
  };
1417
1437
  export {
1418
1438
  J as Avatar,
1439
+ xe as ChannelEmptyState,
1419
1440
  $e as ChannelList,
1420
- ze as ChannelView,
1421
- as as FaqList,
1422
- Ye as FaqListItem,
1423
- ls as MessagingProvider,
1424
- os as MessagingShell,
1425
- Xe as ParticipantPicker,
1426
- je as useMessaging,
1427
- is as useParticipants
1441
+ qe as ChannelView,
1442
+ is as FaqList,
1443
+ Ke as FaqListItem,
1444
+ os as MessagingProvider,
1445
+ as as MessagingShell,
1446
+ Qe as ParticipantPicker,
1447
+ Ae as useMessaging,
1448
+ cs as useParticipants
1428
1449
  };
1429
1450
  //# sourceMappingURL=index.js.map