@linktr.ee/messaging-react 1.7.0 → 1.7.1

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,8 +1,8 @@
1
1
  import we, { jsx as e, jsxs as d, Fragment as de } from "react/jsx-runtime";
2
2
  import _ from "classnames";
3
- import G, { createContext as Oe, useContext as Te, useCallback as M, useState as I, useRef as A, useEffect as $ } from "react";
3
+ import H, { createContext as Oe, useContext as Te, useCallback as M, useState as I, useRef as A, useEffect as G } from "react";
4
4
  import { StreamChatService as je } from "@linktr.ee/messaging-core";
5
- import { Chat as Ue, useChatContext as Le, ChannelList as Be, Channel as Ae, useChannelStateContext as ye, Window as $e, MessageList as Ge, MessageInput as He } from "stream-chat-react";
5
+ import { Chat as Ue, useChatContext as Le, ChannelList as Be, Channel as Ae, useChannelStateContext as ye, Window as Ge, MessageList as He, MessageInput as $e } from "stream-chat-react";
6
6
  import { NotePencilIcon as qe, XIcon as Ee, ArrowLeftIcon as We, DotsThreeIcon as ze, SpinnerGapIcon as re, SignOutIcon as Ve, ProhibitInsetIcon as fe, FlagIcon as Xe, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as me } from "@phosphor-icons/react";
7
7
  const Ie = Oe({
8
8
  service: null,
@@ -60,7 +60,7 @@ const Ie = Oe({
60
60
  serviceConfig: n,
61
61
  capabilities: a,
62
62
  customization: c
63
- }, $(() => {
63
+ }, G(() => {
64
64
  const y = P.current;
65
65
  if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
66
66
  renderCount: y,
@@ -100,7 +100,7 @@ const Ie = Oe({
100
100
  };
101
101
  }, [l, n, i, r]);
102
102
  const p = A(null);
103
- $(() => {
103
+ G(() => {
104
104
  var F, T;
105
105
  if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
106
106
  hasService: !!o,
@@ -134,10 +134,10 @@ const Ie = Oe({
134
134
  clientId: j.userID
135
135
  });
136
136
  } catch (j) {
137
- const H = j instanceof Error ? j.message : "Connection failed";
138
- S(H), r("❌ USER CONNECTION ERROR", {
137
+ const $ = j instanceof Error ? j.message : "Connection failed";
138
+ S($), r("❌ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
- error: H
140
+ error: $
141
141
  });
142
142
  } finally {
143
143
  m(!1), k.current = !1, r("🔄 USER CONNECTION FINISHED", {
@@ -146,7 +146,7 @@ const Ie = Oe({
146
146
  });
147
147
  }
148
148
  })();
149
- }, [o, s, r, b]), $(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
149
+ }, [o, s, r, b]), G(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
150
150
  hasService: !!o,
151
151
  isConnected: b
152
152
  }), () => {
@@ -180,7 +180,7 @@ const Ie = Oe({
180
180
  } finally {
181
181
  m(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
182
182
  }
183
- }, [o, s, r]), v = G.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
183
+ }, [o, s, r]), v = H.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
184
184
  hasService: !!o,
185
185
  hasClient: !!u,
186
186
  isConnected: b,
@@ -226,7 +226,7 @@ function Je() {
226
226
  return c && c.__esModule ? c : { default: c };
227
227
  };
228
228
  Object.defineProperty(t, "__esModule", { value: !0 }), t.baseStyleClasses = void 0;
229
- const n = s(G), l = s(_);
229
+ const n = s(H), l = s(_);
230
230
  t.baseStyleClasses = (0, l.default)("text-sm", "h-2xl", "block", "p-md", "w-full", "rounded-sm", "bg-chalk", "text-black", "transition", "duration-75", "ease-out", "!outline-none");
231
231
  const a = ({ className: c, onChange: i, onChangeValue: r, appearance: o = "default", ...C }, u) => {
232
232
  const x = o === "none" ? "appearance-none" : t.baseStyleClasses, b = ({ target: { value: h, checked: f } }) => C.type === "checkbox" ? r == null ? void 0 : r(f) : r == null ? void 0 : r(h);
@@ -248,7 +248,7 @@ function Ye() {
248
248
  return i && i.__esModule ? i : { default: i };
249
249
  };
250
250
  Object.defineProperty(Q, "__esModule", { value: !0 });
251
- const s = we, n = t(G), l = t(_), a = t(Je()), c = ({ id: i, name: r, label: o, className: C = "", checked: u, defaultChecked: x, inactive: b, value: h, tabIndex: f, icon: m, ...N }, S) => {
251
+ const s = we, n = t(H), l = t(_), a = t(Je()), c = ({ id: i, name: r, label: o, className: C = "", checked: u, defaultChecked: x, inactive: b, value: h, tabIndex: f, icon: m, ...N }, S) => {
252
252
  const k = u || x, E = b || (N == null ? void 0 : N.disabled), P = ({ key: p, code: g }) => {
253
253
  var v;
254
254
  N.onChangeValue && (p === "Enter" || g === "Space") && ((v = N.onChangeValue) == null || v.call(N, h));
@@ -279,7 +279,7 @@ function ke() {
279
279
  return a && a.__esModule ? a : { default: a };
280
280
  };
281
281
  Object.defineProperty(Z, "__esModule", { value: !0 });
282
- const s = we, n = t(G), l = ({ children: a, label: c, className: i = "" }, r) => (0, s.jsxs)("fieldset", { className: `${i} -ml-xs space-x-xs space-y-xs`, ref: r, children: [c && (0, s.jsx)("legend", { className: "mb-sm ml-sm text-sm font-semibold", children: c }), a] });
282
+ const s = we, n = t(H), l = ({ children: a, label: c, className: i = "" }, r) => (0, s.jsxs)("fieldset", { className: `${i} -ml-xs space-x-xs space-y-xs`, ref: r, children: [c && (0, s.jsx)("legend", { className: "mb-sm ml-sm text-sm font-semibold", children: c }), a] });
283
283
  return Z.default = n.default.forwardRef(l), Z;
284
284
  }
285
285
  var be;
@@ -370,7 +370,7 @@ const se = ({
370
370
  size: n = 40,
371
371
  className: l
372
372
  }) => {
373
- const a = rs(t), c = "#FBFAF9", r = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
373
+ const a = rs(t), i = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
374
374
  return /* @__PURE__ */ e(
375
375
  "div",
376
376
  {
@@ -391,13 +391,9 @@ const se = ({
391
391
  {
392
392
  "aria-hidden": "true",
393
393
  className: _(
394
- "flex h-full w-full items-center justify-center font-semibold rounded-sm",
395
- r
394
+ "flex h-full w-full items-center justify-center font-semibold rounded-sm bg-[#FBFAF9]/60",
395
+ i
396
396
  ),
397
- style: {
398
- color: c,
399
- backgroundColor: `color-mix(in srgb, ${c} 60%, solid)`
400
- },
401
397
  children: a
402
398
  }
403
399
  )
@@ -475,7 +471,7 @@ const se = ({
475
471
  className: c
476
472
  }) => {
477
473
  var b;
478
- const i = G.useRef(0);
474
+ const i = H.useRef(0);
479
475
  i.current++;
480
476
  const { debug: r = !1 } = le();
481
477
  r && console.log("📺 [ChannelList] 🔄 RENDER START", {
@@ -495,7 +491,7 @@ const se = ({
495
491
  type: "messaging",
496
492
  last_message_at: { $exists: !0 },
497
493
  has_unread: void 0
498
- }), x = G.useMemo(() => {
494
+ }), x = H.useMemo(() => {
499
495
  const h = o.userID, f = {
500
496
  ...C,
501
497
  ...h && {
@@ -614,10 +610,10 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
614
610
  /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
615
611
  ] }) }), as = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
616
612
  t && t(),
617
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(He, { focus: !0, maxRows: 4 }) })
613
+ /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e($e, { focus: !0, maxRows: 4 }) })
618
614
  ] }), is = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
619
615
  var o, C, u, x;
620
- const { channel: a } = ye(), c = G.useMemo(() => Object.values(a.state.members || {}).find(
616
+ const { channel: a } = ye(), c = H.useMemo(() => Object.values(a.state.members || {}).find(
621
617
  (h) => {
622
618
  var f;
623
619
  return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== a._client.userID;
@@ -657,9 +653,9 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
657
653
  onLeaveConversation: c,
658
654
  onBlockParticipant: i
659
655
  }) => {
660
- var j, H, q, W, J, z, V;
656
+ var j, $, q, W, J, z, V;
661
657
  const { service: r, debug: o } = le(), C = A(null), [u, x] = I(!1), [b, h] = I(!1), [f, m] = I(!1);
662
- $(() => {
658
+ G(() => {
663
659
  const R = C.current;
664
660
  R && (t ? R.showModal() : R.close());
665
661
  }, [t]);
@@ -681,7 +677,7 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
681
677
  );
682
678
  }
683
679
  }, [r, (j = n == null ? void 0 : n.user) == null ? void 0 : j.id]);
684
- $(() => {
680
+ G(() => {
685
681
  t && N();
686
682
  }, [t, N]);
687
683
  const S = async () => {
@@ -729,7 +725,7 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
729
725
  );
730
726
  };
731
727
  if (!n) return null;
732
- const p = ((H = n.user) == null ? void 0 : H.name) || ((q = n.user) == null ? void 0 : q.id) || "Unknown member", g = (W = n.user) == null ? void 0 : W.image, v = (J = n.user) == null ? void 0 : J.email, y = (z = n.user) == null ? void 0 : z.username, F = v || (y ? `linktr.ee/${y}` : void 0), T = ((V = n.user) == null ? void 0 : V.id) || "unknown";
728
+ const p = (($ = n.user) == null ? void 0 : $.name) || ((q = n.user) == null ? void 0 : q.id) || "Unknown member", g = (W = n.user) == null ? void 0 : W.image, v = (J = n.user) == null ? void 0 : J.email, y = (z = n.user) == null ? void 0 : z.username, F = v || (y ? `linktr.ee/${y}` : void 0), T = ((V = n.user) == null ? void 0 : V.id) || "unknown";
733
729
  return (
734
730
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
735
731
  /* @__PURE__ */ e(
@@ -832,12 +828,12 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
832
828
  CustomChannelEmptyState: c = Pe
833
829
  }) => {
834
830
  var b, h;
835
- const { channel: i } = ye(), [r, o] = I(!1), C = (((h = (b = i == null ? void 0 : i.state) == null ? void 0 : b.messages) == null ? void 0 : h.length) ?? 0) > 0, u = G.useMemo(() => Object.values(i.state.members || {}).find(
831
+ const { channel: i } = ye(), [r, o] = I(!1), C = (((h = (b = i == null ? void 0 : i.state) == null ? void 0 : b.messages) == null ? void 0 : h.length) ?? 0) > 0, u = H.useMemo(() => Object.values(i.state.members || {}).find(
836
832
  (m) => {
837
833
  var N;
838
834
  return ((N = m.user) == null ? void 0 : N.id) && m.user.id !== i._client.userID;
839
835
  }
840
- ), [i._client.userID, i.state.members]), x = G.useMemo(() => {
836
+ ), [i._client.userID, i.state.members]), x = H.useMemo(() => {
841
837
  const f = i.data ?? {};
842
838
  if (f.followerStatus)
843
839
  return String(f.followerStatus);
@@ -845,7 +841,7 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
845
841
  return f.isFollower ? "Subscribed to you" : "Not subscribed";
846
842
  }, [i.data]);
847
843
  return /* @__PURE__ */ d(de, { children: [
848
- /* @__PURE__ */ d($e, { children: [
844
+ /* @__PURE__ */ d(Ge, { children: [
849
845
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
850
846
  is,
851
847
  {
@@ -856,7 +852,7 @@ const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
856
852
  }
857
853
  ) }),
858
854
  /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
859
- /* @__PURE__ */ e(Ge, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
855
+ /* @__PURE__ */ e(He, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
860
856
  !C && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(c, {}) })
861
857
  ] }),
862
858
  /* @__PURE__ */ e(
@@ -959,7 +955,7 @@ const ms = ({
959
955
  const { debug: r } = le(), [o, C] = I(""), [u, x] = I([]), [b, h] = I(!1), [f, m] = I(null), [N, S] = I(
960
956
  null
961
957
  ), k = A(!1);
962
- $(() => {
958
+ G(() => {
963
959
  if (t.loading) {
964
960
  r && console.log(
965
961
  "[ParticipantPicker] Waiting for participant source to finish loading..."
@@ -1192,7 +1188,7 @@ const ms = ({
1192
1188
  error: h,
1193
1189
  refreshConnection: f,
1194
1190
  debug: m
1195
- } = Ze(), [N, S] = I(null), [k, E] = I(!1), [P, p] = I(!1), [g, v] = I(/* @__PURE__ */ new Set()), [y, F] = I(0), [T, j] = I(!1), [H, q] = I(null), W = A(null), {
1191
+ } = Ze(), [N, S] = I(null), [k, E] = I(!1), [P, p] = I(!1), [g, v] = I(/* @__PURE__ */ new Set()), [y, F] = I(0), [T, j] = I(!1), [$, q] = I(null), W = A(null), {
1196
1192
  showStartConversation: J = !1,
1197
1193
  participantSource: z,
1198
1194
  participantLabel: V = "participants"
@@ -1225,11 +1221,11 @@ const ms = ({
1225
1221
  console.error("[MessagingShell] Failed to sync channels:", U);
1226
1222
  }
1227
1223
  }, [u, x, m]);
1228
- $(() => {
1224
+ G(() => {
1229
1225
  if (!u || !x) return;
1230
1226
  const w = u.userID;
1231
1227
  w && R.current !== w && D();
1232
- }, [u, x, D]), $(() => {
1228
+ }, [u, x, D]), G(() => {
1233
1229
  if (!c || !u || !x) return;
1234
1230
  (async () => {
1235
1231
  const U = u.userID;
@@ -1353,7 +1349,7 @@ const ms = ({
1353
1349
  message: "Not connected to messaging service",
1354
1350
  onBack: f
1355
1351
  }
1356
- ) }) : H ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ce, { message: H }) }) : /* @__PURE__ */ d(
1352
+ ) }) : $ ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ce, { message: $ }) }) : /* @__PURE__ */ d(
1357
1353
  "div",
1358
1354
  {
1359
1355
  className: _(
@@ -1539,7 +1535,7 @@ const ms = ({
1539
1535
  }, [N]), E = M(() => {
1540
1536
  m(void 0), N(!0);
1541
1537
  }, [N]);
1542
- return $(() => {
1538
+ return G(() => {
1543
1539
  N(!0);
1544
1540
  }, [t.loadParticipants]), {
1545
1541
  participants: a,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/providers/MessagingProvider.tsx","../src/hooks/useMessaging.ts","../../../node_modules/@linktr.ee/component-library/dist/Input/Base.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/SelectPill.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/SelectPillGroup.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/index.js","../src/components/IconButton/index.tsx","../src/components/Avatar/getAvatarEmoji.ts","../src/components/Avatar/index.tsx","../src/components/ChannelList/CustomChannelPreview.tsx","../src/components/ChannelList/index.tsx","../src/components/ActionButton/index.tsx","../src/components/CloseButton/index.tsx","../src/components/MessagingShell/ChannelEmptyState.tsx","../src/components/ChannelView.tsx","../src/components/SearchInput/index.tsx","../src/components/ParticipantPicker/index.tsx","../src/components/MessagingShell/EmptyState.tsx","../src/components/MessagingShell/ErrorState.tsx","../src/components/Loading/index.tsx","../src/components/MessagingShell/LoadingState.tsx","../src/components/MessagingShell/index.tsx","../src/components/FaqList/FaqListItem.tsx","../src/components/FaqList/index.tsx","../src/hooks/useParticipants.ts"],"sourcesContent":["import { StreamChatService } from '@linktr.ee/messaging-core'\nimport React, {\n createContext,\n useContext,\n useEffect,\n useState,\n useRef,\n useCallback,\n} from 'react'\nimport type { StreamChat } from 'stream-chat'\nimport { Chat } from 'stream-chat-react'\n\nimport type {\n MessagingProviderProps,\n MessagingCapabilities,\n MessagingCustomization,\n} from '../types'\n\n/**\n * Context value for messaging state and service\n */\nexport interface MessagingContextValue {\n service: StreamChatService | null\n client: StreamChat | null // Stream Chat client\n isConnected: boolean\n isLoading: boolean\n error: string | null\n capabilities: MessagingCapabilities\n customization: MessagingCustomization\n refreshConnection: () => Promise<void>\n debug: boolean\n}\n\nconst MessagingContext = createContext<MessagingContextValue>({\n service: null,\n client: null,\n isConnected: false,\n isLoading: false,\n error: null,\n capabilities: {},\n customization: {},\n refreshConnection: async () => {},\n debug: false,\n})\n\n/**\n * Hook to access messaging context\n */\nexport const useMessagingContext = () => useContext(MessagingContext)\n\n/**\n * Provider component that wraps messaging-core with React state management\n */\nexport const MessagingProvider: React.FC<MessagingProviderProps> = ({\n children,\n user,\n serviceConfig,\n apiKey,\n capabilities = {},\n customization = {},\n debug = false,\n}) => {\n // Create debug logger that respects the debug prop\n const debugLog = useCallback(\n (message: string, ...args: unknown[]) => {\n if (debug) {\n console.log(`🔥 [MessagingProvider] ${message}`, ...args)\n }\n },\n [debug]\n )\n\n debugLog('🔄 RENDER START', {\n userId: user?.id,\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfig: !!serviceConfig,\n capabilities: Object.keys(capabilities),\n customization: Object.keys(customization),\n })\n\n const [service, setService] = useState<StreamChatService | null>(null)\n const [client, setClient] = useState<StreamChat | null>(null)\n const [isConnected, setIsConnected] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n // Prevent multiple concurrent connection attempts\n const connectingRef = useRef(false)\n\n // Track renders and prop changes\n const prevPropsRef = useRef({\n userId: user?.id,\n apiKey,\n serviceConfig,\n capabilities,\n customization,\n })\n const renderCountRef = useRef(0)\n renderCountRef.current++\n\n debugLog('📊 RENDER INFO', {\n renderCount: renderCountRef.current,\n currentProps: { userId: user?.id, apiKey: apiKey?.substring(0, 8) + '...' },\n propChanges: {\n userChanged: prevPropsRef.current.userId !== user?.id,\n apiKeyChanged: prevPropsRef.current.apiKey !== apiKey,\n serviceConfigChanged:\n prevPropsRef.current.serviceConfig !== serviceConfig,\n capabilitiesChanged: prevPropsRef.current.capabilities !== capabilities,\n customizationChanged:\n prevPropsRef.current.customization !== customization,\n },\n })\n\n prevPropsRef.current = {\n userId: user?.id,\n apiKey,\n serviceConfig,\n capabilities,\n customization,\n }\n\n // Initialize service when config changes\n useEffect(() => {\n const currentRender = renderCountRef.current\n debugLog('🔧 SERVICE INIT EFFECT TRIGGERED', {\n renderCount: currentRender,\n apiKey: !!apiKey,\n serviceConfig: !!serviceConfig,\n dependencies: {\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfigRef: serviceConfig,\n serviceConfigStable:\n prevPropsRef.current.serviceConfig === serviceConfig,\n apiKeyStable: prevPropsRef.current.apiKey === apiKey,\n },\n })\n\n if (!apiKey || !serviceConfig) {\n debugLog('⚠️ SERVICE INIT SKIPPED', {\n renderCount: currentRender,\n reason: 'Missing apiKey or serviceConfig',\n })\n return\n }\n\n debugLog('🚀 CREATING NEW SERVICE', {\n renderCount: currentRender,\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfigChanged:\n prevPropsRef.current.serviceConfig !== serviceConfig,\n })\n\n const newService = new StreamChatService({\n ...serviceConfig,\n apiKey,\n debug,\n })\n\n setService(newService)\n debugLog('✅ SERVICE SET', {\n renderCount: currentRender,\n serviceInstance: !!newService,\n })\n\n return () => {\n debugLog('🧹 SERVICE CLEANUP', {\n renderCount: currentRender,\n reason: 'Effect cleanup',\n })\n newService.disconnectUser().catch(console.error)\n }\n }, [apiKey, serviceConfig, debug, debugLog]) // Use serviceConfig object directly, not individual properties\n\n // Track if we've already connected this user with this service to prevent duplicate connections\n const connectedUserRef = useRef<{\n serviceId: StreamChatService\n userId: string\n } | null>(null)\n\n // Connect user when service and user are available\n useEffect(() => {\n debugLog('🔗 USER CONNECTION EFFECT TRIGGERED', {\n hasService: !!service,\n hasUser: !!user,\n userId: user?.id,\n isConnecting: connectingRef.current,\n isConnected: isConnected,\n dependencies: { service: !!service, userId: user?.id },\n })\n\n if (!service || !user) {\n debugLog('⚠️ USER CONNECTION SKIPPED', 'Missing service or user')\n return\n }\n\n if (connectingRef.current) {\n debugLog('⚠️ USER CONNECTION SKIPPED', 'Already connecting')\n return\n }\n\n // Check if we've already connected this exact user with this exact service instance\n if (\n connectedUserRef.current?.serviceId === service &&\n connectedUserRef.current?.userId === user.id\n ) {\n debugLog(\n '⚠️ USER CONNECTION SKIPPED',\n 'Already connected this user with this service'\n )\n return\n }\n\n const connectUser = async () => {\n debugLog('🚀 STARTING USER CONNECTION', { userId: user.id })\n connectingRef.current = true\n setIsLoading(true)\n setError(null)\n\n try {\n debugLog('📞 CALLING SERVICE.CONNECTUSER', { userId: user.id })\n const streamClient = await service.connectUser(user)\n setClient(streamClient)\n setIsConnected(true)\n connectedUserRef.current = { serviceId: service, userId: user.id } // Mark as connected\n debugLog('✅ USER CONNECTION SUCCESS', {\n userId: user.id,\n clientId: streamClient.userID,\n })\n } catch (err) {\n const errorMessage =\n err instanceof Error ? err.message : 'Connection failed'\n setError(errorMessage)\n debugLog('❌ USER CONNECTION ERROR', {\n userId: user.id,\n error: errorMessage,\n })\n } finally {\n setIsLoading(false)\n connectingRef.current = false\n debugLog('🔄 USER CONNECTION FINISHED', {\n userId: user.id,\n isConnected,\n })\n }\n }\n\n connectUser()\n }, [service, user, debugLog, isConnected]) // Remove isConnected to prevent circular dependency\n\n // Disconnect when user is removed (cleanup effect)\n useEffect(() => {\n debugLog('🔌 CLEANUP EFFECT REGISTERED', {\n hasService: !!service,\n isConnected,\n })\n return () => {\n if (service && isConnected) {\n debugLog(\n '🧹 CLEANUP EFFECT TRIGGERED',\n 'Cleaning up connection on unmount'\n )\n connectedUserRef.current = null // Reset connection tracking\n service.disconnectUser().catch(console.error)\n } else {\n debugLog('🔇 CLEANUP EFFECT SKIPPED', {\n hasService: !!service,\n isConnected,\n })\n }\n }\n }, [service, isConnected, debugLog])\n\n const refreshConnection = useCallback(async () => {\n debugLog('🔄 REFRESH CONNECTION CALLED', {\n hasService: !!service,\n hasUser: !!user,\n })\n\n if (!service || !user) {\n debugLog('⚠️ REFRESH CONNECTION SKIPPED', 'Missing service or user')\n return\n }\n\n debugLog('🚀 STARTING CONNECTION REFRESH', { userId: user.id })\n setIsLoading(true)\n try {\n debugLog('🔌 DISCONNECTING FOR REFRESH')\n await service.disconnectUser()\n debugLog('📞 RECONNECTING FOR REFRESH')\n const streamClient = await service.connectUser(user)\n setClient(streamClient)\n setIsConnected(true)\n setError(null)\n debugLog('✅ CONNECTION REFRESH SUCCESS', { userId: user.id })\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Refresh failed'\n setError(errorMessage)\n debugLog('❌ CONNECTION REFRESH ERROR', {\n userId: user.id,\n error: errorMessage,\n })\n } finally {\n setIsLoading(false)\n debugLog('🔄 CONNECTION REFRESH FINISHED', { userId: user.id })\n }\n }, [service, user, debugLog])\n\n // Memoize context value to prevent unnecessary re-renders\n const contextValue: MessagingContextValue = React.useMemo(() => {\n debugLog('💫 CONTEXT VALUE MEMOIZATION', {\n hasService: !!service,\n hasClient: !!client,\n isConnected,\n isLoading,\n hasError: !!error,\n capabilitiesKeys: Object.keys(capabilities),\n customizationKeys: Object.keys(customization),\n })\n\n return {\n service,\n client,\n isConnected,\n isLoading,\n error,\n capabilities,\n customization,\n refreshConnection,\n debug,\n }\n }, [\n service,\n client,\n isConnected,\n isLoading,\n error,\n capabilities,\n customization,\n refreshConnection,\n debug,\n debugLog,\n ])\n\n debugLog('🔄 RENDER END', {\n renderCount: renderCountRef.current,\n willRenderChat: !!(client && isConnected),\n contextValueReady: !!contextValue,\n })\n\n return (\n <MessagingContext.Provider value={contextValue}>\n {client && isConnected ? (\n <Chat client={client}>{children}</Chat>\n ) : (\n children\n )}\n </MessagingContext.Provider>\n )\n}\n","import { useMessagingContext } from '../providers/MessagingProvider';\nimport type { MessagingContextValue } from '../providers/MessagingProvider';\n\n/**\n * Hook to access messaging service and state\n */\nexport const useMessaging = (): MessagingContextValue => {\n return useMessagingContext();\n};\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.baseStyleClasses = void 0;\nconst react_1 = __importDefault(require(\"react\"));\nconst classnames_1 = __importDefault(require(\"classnames\"));\nexports.baseStyleClasses = (0, classnames_1.default)('text-sm', 'h-2xl', 'block', 'p-md', 'w-full', 'rounded-sm', 'bg-chalk', 'text-black', 'transition', 'duration-75', 'ease-out', '!outline-none');\nconst Base = ({ className, onChange, onChangeValue, appearance = 'default', ...props }, ref) => {\n const baseInputStyles = appearance === 'none' ? 'appearance-none' : exports.baseStyleClasses;\n const handleChangeValue = ({ target: { value, checked } }) => {\n if (props.type === 'checkbox') {\n return onChangeValue?.(checked);\n }\n return onChangeValue?.(value);\n };\n return react_1.default.createElement('input', {\n ...props,\n className: (0, classnames_1.default)(className, baseInputStyles),\n onChange: onChange || (onChangeValue && handleChangeValue),\n ref\n });\n};\nexports.default = react_1.default.forwardRef(Base);\n//# sourceMappingURL=Base.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst jsx_runtime_1 = require(\"react/jsx-runtime\");\nconst react_1 = __importDefault(require(\"react\"));\nconst classnames_1 = __importDefault(require(\"classnames\"));\nconst Base_1 = __importDefault(require(\"../../Base\"));\nconst SelectPill = ({ id, name, label, className = '', checked, defaultChecked, inactive, value, tabIndex, icon, ...props }, ref) => {\n const selected = checked || defaultChecked;\n const isInactive = inactive || props?.disabled;\n const handleKeyDown = ({ key, code }) => {\n if (props.onChangeValue && (key === 'Enter' || code === 'Space'))\n props.onChangeValue?.(value);\n };\n return ((0, jsx_runtime_1.jsx)(\"div\", { className: (0, classnames_1.default)('inline-flex', 'first:ml-xs', 'max-w-full'), children: (0, jsx_runtime_1.jsxs)(\"label\", { htmlFor: id, tabIndex: tabIndex, className: (0, classnames_1.default)('w-fit', 'h-10', 'px-md', 'rounded-lg', 'inline-flex', 'justify-center', 'border', 'hover:ring-1', 'hover:ring-sand', 'relative', 'transition duration-75 ease-out', 'max-w-full', className, {\n 'pointer-events-none': isInactive,\n 'cursor-pointer': !isInactive,\n // Selected\n 'border-black': selected,\n 'bg-black': selected,\n // Not selected\n 'bg-white': !selected,\n 'border-sand': !selected,\n 'hover:border-sand': !selected\n }), children: [(0, jsx_runtime_1.jsx)(Base_1.default, { type: \"checkbox\", id: id, name: name, value: value, checked: checked, defaultChecked: defaultChecked, appearance: \"none\", className: (0, classnames_1.default)('cursor-pointer', 'outline-none', 'focus-visible:ring-2', 'focus-visible:ring-black', 'absolute', '-top-[3px]', 'left-4px', 'w-[calc(100%+6px)]', 'h-[calc(100%+6px)]', 'rounded-[48px]', 'transition duration-75 ease-out'), disabled: isInactive, onKeyDown: handleKeyDown, ref: ref, ...props }), (0, jsx_runtime_1.jsxs)(\"span\", { className: (0, classnames_1.default)('pointer-events-none', 'select-none', 'self-center', 'text-sm', 'flex', 'mt-[1px]', 'truncate', {\n 'text-pebble': isInactive,\n 'text-white': selected,\n 'text-black': !selected && !isInactive\n }), children: [icon && (0, jsx_runtime_1.jsx)(\"div\", { className: \"icon mr-xs self-center\", children: icon }), (0, jsx_runtime_1.jsx)(\"span\", { className: \"label\", children: label || name })] })] }) }));\n};\nexports.default = react_1.default.forwardRef(SelectPill);\n//# sourceMappingURL=SelectPill.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst jsx_runtime_1 = require(\"react/jsx-runtime\");\nconst react_1 = __importDefault(require(\"react\"));\nconst SelectPillGroup = ({ children, label, className = '' }, ref) => ((0, jsx_runtime_1.jsxs)(\"fieldset\", { className: `${className} -ml-xs space-x-xs space-y-xs`, ref: ref, children: [label && (0, jsx_runtime_1.jsx)(\"legend\", { className: \"mb-sm ml-sm text-sm font-semibold\", children: label }), children] }));\nexports.default = react_1.default.forwardRef(SelectPillGroup);\n//# sourceMappingURL=SelectPillGroup.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InputSelectPillGroup = exports.default = void 0;\nvar SelectPill_1 = require(\"./SelectPill\");\nObject.defineProperty(exports, \"default\", { enumerable: true, get: function () { return __importDefault(SelectPill_1).default; } });\nvar SelectPillGroup_1 = require(\"./SelectPillGroup\");\nObject.defineProperty(exports, \"InputSelectPillGroup\", { enumerable: true, get: function () { return __importDefault(SelectPillGroup_1).default; } });\n//# sourceMappingURL=index.js.map","import classNames from \"classnames\";\nimport React from \"react\";\n\ninterface IconButtonProps\n extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"type\" | \"children\"\n > {\n label: string;\n children: React.ReactNode;\n className?: string;\n}\n\nexport function IconButton({ label, className, children, ...rest }: IconButtonProps) {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"rounded-full p-2 transition-colors focus-ring\",\n {\n \"cursor-not-allowed opacity-50\": rest.disabled,\n \"hover:bg-sand\": !rest.disabled,\n },\n className,\n )}\n {...rest}\n >\n <span className=\"sr-only\">{label}</span>\n {children}\n </button>\n );\n}","/**\n * Generate a fruit emoji based on a string id\n * Returns a consistent fruit emoji for the same id\n */\nconst EMOJIS = [\n '🍎', // Apple\n '🍌', // Banana\n '🍇', // Grape\n '🍊', // Orange\n '🍓', // Strawberry\n '🥥', // Coconut\n '🍒', // Cherry\n '🥭', // Mango\n '🍉', // Watermelon\n '🍋', // Lemon\n '🥝', // Kiwi\n '🫒', // Olive\n '🍈', // Melon\n]\n\n/**\n * Simple hash function to convert string to number\n */\nfunction hashString(str: string): number {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash = hash & hash // Convert to 32-bit integer\n }\n return Math.abs(hash)\n}\n\n/**\n * Get a fruit emoji based on an id string\n * @param id - The string id to generate emoji from\n * @returns A fruit emoji string\n */\nexport function getAvatarEmoji(id: string): string {\n const hash = hashString(id)\n const index = hash % EMOJIS.length\n return EMOJIS[index]\n}\n\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport { getAvatarEmoji } from './getAvatarEmoji'\n\nexport interface AvatarProps {\n id: string\n name: string\n image?: string\n size?: number\n className?: string\n}\n\n/**\n * Avatar component that displays a user image or colored initial fallback\n */\nexport const Avatar: React.FC<AvatarProps> = ({\n id,\n image,\n size = 40,\n className,\n}) => {\n const emoji = getAvatarEmoji(id)\n\n const DEFAULT_COLOR = '#FBFAF9'\n // Determine font size based on avatar size\n const getFontSizeClass = () => {\n if (size < 32) return 'text-xs'\n if (size < 56) return 'text-sm'\n return 'text-lg'\n }\n\n const fontSizeClass = getFontSizeClass()\n\n return (\n <div\n className={classNames(\n 'flex-shrink-0 overflow-hidden rounded-lg',\n className\n )}\n style={{ width: `${size}px`, height: `${size}px` }}\n >\n {image ? (\n <img\n src={image}\n alt=\"\"\n className=\"h-full w-full object-cover aspect-square\"\n />\n ) : (\n <div\n aria-hidden=\"true\"\n className={classNames(\n 'flex h-full w-full items-center justify-center font-semibold rounded-sm',\n fontSizeClass\n )}\n style={{\n color: DEFAULT_COLOR,\n backgroundColor: `color-mix(in srgb, ${DEFAULT_COLOR} 60%, solid)`,\n }}\n >\n {emoji}\n </div>\n )}\n </div>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\nimport { Channel } from 'stream-chat'\nimport { ChannelPreviewUIComponentProps } from 'stream-chat-react'\n\nimport { Avatar } from '../Avatar'\n\n/**\n * Custom channel preview that handles selection\n */\nconst CustomChannelPreview: React.FC<\n ChannelPreviewUIComponentProps & {\n selectedChannel?: Channel | null\n onChannelSelect: (channel: Channel) => void\n debug?: boolean\n }\n> = ({ channel, selectedChannel, onChannelSelect, debug = false, unread }) => {\n const isSelected = selectedChannel?.id === channel?.id\n\n const handleClick = () => {\n if (channel) {\n onChannelSelect(channel)\n }\n }\n\n // Get participant info\n const members = Object.values(channel?.state?.members || {})\n const participant = members.find(\n (member) => member.user?.id && member.user.id !== channel?._client?.userID\n )\n const participantName = participant?.user?.name || 'Conversation'\n const participantImage = participant?.user?.image\n\n // Get last message and format timestamp\n const lastMessage =\n channel?.state?.messages?.[channel.state.messages.length - 1]\n const lastMessageText = lastMessage?.text || 'No messages yet'\n const lastMessageTime = lastMessage?.created_at\n ? new Date(lastMessage.created_at).toLocaleTimeString([], {\n hour: '2-digit',\n minute: '2-digit',\n })\n : ''\n\n // Use the unread prop passed by Stream Chat (reactive and updates automatically)\n const unreadCount = unread ?? 0\n\n if (debug) {\n console.log('📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER', {\n channelId: channel?.id,\n isSelected,\n participantName,\n unreadCount,\n hasTimestamp: !!lastMessageTime,\n })\n }\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={classNames(\n 'w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring',\n {\n 'bg-primary-alt/10 border-l-4 border-l-primary': isSelected,\n 'hover:bg-sand': !isSelected,\n }\n )}\n >\n <div className=\"flex items-start gap-3\">\n {/* Avatar */}\n <Avatar\n id={participant?.user?.id || channel.id || 'unknown'}\n name={participantName}\n image={participantImage}\n size={44}\n />\n\n {/* Content column */}\n <div className=\"flex-1 min-w-0 flex flex-col gap-1\">\n {/* Name and timestamp row */}\n <div className=\"flex items-center justify-between gap-2\">\n <h3\n className={classNames(\n 'text-sm font-medium truncate',\n isSelected ? 'text-primary' : 'text-charcoal'\n )}\n >\n {participantName}\n </h3>\n {lastMessageTime && (\n <span className=\"text-xs text-stone flex-shrink-0\">\n {lastMessageTime}\n </span>\n )}\n </div>\n\n {/* Message and unread badge row */}\n <div className=\"flex items-center justify-between gap-2 min-w-0\">\n <p className=\"text-xs text-stone mr-2 flex-1 line-clamp-2\">\n {lastMessageText}\n </p>\n {unreadCount > 0 && (\n <span className=\"bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n </div>\n </div>\n </div>\n </button>\n )\n}\n\nexport default CustomChannelPreview\n","import SelectPill from '@linktr.ee/component-library/InputSelectPill'\nimport SelectPillGroup from '@linktr.ee/component-library/InputSelectPillGroup'\nimport { NotePencilIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\nimport {\n ChannelList as StreamChannelList,\n useChatContext,\n} from 'stream-chat-react'\n\nimport { useMessagingContext } from '../../providers/MessagingProvider'\nimport type { ChannelListProps } from '../../types'\nimport { IconButton } from '../IconButton'\n\nimport CustomChannelPreview from './CustomChannelPreview'\n\nenum ChannelFilter {\n All,\n Unread,\n}\n\n/**\n * Channel list component with customizable header and actions\n */\nexport const ChannelList: React.FC<ChannelListProps> = ({\n onChannelSelect,\n selectedChannel,\n showStartConversation = false,\n onStartConversation,\n participantLabel = 'participants',\n className,\n}) => {\n // Track renders\n const renderCountRef = React.useRef(0)\n renderCountRef.current++\n\n // Get debug flag from context\n const { debug = false } = useMessagingContext()\n\n if (debug) {\n console.log('📺 [ChannelList] 🔄 RENDER START', {\n renderCount: renderCountRef.current,\n selectedChannelId: selectedChannel?.id,\n showStartConversation,\n participantLabel,\n })\n }\n\n const { client } = useChatContext()\n\n if (debug) {\n console.log('📺 [ChannelList] 📡 CHAT CONTEXT', {\n renderCount: renderCountRef.current,\n hasClient: !!client,\n clientUserId: client?.userID,\n clientConnected: client?.wsConnection?.isHealthy,\n })\n }\n\n const [staticFilters, setStaticFilters] = useState<{\n type: string\n last_message_at: { $exists: boolean }\n has_unread: boolean | undefined\n }>({\n type: 'messaging',\n last_message_at: { $exists: true },\n has_unread: undefined,\n })\n\n // Filter for messaging channels\n const filters = React.useMemo(() => {\n const userId = client.userID\n\n const newFilters = {\n ...staticFilters,\n ...(userId && {\n members: { $in: [userId] },\n hidden: false,\n }),\n }\n\n if (debug) {\n console.log('📺 [ChannelList] 🔍 FILTERS MEMOIZED', {\n renderCount: renderCountRef.current,\n userId,\n filters: newFilters,\n })\n }\n\n return newFilters\n }, [client.userID, debug, staticFilters])\n\n return (\n <div\n className={classNames(\n 'messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden',\n className\n )}\n >\n {/* Header */}\n <div className=\"px-4 py-4 border-b border-sand bg-chalk\">\n <div className=\"flex items-center justify-between gap-3 min-h-10 min-w-0\">\n <div>\n <h2 className=\"text-lg font-semibold text-charcoal\">\n Conversations\n </h2>\n <SelectPillGroup>\n <SelectPill\n checked={!filters.has_unread}\n name=\"All\"\n onChange={() =>\n setStaticFilters((state) => ({\n ...state,\n has_unread: undefined,\n }))\n }\n value={ChannelFilter.All}\n />\n <SelectPill\n checked={filters.has_unread}\n name=\"Unread\"\n onChange={() =>\n setStaticFilters((state) => ({ ...state, has_unread: true }))\n }\n value={ChannelFilter.Unread}\n />\n </SelectPillGroup>\n </div>\n <div className=\"flex items-center gap-2\">\n {showStartConversation && onStartConversation && (\n <IconButton\n label=\"Start a new conversation\"\n onClick={onStartConversation}\n className=\"inline-flex size-10 items-center justify-center\"\n >\n <NotePencilIcon className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n </div>\n </div>\n\n {/* Channel List */}\n <div className=\"flex-1 overflow-hidden min-w-0\">\n {(() => {\n if (debug) {\n console.log('📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST', {\n renderCount: renderCountRef.current,\n filters,\n hasClient: !!client,\n clientUserId: client?.userID,\n })\n }\n\n return (\n <StreamChannelList\n filters={filters}\n sort={{ last_message_at: -1 }}\n options={{ limit: 30 }}\n Preview={(props) => {\n if (debug) {\n console.log('📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER', {\n channelId: props.channel?.id,\n selectedChannelId: selectedChannel?.id,\n isSelected: selectedChannel?.id === props.channel?.id,\n })\n }\n\n return (\n <CustomChannelPreview\n {...props}\n selectedChannel={selectedChannel}\n onChannelSelect={onChannelSelect}\n debug={debug}\n />\n )\n }}\n />\n )\n })()}\n </div>\n </div>\n )\n}\n","import classNames from \"classnames\";\nimport React from \"react\";\n\ninterface ActionButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"danger\";\n}\n\nconst ActionButton = ({\n variant = \"default\",\n className,\n children,\n ...rest\n}: ActionButtonProps) => {\n const isDanger = variant === \"danger\";\n return (\n <button\n type=\"button\"\n className={classNames(\n \"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\",\n isDanger\n ? \"text-danger hover:bg-danger/50\"\n : \"text-charcoal hover:bg-sand\",\n className,\n )}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nexport default ActionButton;\n","import { XIcon } from '@phosphor-icons/react'\n\nimport { IconButton } from '../IconButton'\n\ninterface CloseButtonProps {\n onClick: () => void\n}\n\nexport function CloseButton({ onClick }: CloseButtonProps) {\n return (\n <IconButton label=\"Close\" onClick={onClick} className=\"p-1\">\n <XIcon className=\"h-5 w-5 text-stone\" weight=\"bold\" />\n </IconButton>\n )\n}\n","import React from 'react'\n\n/**\n * Empty state component shown when a channel has no messages\n */\nexport const ChannelEmptyState: React.FC = () => (\n <div className=\"messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance\">\n <div className=\"text-center max-w-sm\">\n <h2 className=\"font-semibold text-charcoal mb-2\">No messages yet 👀</h2>\n\n <p className=\"text-stone text-xs\">\n Share to social media to generate more conversations\n </p>\n </div>\n </div>\n)\n\n","import {\n ArrowLeftIcon,\n DotsThreeIcon,\n FlagIcon,\n ProhibitInsetIcon,\n SignOutIcon,\n SpinnerGapIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState, useCallback, useRef, useEffect } from 'react'\nimport { Channel as ChannelType, ChannelMemberResponse } from 'stream-chat'\nimport {\n Channel,\n Window,\n MessageList,\n MessageInput,\n useChannelStateContext,\n} from 'stream-chat-react'\n\nimport { useMessagingContext } from '../providers/MessagingProvider'\nimport type { ChannelViewProps } from '../types'\n\nimport ActionButton from './ActionButton'\nimport { Avatar } from './Avatar'\nimport { CloseButton } from './CloseButton'\nimport { IconButton } from './IconButton'\nimport { ChannelEmptyState } from './MessagingShell/ChannelEmptyState'\n\n// Custom user type with email and username\ntype CustomUser = {\n email?: string\n username?: string\n}\n\n// Blocked user from Stream Chat API\ntype BlockedUser = {\n blocked_user_id: string\n}\n\n/**\n * Custom message input component with render prop for actions\n */\nconst CustomMessageInput: React.FC<{\n renderActions?: () => React.ReactNode\n}> = ({ renderActions }) => (\n <div className=\"message-input flex items-center gap-2 p-4\">\n {renderActions && renderActions()}\n\n <div className=\"flex-1\">\n <MessageInput focus maxRows={4} />\n </div>\n </div>\n)\n\n/**\n * Custom channel header component\n */\nconst CustomChannelHeader: React.FC<{\n onBack?: () => void\n showBackButton: boolean\n onShowInfo?: () => void\n canShowInfo: boolean\n}> = ({ onBack, showBackButton, onShowInfo, canShowInfo }) => {\n const { channel } = useChannelStateContext()\n\n // Get participant info (excluding current user)\n const participant = React.useMemo(() => {\n const members = Object.values(channel.state.members || {})\n return members.find(\n (member) => member.user?.id && member.user.id !== channel._client.userID\n )\n }, [channel._client.userID, channel.state.members])\n\n const participantName =\n participant?.user?.name || participant?.user?.id || 'Unknown member'\n const participantImage = participant?.user?.image\n\n return (\n <div className=\"flex items-center justify-between gap-3 min-h-12\">\n <div className=\"flex items-center gap-3 min-w-0\">\n {showBackButton && onBack && (\n <button\n type=\"button\"\n onClick={onBack}\n 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\"\n aria-label=\"Back to conversations\"\n >\n <ArrowLeftIcon className=\"h-5 w-5 text-stone\" weight=\"bold\" />\n </button>\n )}\n\n {/* Avatar */}\n <Avatar\n id={participant?.user?.id || channel.id || 'unknown'}\n name={participantName}\n image={participantImage}\n size={40}\n />\n\n <div className=\"min-w-0\">\n <h1 className=\"text-lg font-semibold text-charcoal truncate\">\n {participantName}\n </h1>\n </div>\n </div>\n\n {canShowInfo && onShowInfo && (\n <IconButton label=\"Chat info\" onClick={onShowInfo}>\n <DotsThreeIcon className=\"h-6 w-6 text-charcoal\" weight=\"bold\" />\n </IconButton>\n )}\n </div>\n )\n}\n\n/**\n * Channel info dialog (matching original implementation)\n */\nconst ChannelInfoDialog: React.FC<{\n isOpen: boolean\n onClose: () => void\n participant: ChannelMemberResponse | undefined\n channel: ChannelType\n followerStatusLabel?: string\n onLeaveConversation?: (channel: ChannelType) => void\n onBlockParticipant?: (participantId?: string) => void\n}> = ({\n isOpen,\n onClose,\n participant,\n channel,\n followerStatusLabel,\n onLeaveConversation,\n onBlockParticipant,\n}) => {\n const { service, debug } = useMessagingContext()\n const dialogRef = useRef<HTMLDialogElement>(null)\n const [isParticipantBlocked, setIsParticipantBlocked] = useState(false)\n const [isLeaving, setIsLeaving] = useState(false)\n const [isUpdatingBlockStatus, setIsUpdatingBlockStatus] = useState(false)\n\n // Sync dialog open state with prop\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n if (isOpen) {\n dialog.showModal()\n } else {\n dialog.close()\n }\n }, [isOpen])\n\n // Check if participant is blocked\n const checkIsParticipantBlocked = useCallback(async () => {\n if (!service || !participant?.user?.id) return\n\n try {\n const blockedUsers = await service.getBlockedUsers()\n const isBlocked = blockedUsers.some(\n (user: BlockedUser) => user.blocked_user_id === participant?.user?.id\n )\n setIsParticipantBlocked(isBlocked)\n } catch (error) {\n console.error(\n '[ChannelInfoDialog] Failed to check blocked status:',\n error\n )\n }\n }, [service, participant?.user?.id])\n\n useEffect(() => {\n if (isOpen) {\n checkIsParticipantBlocked()\n }\n }, [isOpen, checkIsParticipantBlocked])\n\n const handleLeaveConversation = async () => {\n if (isLeaving) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Leave conversation', channel.cid)\n }\n setIsLeaving(true)\n\n try {\n const actingUserId = channel._client?.userID ?? null\n await channel.hide(actingUserId, false)\n\n if (onLeaveConversation) {\n await onLeaveConversation(channel)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to leave conversation', error)\n } finally {\n setIsLeaving(false)\n }\n }\n\n const handleBlockUser = async () => {\n if (isUpdatingBlockStatus || !service) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Block member', participant?.user?.id)\n }\n setIsUpdatingBlockStatus(true)\n\n try {\n await service.blockUser(participant?.user?.id)\n\n if (onBlockParticipant) {\n await onBlockParticipant(participant?.user?.id)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to block member', error)\n } finally {\n setIsUpdatingBlockStatus(false)\n }\n }\n\n const handleUnblockUser = async () => {\n if (isUpdatingBlockStatus || !service) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Unblock member', participant?.user?.id)\n }\n setIsUpdatingBlockStatus(true)\n\n try {\n await service.unBlockUser(participant?.user?.id)\n\n if (onBlockParticipant) {\n await onBlockParticipant(participant?.user?.id)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to unblock member', error)\n } finally {\n setIsUpdatingBlockStatus(false)\n }\n }\n\n const handleReportUser = () => {\n onClose()\n window.open(\n 'https://linktr.ee/s/about/trust-center/report',\n '_blank',\n 'noopener,noreferrer'\n )\n }\n\n if (!participant) return null\n\n const participantName =\n participant.user?.name || participant.user?.id || 'Unknown member'\n const participantImage = participant.user?.image\n const participantEmail = (participant.user as CustomUser)?.email\n const participantUsername = (participant.user as CustomUser)?.username\n const participantSecondary = participantEmail\n ? participantEmail\n : participantUsername\n ? `linktr.ee/${participantUsername}`\n : undefined\n const participantId = participant.user?.id || 'unknown'\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n ref={dialogRef}\n className=\"mes-dialog\"\n onClose={onClose}\n onClick={(e) => {\n if (e.target === dialogRef.current) {\n onClose()\n }\n }}\n >\n <div className=\"ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light\">\n <div className=\"flex items-center justify-between border-b border-sand px-4 py-3\">\n <h2 className=\"text-base font-semibold text-charcoal\">Chat info</h2>\n <CloseButton onClick={onClose} />\n </div>\n\n <div className=\"flex-1 px-2 overflow-y-auto w-full\">\n <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' }}>\n <div className=\"flex items-center gap-3 w-full\">\n <Avatar\n id={participantId}\n name={participantName}\n image={participantImage}\n size={88}\n className=\"!rounded-full\"\n />\n <div className=\"flex flex-col min-w-0 flex-1\">\n <p className=\"truncate text-base font-semibold text-charcoal\">\n {participantName}\n </p>\n {participantSecondary && (\n <p className=\"truncate text-sm text-[#00000055]\">\n {participantSecondary}\n </p>\n )}\n {followerStatusLabel && (\n <span\n className=\"mt-1 rounded-full text-xs font-normal w-fit\"\n style={{\n padding: '4px 8px',\n backgroundColor: followerStatusLabel === 'Subscribed to you' ? '#DCFCE7' : '#F5F5F4',\n color: followerStatusLabel === 'Subscribed to you' ? '#008236' : '#78716C',\n lineHeight: '133.333%',\n letterSpacing: '0.21px',\n }}\n >\n {followerStatusLabel}\n </span>\n )}\n </div>\n </div>\n </div>\n\n <ul className=\"flex flex-col gap-2 mt-2\">\n <li>\n <ActionButton\n onClick={handleLeaveConversation}\n disabled={isLeaving}\n aria-busy={isLeaving}\n >\n {isLeaving ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <SignOutIcon className=\"h-5 w-5\" />\n )}\n <span>Leave Conversation</span>\n </ActionButton>\n </li>\n <li>\n {isParticipantBlocked ? (\n <ActionButton\n onClick={handleUnblockUser}\n disabled={isUpdatingBlockStatus}\n aria-busy={isUpdatingBlockStatus}\n >\n {isUpdatingBlockStatus ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <ProhibitInsetIcon className=\"h-5 w-5\" />\n )}\n <span>Unblock</span>\n </ActionButton>\n ) : (\n <ActionButton\n onClick={handleBlockUser}\n disabled={isUpdatingBlockStatus}\n aria-busy={isUpdatingBlockStatus}\n >\n {isUpdatingBlockStatus ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <ProhibitInsetIcon className=\"h-5 w-5\" />\n )}\n <span>Block</span>\n </ActionButton>\n )}\n </li>\n <li>\n <ActionButton variant=\"danger\" onClick={handleReportUser}>\n <FlagIcon className=\"h-5 w-5\" />\n <span>Report</span>\n </ActionButton>\n </li>\n </ul>\n </div>\n </div>\n </dialog>\n )\n}\n\n/**\n * Inner component that has access to channel context\n */\nconst ChannelViewInner: React.FC<{\n onBack?: () => void\n showBackButton: boolean\n renderMessageInputActions?: (channel: ChannelType) => React.ReactNode\n onLeaveConversation?: (channel: ChannelType) => void\n onBlockParticipant?: (participantId?: string) => void\n CustomChannelEmptyState?: React.ComponentType\n}> = ({\n onBack,\n showBackButton,\n renderMessageInputActions,\n onLeaveConversation,\n onBlockParticipant,\n CustomChannelEmptyState = ChannelEmptyState,\n}) => {\n const { channel } = useChannelStateContext()\n const [showInfo, setShowInfo] = useState(false)\n\n // Check if channel has messages - using context to reactively subscribe to message updates\n const hasMessages = (channel?.state?.messages?.length ?? 0) > 0\n\n // Get participant info for info dialog\n const participant = React.useMemo(() => {\n const members = Object.values(channel.state.members || {})\n return members.find(\n (member) => member.user?.id && member.user.id !== channel._client.userID\n )\n }, [channel._client.userID, channel.state.members])\n\n // Get follower status label from channel data\n const followerStatusLabel = React.useMemo(() => {\n const channelExtraData = (channel.data ?? {}) as {\n followerStatus?: string\n isFollower?: boolean\n }\n \n // If explicit followerStatus is provided, use it\n if (channelExtraData.followerStatus) {\n return String(channelExtraData.followerStatus)\n }\n // If isFollower is explicitly defined, use it to determine status\n if (channelExtraData.isFollower !== undefined) {\n return channelExtraData.isFollower ? 'Subscribed to you' : 'Not subscribed'\n }\n // Otherwise, don't show any status\n return undefined\n }, [channel.data])\n\n return (\n <>\n <Window>\n {/* Custom Channel Header */}\n <div className=\"border-b border-sand bg-white px-4 py-3\">\n <CustomChannelHeader\n onBack={onBack}\n showBackButton={showBackButton}\n onShowInfo={() => setShowInfo(true)}\n canShowInfo={Boolean(participant)}\n />\n </div>\n\n {/* Message List */}\n <div className=\"flex-1 overflow-hidden relative\">\n <MessageList hideDeletedMessages hideNewMessageSeparator={false} />\n\n {/* Show custom empty state when no messages */}\n {!hasMessages && CustomChannelEmptyState && (\n <div className=\"absolute inset-0 w-full h-full bg-white\">\n <CustomChannelEmptyState />\n </div>\n )}\n </div>\n\n {/* Message Input */}\n <CustomMessageInput\n renderActions={() => renderMessageInputActions?.(channel)}\n />\n </Window>\n\n {/* Channel Info Dialog */}\n <ChannelInfoDialog\n isOpen={showInfo}\n onClose={() => setShowInfo(false)}\n participant={participant}\n channel={channel}\n followerStatusLabel={followerStatusLabel}\n onLeaveConversation={onLeaveConversation}\n onBlockParticipant={onBlockParticipant}\n />\n </>\n )\n}\n\n/**\n * Channel view component with message list and input\n */\nexport const ChannelView: React.FC<ChannelViewProps> = ({\n channel,\n onBack,\n showBackButton = false,\n renderMessageInputActions,\n onLeaveConversation,\n onBlockParticipant,\n className,\n CustomChannelEmptyState = ChannelEmptyState,\n}) => {\n return (\n <div\n className={classNames(\n 'messaging-channel-view h-full flex flex-col',\n className\n )}\n >\n <Channel channel={channel}>\n <ChannelViewInner\n onBack={onBack}\n showBackButton={showBackButton}\n renderMessageInputActions={renderMessageInputActions}\n onLeaveConversation={onLeaveConversation}\n onBlockParticipant={onBlockParticipant}\n CustomChannelEmptyState={CustomChannelEmptyState}\n />\n </Channel>\n </div>\n )\n}\n","import { MagnifyingGlassIcon, XIcon } from '@phosphor-icons/react'\nimport { useRef } from 'react'\n\nimport { IconButton } from '../IconButton'\n\ninterface SearchInputProps {\n searchQuery: string\n setSearchQuery: (value: string) => void\n placeholder: string\n}\n\nexport function SearchInput({\n searchQuery,\n setSearchQuery,\n placeholder,\n}: SearchInputProps) {\n const searchInputRef = useRef<HTMLInputElement>(null)\n\n return (\n <div className=\"relative\">\n <MagnifyingGlassIcon\n className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone\"\n weight=\"bold\"\n />\n\n <input\n ref={searchInputRef}\n type=\"text\"\n placeholder={placeholder}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent\"\n />\n\n {searchQuery && (\n <IconButton\n label=\"Clear search\"\n onClick={() => {\n setSearchQuery('')\n searchInputRef.current?.focus()\n }}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal\"\n >\n <XIcon className=\"h-4 w-4\" weight=\"bold\" />\n </IconButton>\n )}\n </div>\n )\n}\n","import { ChatCircleDotsIcon, SpinnerGapIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useCallback, useEffect, useState, useRef } from 'react'\n\nimport { useMessagingContext } from '../../providers/MessagingProvider'\nimport type { ParticipantPickerProps, Participant } from '../../types'\nimport { Avatar } from '../Avatar'\nimport { CloseButton } from '../CloseButton'\nimport { SearchInput } from '../SearchInput'\n\n/**\n * Generic participant picker component for starting conversations\n */\nexport const ParticipantPicker: React.FC<ParticipantPickerProps> = ({\n participantSource,\n onSelectParticipant,\n onClose,\n existingParticipantIds = new Set(),\n participantLabel = 'participants',\n searchPlaceholder = 'Search participants...',\n className,\n}) => {\n const { debug } = useMessagingContext()\n const [searchQuery, setSearchQuery] = useState('')\n const [participants, setParticipants] = useState<Participant[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [startingChatWithId, setStartingChatWithId] = useState<string | null>(\n null\n )\n\n // Track if we've already loaded participants to prevent repeated loading\n const loadedRef = useRef(false)\n\n // Load participants initially - wait for participantSource to finish loading first\n useEffect(() => {\n // Wait for the participantSource to finish loading before we try to load participants\n if (participantSource.loading) {\n if (debug) {\n console.log(\n '[ParticipantPicker] Waiting for participant source to finish loading...'\n )\n }\n return\n }\n\n if (loadedRef.current) return // Prevent multiple loads\n\n const loadInitialParticipants = async () => {\n if (debug) {\n console.log('[ParticipantPicker] Loading initial participants...')\n }\n setLoading(true)\n setError(null)\n\n try {\n const result = await participantSource.loadParticipants({\n search: '', // Load all participants initially\n limit: 100,\n })\n setParticipants(result.participants)\n loadedRef.current = true // Mark as loaded\n if (debug) {\n console.log(\n '[ParticipantPicker] Participants loaded successfully:',\n result.participants.length\n )\n }\n } catch (err) {\n const errorMessage =\n err instanceof Error ? err.message : 'Failed to load participants'\n setError(errorMessage)\n console.error('[ParticipantPicker] Failed to load participants:', err)\n // Don't mark as loaded on error, allow retry\n } finally {\n setLoading(false)\n }\n }\n\n loadInitialParticipants()\n }, [participantSource.loading, debug]) // Re-run when loading state changes\n\n // Filter participants by search query and existing participants\n const availableParticipants = participants\n .filter((participant) => !existingParticipantIds.has(participant.id))\n .filter((participant) => {\n if (!searchQuery) return true\n const searchLower = searchQuery.toLowerCase()\n return (\n participant.name.toLowerCase().includes(searchLower) ||\n participant.email?.toLowerCase().includes(searchLower) ||\n false\n )\n })\n\n const handleSelectParticipant = useCallback(\n async (participant: Participant) => {\n if (startingChatWithId) return // Prevent multiple clicks\n\n setStartingChatWithId(participant.id)\n try {\n await onSelectParticipant(participant)\n } catch (error) {\n console.error('[ParticipantPicker] Failed to start chat:', error)\n // Reset the loading state on error\n setStartingChatWithId(null)\n }\n // Note: Don't reset startingChatWithId on success because the dialog will close\n },\n [onSelectParticipant, startingChatWithId]\n )\n\n const handleKeyDown = (\n event: React.KeyboardEvent,\n participant: Participant\n ) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n handleSelectParticipant(participant)\n }\n }\n\n return (\n <div className={classNames('flex flex-col h-full', className)}>\n {/* Header */}\n <div className=\"px-4 py-4 border-b border-sand bg-chalk\">\n <div className=\"flex items-center justify-between mb-3\">\n <h2 className=\"text-lg font-semibold text-charcoal\">\n Start a new Conversation\n </h2>\n <CloseButton onClick={onClose} />\n </div>\n\n <p className=\"text-xs text-stone mb-3\">\n Select a {participantLabel.slice(0, -1)} to start messaging (\n {availableParticipants.length} available)\n {participantSource.totalCount !== undefined &&\n ` • ${participantSource.totalCount} ${participantLabel} total`}\n </p>\n\n <SearchInput\n searchQuery={searchQuery}\n setSearchQuery={setSearchQuery}\n placeholder={searchPlaceholder}\n />\n </div>\n\n {/* Error State */}\n {error && (\n <div className=\"p-4 text-sm text-danger bg-danger-alt\">\n Error loading {participantLabel}: {error}\n </div>\n )}\n\n {/* Participants List */}\n <div className=\"flex-1 overflow-auto\">\n {loading && availableParticipants.length === 0 ? (\n <div className=\"h-32 flex items-center justify-center\">\n <div className=\"flex items-center space-x-2\">\n <div className=\"w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent\"></div>\n <span className=\"text-sm text-stone\">\n Loading {participantLabel}...\n </span>\n </div>\n </div>\n ) : availableParticipants.length === 0 ? (\n <div className=\"p-6 text-center\">\n <div className=\"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand\">\n <ChatCircleDotsIcon className=\"h-8 w-8 text-charcoal\" />\n </div>\n <h3 className=\"text-sm font-semibold text-charcoal mb-2\">\n {searchQuery\n ? `No ${participantLabel} found`\n : participants.length > 0\n ? `Already chatting with all ${participantLabel}`\n : `No ${participantLabel} yet`}\n </h3>\n <p className=\"text-xs text-stone\">\n {searchQuery\n ? 'Try a different search term'\n : participants.length > 0\n ? `You have existing conversations with all your ${participantLabel}`\n : `${participantLabel.charAt(0).toUpperCase() + participantLabel.slice(1)} will appear here`}\n </p>\n </div>\n ) : (\n <ul className=\"space-y-0\">\n {availableParticipants.map((participant) => {\n const displayName =\n participant.name || participant.email || participant.id\n const displaySecondary =\n participant.email && participant.name\n ? participant.email\n : participant.phone\n\n return (\n <li key={participant.id}>\n <button\n type=\"button\"\n onClick={() => handleSelectParticipant(participant)}\n onKeyDown={(e) => handleKeyDown(e, participant)}\n 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\"\n >\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center space-x-3 flex-1 min-w-0\">\n {/* Avatar */}\n <Avatar\n id={participant.id}\n name={displayName}\n image={participant.image}\n size={40}\n />\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-medium text-charcoal truncate\">\n {displayName}\n </h4>\n {displaySecondary && (\n <p className=\"text-xs text-stone truncate\">\n {displaySecondary}\n </p>\n )}\n </div>\n </div>\n\n {/* Icon */}\n <div className=\"flex-shrink-0\">\n {startingChatWithId === participant.id ? (\n <SpinnerGapIcon className=\"h-5 w-5 text-primary animate-spin\" />\n ) : (\n <ChatCircleDotsIcon className=\"h-5 w-5 text-stone\" />\n )}\n </div>\n </div>\n </button>\n </li>\n )\n })}\n\n {/* Loading indicator */}\n {loading && (\n <li className=\"p-4 flex justify-center\">\n <div className=\"flex items-center space-x-2\">\n <div className=\"w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent\"></div>\n <span className=\"text-sm text-stone\">Loading more...</span>\n </div>\n </li>\n )}\n </ul>\n )}\n </div>\n </div>\n )\n}\n","import React from 'react'\n\n/**\n * Empty state component shown when no channel is selected\n */\nexport const EmptyState: React.FC<{\n hasChannels: boolean\n onStartConversation?: () => void\n participantLabel: string\n}> = ({ hasChannels, onStartConversation, participantLabel }) => (\n <div className=\"messaging-empty-state flex items-center justify-center h-full p-8 text-balance\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6\">\n <span className=\"text-4xl\">💬</span>\n </div>\n\n <h2 className=\"font-semibold text-charcoal\">Welcome to Messages</h2>\n\n <p className=\"text-stone text-sm mb-6\">\n {hasChannels ? (\n <>\n Choose a conversation from the list or{' '}\n {onStartConversation && (\n <TextButton onClick={onStartConversation}>\n start a new conversation with a {participantLabel.slice(0, -1)}.\n </TextButton>\n )}\n </>\n ) : (\n onStartConversation && (\n <>\n <TextButton onClick={onStartConversation}>\n Start a new conversation with one of your {participantLabel}\n </TextButton>{' '}\n to begin messaging.\n </>\n )\n )}\n </p>\n </div>\n </div>\n)\n\nconst TextButton = ({\n onClick,\n children,\n}: {\n onClick: () => void\n children: React.ReactNode\n}) => (\n <button\n type=\"button\"\n onClick={onClick}\n 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\"\n >\n {children}\n </button>\n)\n","import React from 'react'\n\n/**\n * Error state component shown when something goes wrong\n */\nexport const ErrorState: React.FC<{\n message: string\n onBack?: () => void\n}> = ({ message, onBack }) => (\n <div className=\"messaging-error-state flex items-center justify-center h-full p-8\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6\">\n <span className=\"text-4xl\">⚠️</span>\n </div>\n\n <h2 className=\"font-semibold text-charcoal mb-2\">Oops!</h2>\n\n <p className=\"text-stone text-sm mb-6\">{message}</p>\n\n {onBack && (\n <button\n type=\"button\"\n onClick={onBack}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-primary hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors\"\n >\n Go Back\n </button>\n )}\n </div>\n </div>\n)\n","import classNames from 'classnames'\n\ntype LoadingProps = {\n className?: string\n message?: string\n}\n\nconst Loading = ({ className, message }: LoadingProps) => (\n <div\n className={classNames('flex items-center justify-center h-full', className)}\n >\n <svg viewBox=\"0 0 100 100\" className=\"size-8 fill-pebble\" stroke=\"none\">\n <circle cx=\"6\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 15 ; 0 -15; 0 15\"\n repeatCount=\"indefinite\"\n begin=\"0.1\"\n />\n </circle>\n <circle cx=\"30\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 10 ; 0 -10; 0 10\"\n repeatCount=\"indefinite\"\n begin=\"0.2\"\n />\n </circle>\n <circle cx=\"54\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 5 ; 0 -5; 0 5\"\n repeatCount=\"indefinite\"\n begin=\"0.3\"\n />\n </circle>\n </svg>\n {message && <span className=\"text-stone\">{message}</span>}\n </div>\n)\n\nexport default Loading\n","import Loading from '../Loading'\n\n/**\n * Loading state component\n */\nexport const LoadingState = () => (\n <div className=\"messaging-loading-state flex items-center justify-center h-full\">\n <div className=\"flex items-center\">\n <Loading className=\"w-6 h-6\" />\n <span className=\"text-sm text-stone\">Loading messages</span>\n </div>\n </div>\n)\n","import classNames from 'classnames'\nimport React, { useState, useCallback, useRef, useEffect } from 'react'\nimport type { Channel } from 'stream-chat'\n\nimport { useMessaging } from '../../hooks/useMessaging'\nimport type { MessagingShellProps, Participant } from '../../types'\nimport { ChannelList } from '../ChannelList'\nimport { ChannelView } from '../ChannelView'\nimport { ParticipantPicker } from '../ParticipantPicker'\n\nimport { EmptyState } from './EmptyState'\nimport { ErrorState } from './ErrorState'\nimport { LoadingState } from './LoadingState'\n\n/**\n * Main messaging interface component that combines channel list and channel view\n */\nexport const MessagingShell: React.FC<MessagingShellProps> = ({\n capabilities = {},\n className,\n renderMessageInputActions,\n onChannelSelect,\n onParticipantSelect,\n initialParticipantFilter,\n initialParticipantData,\n CustomChannelEmptyState,\n showChannelList = true,\n}) => {\n const {\n service,\n client,\n isConnected,\n isLoading,\n error,\n refreshConnection,\n debug,\n } = useMessaging()\n\n const [selectedChannel, setSelectedChannel] = useState<Channel | null>(null)\n const [hasChannels, setHasChannels] = useState(false)\n const [_showParticipantPicker, setShowParticipantPicker] = useState(false)\n const [existingParticipantIds, setExistingParticipantIds] = useState<\n Set<string>\n >(new Set())\n const [pickerKey, setPickerKey] = useState(0) // Key to force remount of ParticipantPicker\n const [directConversationMode, setDirectConversationMode] = useState(false)\n const [directConversationError, setDirectConversationError] = useState<\n string | null\n >(null)\n\n const participantPickerRef = useRef<HTMLDialogElement>(null)\n\n const {\n showStartConversation = false,\n participantSource,\n participantLabel = 'participants',\n } = capabilities\n\n // Track if we've already synced channels to prevent repeated API calls\n const syncedRef = useRef<string | null>(null)\n\n // Function to sync channels (extracted for reuse)\n const syncChannels = useCallback(async () => {\n if (!client || !isConnected) return\n\n const userId = client.userID\n if (!userId) return\n\n try {\n if (debug) {\n console.log('[MessagingShell] Syncing channels for user:', userId)\n }\n\n const channels = await client.queryChannels(\n {\n type: 'messaging',\n members: { $in: [userId] },\n },\n {},\n { limit: 100 }\n )\n\n const memberIds = new Set<string>()\n channels.forEach((channel: Channel) => {\n const members = channel.state.members\n Object.values(members).forEach((member) => {\n const memberId = member.user?.id\n if (memberId && memberId !== userId) {\n memberIds.add(memberId)\n }\n })\n })\n\n setExistingParticipantIds(memberIds)\n setHasChannels(channels.length > 0)\n syncedRef.current = userId // Mark as synced for this user\n\n if (debug) {\n console.log('[MessagingShell] Channels synced successfully:', {\n channelCount: channels.length,\n memberCount: memberIds.size,\n })\n }\n } catch (error) {\n console.error('[MessagingShell] Failed to sync channels:', error)\n // Don't mark as synced on error, allow retry\n }\n }, [client, isConnected, debug])\n\n // Sync existing channels to track which participants we can already message\n useEffect(() => {\n if (!client || !isConnected) return\n\n const userId = client.userID\n if (!userId) return\n\n // Prevent repeated sync for the same user\n if (syncedRef.current === userId) return\n\n syncChannels()\n }, [client, isConnected, syncChannels])\n\n // Load initial channel for direct conversation mode\n useEffect(() => {\n if (!initialParticipantFilter || !client || !isConnected) return\n\n const loadInitialChannel = async () => {\n const userId = client.userID\n if (!userId) return\n\n try {\n if (debug) {\n console.log(\n '[MessagingShell] Loading initial conversation with:',\n initialParticipantFilter\n )\n }\n\n const channels = await client.queryChannels(\n {\n type: 'messaging',\n members: { $eq: [userId, initialParticipantFilter] },\n },\n {},\n { limit: 1 }\n )\n\n if (channels.length > 0) {\n setSelectedChannel(channels[0])\n setDirectConversationMode(true)\n setDirectConversationError(null)\n\n // Notify parent component of channel selection\n if (onChannelSelect) {\n onChannelSelect(channels[0])\n }\n\n if (debug) {\n console.log(\n '[MessagingShell] Initial conversation loaded:',\n channels[0].id\n )\n }\n } else {\n // No channel found - try to create one if participant data is provided\n if (initialParticipantData && service) {\n if (debug) {\n console.log(\n '[MessagingShell] No conversation found, creating one for:',\n initialParticipantData\n )\n }\n\n try {\n // Use the existing service method to create the channel\n const channel = await service.startChannelWithParticipant({\n id: initialParticipantData.id,\n name: initialParticipantData.name,\n email: initialParticipantData.email,\n phone: initialParticipantData.phone,\n })\n\n setSelectedChannel(channel)\n setDirectConversationMode(true)\n setDirectConversationError(null)\n\n // Notify parent component of channel selection\n if (onChannelSelect) {\n onChannelSelect(channel)\n }\n\n if (debug) {\n console.log(\n '[MessagingShell] Channel created and loaded:',\n channel.id\n )\n }\n } catch (createErr) {\n console.error(\n '[MessagingShell] Failed to create conversation:',\n createErr\n )\n setDirectConversationError('Failed to create conversation')\n }\n } else {\n // No participant data provided, show error\n setDirectConversationError(\n 'No conversation found with this account'\n )\n\n if (debug) {\n console.log(\n '[MessagingShell] No conversation found for:',\n initialParticipantFilter\n )\n }\n }\n }\n } catch (err) {\n console.error(\n '[MessagingShell] Failed to load initial conversation:',\n err\n )\n setDirectConversationError('Failed to load conversation')\n }\n }\n\n loadInitialChannel()\n }, [\n initialParticipantFilter,\n initialParticipantData,\n client,\n isConnected,\n service,\n debug,\n onChannelSelect,\n ])\n\n const handleChannelSelect = useCallback(\n (channel: Channel) => {\n setSelectedChannel(channel)\n onChannelSelect?.(channel)\n },\n [onChannelSelect]\n )\n\n const handleBackToChannelList = useCallback(() => {\n // In direct conversation mode, don't allow going back to channel list\n // The parent component should handle navigation\n if (directConversationMode) return\n\n setSelectedChannel(null)\n }, [directConversationMode])\n\n const handleStartConversation = useCallback(() => {\n if (participantSource) {\n setPickerKey((prev) => prev + 1) // Increment key to force remount\n setShowParticipantPicker(true)\n participantPickerRef.current?.showModal()\n }\n }, [participantSource])\n\n const handleSelectParticipant = useCallback(\n async (participant: Participant) => {\n if (!service) return\n\n try {\n if (debug) {\n console.log(\n '[MessagingShell] Starting conversation with:',\n participant.id\n )\n }\n\n const channel = await service.startChannelWithParticipant({\n id: participant.id,\n name: participant.name,\n email: participant.email,\n phone: participant.phone,\n })\n\n // Show the channel\n try {\n await channel.show()\n } catch (error) {\n console.warn('[MessagingShell] Failed to unhide channel:', error)\n }\n\n setSelectedChannel(channel)\n setShowParticipantPicker(false)\n participantPickerRef.current?.close()\n\n onParticipantSelect?.(participant)\n } catch (error) {\n console.error('[MessagingShell] Failed to start conversation:', error)\n }\n },\n [service, onParticipantSelect, debug]\n )\n\n const handleCloseParticipantPicker = useCallback(() => {\n setShowParticipantPicker(false)\n participantPickerRef.current?.close()\n }, [])\n\n const handleLeaveConversation = useCallback(\n async (channel: Channel) => {\n if (debug) {\n console.log('[MessagingShell] Leaving conversation:', channel.id)\n }\n setSelectedChannel(null)\n setDirectConversationMode(false) // Exit direct conversation mode\n\n // Force re-sync to update the existing participants list\n syncedRef.current = null\n await syncChannels()\n },\n [syncChannels, debug]\n )\n\n const handleBlockParticipant = useCallback(\n async (participantId?: string) => {\n if (debug) {\n console.log('[MessagingShell] Blocking participant:', participantId)\n }\n setSelectedChannel(null)\n setDirectConversationMode(false) // Exit direct conversation mode\n\n // Force re-sync to update the existing participants list\n syncedRef.current = null\n await syncChannels()\n },\n [syncChannels, debug]\n )\n\n const isChannelSelected = Boolean(selectedChannel)\n\n // Show loading state\n if (isLoading) {\n return (\n <div className={classNames('h-full', className)}>\n <LoadingState />\n </div>\n )\n }\n\n // Show error state\n if (error) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState message={error} onBack={refreshConnection} />\n </div>\n )\n }\n\n // Show not connected state\n if (!isConnected || !client) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState\n message=\"Not connected to messaging service\"\n onBack={refreshConnection}\n />\n </div>\n )\n }\n\n // Show direct conversation error state\n if (directConversationError) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState message={directConversationError} />\n </div>\n )\n }\n\n return (\n <div\n className={classNames(\n 'messaging-shell h-full bg-white overflow-hidden',\n className\n )}\n >\n <div className=\"flex h-full min-h-0\">\n {/* Channel List Sidebar */}\n <div\n className={classNames(\n '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',\n {\n // Explicitly hidden via prop or in direct conversation mode\n '!hidden': showChannelList === false || directConversationMode,\n // Normal mode: hide on mobile when channel selected, show on desktop\n 'hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]':\n showChannelList !== false &&\n !directConversationMode &&\n isChannelSelected,\n // Normal mode: show when no channel selected\n 'flex flex-col w-full lg:flex-1 lg:max-w-2xl':\n showChannelList !== false &&\n !directConversationMode &&\n !isChannelSelected,\n }\n )}\n >\n <ChannelList\n onChannelSelect={handleChannelSelect}\n selectedChannel={selectedChannel || undefined}\n showStartConversation={\n showStartConversation && Boolean(participantSource)\n }\n onStartConversation={handleStartConversation}\n participantLabel={participantLabel}\n />\n </div>\n\n {/* Channel View */}\n <div\n className={classNames(\n 'messaging-conversation-view flex-1 flex-col min-w-0 min-h-0',\n {\n // In direct conversation mode, always show (full width)\n flex: directConversationMode || isChannelSelected,\n // Normal mode: hide on mobile when no channel selected\n 'hidden lg:flex': !directConversationMode && !isChannelSelected,\n }\n )}\n >\n {selectedChannel ? (\n <div className=\"flex-1 min-h-0 flex flex-col\">\n <ChannelView\n channel={selectedChannel}\n key={selectedChannel.id}\n onBack={handleBackToChannelList}\n showBackButton={!directConversationMode}\n renderMessageInputActions={renderMessageInputActions}\n onLeaveConversation={handleLeaveConversation}\n onBlockParticipant={handleBlockParticipant}\n CustomChannelEmptyState={CustomChannelEmptyState}\n />\n </div>\n ) : (\n <EmptyState\n hasChannels={hasChannels}\n onStartConversation={\n showStartConversation ? handleStartConversation : undefined\n }\n participantLabel={participantLabel}\n />\n )}\n </div>\n </div>\n\n {/* Participant Picker Dialog */}\n {participantSource && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n ref={participantPickerRef}\n className=\"mes-dialog\"\n onClick={(e) => {\n if (e.target === participantPickerRef.current) {\n handleCloseParticipantPicker()\n }\n }}\n onClose={handleCloseParticipantPicker}\n >\n <div className=\"h-full w-full bg-white shadow-max-elevation-light\">\n <ParticipantPicker\n key={pickerKey}\n participantSource={participantSource}\n onSelectParticipant={handleSelectParticipant}\n onClose={handleCloseParticipantPicker}\n existingParticipantIds={existingParticipantIds}\n participantLabel={participantLabel}\n searchPlaceholder={`Search ${participantLabel}...`}\n />\n </div>\n </dialog>\n )}\n </div>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport interface FaqListItemProps {\n question: string\n onClick: () => void\n loading?: boolean\n className?: string\n}\n\nexport const FaqListItem: React.FC<FaqListItemProps> = ({\n question,\n onClick,\n loading = false,\n className,\n}) => {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={loading}\n style={{ backgroundColor: '#E6E5E3' }}\n className={classNames(\n 'w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors',\n {\n 'hover:brightness-95 active:brightness-90': !loading,\n 'opacity-50 cursor-not-allowed': loading,\n },\n className\n )}\n >\n {question}\n </button>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport { Avatar } from '../Avatar'\n\nimport { FaqListItem } from './FaqListItem'\n\nexport interface Faq {\n id: string\n question: string\n answer: string\n enabled: boolean\n order?: number | null\n}\n\nexport interface FaqListProps {\n faqs: Faq[]\n onFaqClick: (faqId: string) => void\n loadingFaqId?: string | null\n headerText?: string\n className?: string\n avatarImage?: string\n avatarName?: string\n}\n\nexport const FaqList: React.FC<FaqListProps> = ({\n faqs,\n onFaqClick,\n loadingFaqId,\n headerText,\n className,\n avatarImage,\n avatarName,\n}) => {\n const enabledFaqs = faqs\n .filter((faq) => faq.enabled)\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n\n if (enabledFaqs.length === 0) {\n return null\n }\n\n return (\n <div className={classNames('px-4 py-6', className)}>\n <div className=\"flex gap-3 items-end\">\n {/* Avatar at bottom-left, outside grey background */}\n {(avatarImage || avatarName) && (\n <div className=\"flex-none\">\n <Avatar\n id={avatarName || 'account'}\n name={avatarName || 'Account'}\n image={avatarImage}\n size={24}\n />\n </div>\n )}\n\n {/* FAQs with grey background */}\n <div\n className=\"flex-1 rounded-lg p-4 space-y-3\"\n style={{ backgroundColor: '#F1F0EE' }}\n >\n {headerText && (\n <p className=\"text-md text-charcoal mb-4\">{headerText}</p>\n )}\n {enabledFaqs.map((faq) => (\n <FaqListItem\n key={faq.id}\n question={faq.question}\n onClick={() => onFaqClick(faq.id)}\n loading={loadingFaqId === faq.id}\n />\n ))}\n </div>\n </div>\n </div>\n )\n}\n","import { useState, useEffect, useCallback } from 'react';\n\nimport type { ParticipantSource, Participant } from '../types';\n\n/**\n * Hook for managing participant loading with search and pagination\n */\nexport const useParticipants = (\n participantSource: ParticipantSource,\n options: {\n initialSearch?: string;\n pageSize?: number;\n } = {}\n) => {\n const { initialSearch = '', pageSize = 20 } = options;\n \n const [participants, setParticipants] = useState<Participant[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [searchQuery, setSearchQuery] = useState(initialSearch);\n const [hasMore, setHasMore] = useState(true);\n const [cursor, setCursor] = useState<string | undefined>();\n\n // Load participants with current search query\n const loadParticipants = useCallback(async (\n reset = false,\n customSearch?: string\n ) => {\n if (loading) return;\n \n const search = customSearch !== undefined ? customSearch : searchQuery;\n \n setLoading(true);\n setError(null);\n\n try {\n const result = await participantSource.loadParticipants({\n search: search || undefined,\n limit: pageSize,\n cursor: reset ? undefined : cursor,\n });\n\n setParticipants(prev => \n reset ? result.participants : [...prev, ...result.participants]\n );\n setHasMore(result.hasMore);\n setCursor(result.nextCursor);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to load participants';\n setError(errorMessage);\n console.error('[useParticipants] Load error:', err);\n } finally {\n setLoading(false);\n }\n }, [participantSource, searchQuery, cursor, pageSize, loading]);\n\n // Load more participants (pagination)\n const loadMore = useCallback(() => {\n if (hasMore && !loading) {\n loadParticipants(false);\n }\n }, [hasMore, loading, loadParticipants]);\n\n // Search participants\n const search = useCallback((query: string) => {\n setSearchQuery(query);\n setCursor(undefined);\n loadParticipants(true, query);\n }, [loadParticipants]);\n\n // Refresh participants\n const refresh = useCallback(() => {\n setCursor(undefined);\n loadParticipants(true);\n }, [loadParticipants]);\n\n // Initial load - only run once when participantSource changes\n useEffect(() => {\n loadParticipants(true);\n }, [participantSource.loadParticipants]); // Only depend on the function to avoid loops\n\n return {\n participants,\n loading,\n error,\n searchQuery,\n hasMore,\n totalCount: participantSource.totalCount,\n loadMore,\n search,\n refresh,\n };\n};\n"],"names":["MessagingContext","createContext","useMessagingContext","useContext","MessagingProvider","children","user","serviceConfig","apiKey","capabilities","customization","debug","debugLog","useCallback","message","args","service","setService","useState","client","setClient","isConnected","setIsConnected","isLoading","setIsLoading","error","setError","connectingRef","useRef","prevPropsRef","renderCountRef","useEffect","currentRender","newService","StreamChatService","connectedUserRef","_a","_b","streamClient","err","errorMessage","refreshConnection","contextValue","React","jsx","Chat","useMessaging","__importDefault","this","mod","exports","react_1","require$$0","classnames_1","require$$1","Base","className","onChange","onChangeValue","appearance","props","ref","baseInputStyles","handleChangeValue","value","checked","SelectPill_1","jsx_runtime_1","require$$2","Base_1","require$$3","SelectPill","id","name","label","defaultChecked","inactive","tabIndex","icon","selected","isInactive","handleKeyDown","key","code","SelectPillGroup_1","SelectPillGroup","IconButton","rest","jsxs","classNames","EMOJIS","hashString","str","hash","i","char","getAvatarEmoji","index","Avatar","image","size","emoji","DEFAULT_COLOR","fontSizeClass","CustomChannelPreview","channel","selectedChannel","onChannelSelect","unread","isSelected","handleClick","participant","member","participantName","participantImage","_c","lastMessage","_e","_d","lastMessageText","lastMessageTime","unreadCount","_f","ChannelList","showStartConversation","onStartConversation","participantLabel","useChatContext","staticFilters","setStaticFilters","filters","userId","newFilters","state","NotePencilIcon","StreamChannelList","ActionButton","variant","CloseButton","onClick","XIcon","ChannelEmptyState","CustomMessageInput","renderActions","MessageInput","CustomChannelHeader","onBack","showBackButton","onShowInfo","canShowInfo","useChannelStateContext","ArrowLeftIcon","DotsThreeIcon","ChannelInfoDialog","isOpen","onClose","followerStatusLabel","onLeaveConversation","onBlockParticipant","dialogRef","isParticipantBlocked","setIsParticipantBlocked","isLeaving","setIsLeaving","isUpdatingBlockStatus","setIsUpdatingBlockStatus","dialog","checkIsParticipantBlocked","isBlocked","handleLeaveConversation","actingUserId","handleBlockUser","handleUnblockUser","handleReportUser","participantEmail","participantUsername","participantSecondary","participantId","_g","e","SpinnerGapIcon","SignOutIcon","ProhibitInsetIcon","FlagIcon","ChannelViewInner","renderMessageInputActions","CustomChannelEmptyState","showInfo","setShowInfo","hasMessages","channelExtraData","Fragment","Window","MessageList","ChannelView","Channel","SearchInput","searchQuery","setSearchQuery","placeholder","searchInputRef","MagnifyingGlassIcon","ParticipantPicker","participantSource","onSelectParticipant","existingParticipantIds","searchPlaceholder","participants","setParticipants","loading","setLoading","startingChatWithId","setStartingChatWithId","loadedRef","result","availableParticipants","searchLower","handleSelectParticipant","event","ChatCircleDotsIcon","displayName","displaySecondary","EmptyState","hasChannels","TextButton","ErrorState","Loading","LoadingState","MessagingShell","onParticipantSelect","initialParticipantFilter","initialParticipantData","showChannelList","setSelectedChannel","setHasChannels","_showParticipantPicker","setShowParticipantPicker","setExistingParticipantIds","pickerKey","setPickerKey","directConversationMode","setDirectConversationMode","directConversationError","setDirectConversationError","participantPickerRef","syncedRef","syncChannels","channels","memberIds","members","memberId","createErr","handleChannelSelect","handleBackToChannelList","handleStartConversation","prev","handleCloseParticipantPicker","handleBlockParticipant","isChannelSelected","FaqListItem","question","FaqList","faqs","onFaqClick","loadingFaqId","headerText","avatarImage","avatarName","enabledFaqs","faq","a","b","useParticipants","options","initialSearch","pageSize","hasMore","setHasMore","cursor","setCursor","loadParticipants","reset","customSearch","search","loadMore","query","refresh"],"mappings":";;;;;;AAiCA,MAAMA,KAAmBC,GAAqC;AAAA,EAC5D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,cAAc,CAAA;AAAA,EACd,eAAe,CAAA;AAAA,EACf,mBAAmB,YAAY;AAAA,EAAC;AAAA,EAChC,OAAO;AACT,CAAC,GAKYC,KAAsB,MAAMC,GAAWH,EAAgB,GAKvDI,KAAsD,CAAC;AAAA,EAClE,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,eAAAC,IAAgB,CAAA;AAAA,EAChB,OAAAC,IAAQ;AACV,MAAM;AAEJ,QAAMC,IAAWC;AAAA,IACf,CAACC,MAAoBC,MAAoB;AACvC,MAAIJ,KACF,QAAQ,IAAI,0BAA0BG,CAAO,IAAI,GAAGC,CAAI;AAAA,IAE5D;AAAA,IACA,CAACJ,CAAK;AAAA,EAAA;AAGR,EAAAC,EAAS,mBAAmB;AAAA,IAC1B,QAAQN,KAAA,gBAAAA,EAAM;AAAA,IACd,SAAQE,KAAA,gBAAAA,EAAQ,UAAU,GAAG,MAAK;AAAA,IAClC,eAAe,CAAC,CAACD;AAAA,IACjB,cAAc,OAAO,KAAKE,CAAY;AAAA,IACtC,eAAe,OAAO,KAAKC,CAAa;AAAA,EAAA,CACzC;AAED,QAAM,CAACM,GAASC,CAAU,IAAIC,EAAmC,IAAI,GAC/D,CAACC,GAAQC,CAAS,IAAIF,EAA4B,IAAI,GACtD,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EA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SAAS/K,GAAK;AACZ,YAAMC,IAAeD,aAAe,QAAQA,EAAI,UAAU;AAC1D,MAAAb,EAASc,CAAY,GACrB,QAAQ,MAAM,iCAAiCD,CAAG;AAAA,IACpD,UAAA;AACE,MAAA2K,EAAW,EAAK;AAAA,IAClB;AAAA,EACF,GAAG,CAACP,GAAmBN,GAAaiF,GAAQH,GAAUlE,CAAO,CAAC,GAGxD2E,IAAW/Q,EAAY,MAAM;AACjC,IAAIuQ,KAAW,CAACnE,KACduE,EAAiB,EAAK;AAAA,EAE1B,GAAG,CAACJ,GAASnE,GAASuE,CAAgB,CAAC,GAGjCG,IAAS9Q,EAAY,CAACgR,MAAkB;AAC5C,IAAAvF,EAAeuF,CAAK,GACpBN,EAAU,MAAS,GACnBC,EAAiB,IAAMK,CAAK;AAAA,EAC9B,GAAG,CAACL,CAAgB,CAAC,GAGfM,IAAUjR,EAAY,MAAM;AAChC,IAAA0Q,EAAU,MAAS,GACnBC,EAAiB,EAAI;AAAA,EACvB,GAAG,CAACA,CAAgB,CAAC;AAGrB,SAAAzP,EAAU,MAAM;AACd,IAAAyP,EAAiB,EAAI;AAAA,EACvB,GAAG,CAAC7E,EAAkB,gBAAgB,CAAC,GAEhC;AAAA,IACL,cAAAI;AAAA,IACA,SAAAE;AAAA,IACA,OAAAxL;AAAA,IACA,aAAA4K;AAAA,IACA,SAAA+E;AAAA,IACA,YAAYzE,EAAkB;AAAA,IAC9B,UAAAiF;AAAA,IACA,QAAAD;AAAA,IACA,SAAAG;AAAA,EAAA;AAEJ;","x_google_ignoreList":[2,3,4,5]}
1
+ {"version":3,"file":"index.js","sources":["../src/providers/MessagingProvider.tsx","../src/hooks/useMessaging.ts","../../../node_modules/@linktr.ee/component-library/dist/Input/Base.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/SelectPill.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/SelectPillGroup.js","../../../node_modules/@linktr.ee/component-library/dist/Input/components/SelectPill/index.js","../src/components/IconButton/index.tsx","../src/components/Avatar/getAvatarEmoji.ts","../src/components/Avatar/index.tsx","../src/components/ChannelList/CustomChannelPreview.tsx","../src/components/ChannelList/index.tsx","../src/components/ActionButton/index.tsx","../src/components/CloseButton/index.tsx","../src/components/MessagingShell/ChannelEmptyState.tsx","../src/components/ChannelView.tsx","../src/components/SearchInput/index.tsx","../src/components/ParticipantPicker/index.tsx","../src/components/MessagingShell/EmptyState.tsx","../src/components/MessagingShell/ErrorState.tsx","../src/components/Loading/index.tsx","../src/components/MessagingShell/LoadingState.tsx","../src/components/MessagingShell/index.tsx","../src/components/FaqList/FaqListItem.tsx","../src/components/FaqList/index.tsx","../src/hooks/useParticipants.ts"],"sourcesContent":["import { StreamChatService } from '@linktr.ee/messaging-core'\nimport React, {\n createContext,\n useContext,\n useEffect,\n useState,\n useRef,\n useCallback,\n} from 'react'\nimport type { StreamChat } from 'stream-chat'\nimport { Chat } from 'stream-chat-react'\n\nimport type {\n MessagingProviderProps,\n MessagingCapabilities,\n MessagingCustomization,\n} from '../types'\n\n/**\n * Context value for messaging state and service\n */\nexport interface MessagingContextValue {\n service: StreamChatService | null\n client: StreamChat | null // Stream Chat client\n isConnected: boolean\n isLoading: boolean\n error: string | null\n capabilities: MessagingCapabilities\n customization: MessagingCustomization\n refreshConnection: () => Promise<void>\n debug: boolean\n}\n\nconst MessagingContext = createContext<MessagingContextValue>({\n service: null,\n client: null,\n isConnected: false,\n isLoading: false,\n error: null,\n capabilities: {},\n customization: {},\n refreshConnection: async () => {},\n debug: false,\n})\n\n/**\n * Hook to access messaging context\n */\nexport const useMessagingContext = () => useContext(MessagingContext)\n\n/**\n * Provider component that wraps messaging-core with React state management\n */\nexport const MessagingProvider: React.FC<MessagingProviderProps> = ({\n children,\n user,\n serviceConfig,\n apiKey,\n capabilities = {},\n customization = {},\n debug = false,\n}) => {\n // Create debug logger that respects the debug prop\n const debugLog = useCallback(\n (message: string, ...args: unknown[]) => {\n if (debug) {\n console.log(`🔥 [MessagingProvider] ${message}`, ...args)\n }\n },\n [debug]\n )\n\n debugLog('🔄 RENDER START', {\n userId: user?.id,\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfig: !!serviceConfig,\n capabilities: Object.keys(capabilities),\n customization: Object.keys(customization),\n })\n\n const [service, setService] = useState<StreamChatService | null>(null)\n const [client, setClient] = useState<StreamChat | null>(null)\n const [isConnected, setIsConnected] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n // Prevent multiple concurrent connection attempts\n const connectingRef = useRef(false)\n\n // Track renders and prop changes\n const prevPropsRef = useRef({\n userId: user?.id,\n apiKey,\n serviceConfig,\n capabilities,\n customization,\n })\n const renderCountRef = useRef(0)\n renderCountRef.current++\n\n debugLog('📊 RENDER INFO', {\n renderCount: renderCountRef.current,\n currentProps: { userId: user?.id, apiKey: apiKey?.substring(0, 8) + '...' },\n propChanges: {\n userChanged: prevPropsRef.current.userId !== user?.id,\n apiKeyChanged: prevPropsRef.current.apiKey !== apiKey,\n serviceConfigChanged:\n prevPropsRef.current.serviceConfig !== serviceConfig,\n capabilitiesChanged: prevPropsRef.current.capabilities !== capabilities,\n customizationChanged:\n prevPropsRef.current.customization !== customization,\n },\n })\n\n prevPropsRef.current = {\n userId: user?.id,\n apiKey,\n serviceConfig,\n capabilities,\n customization,\n }\n\n // Initialize service when config changes\n useEffect(() => {\n const currentRender = renderCountRef.current\n debugLog('🔧 SERVICE INIT EFFECT TRIGGERED', {\n renderCount: currentRender,\n apiKey: !!apiKey,\n serviceConfig: !!serviceConfig,\n dependencies: {\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfigRef: serviceConfig,\n serviceConfigStable:\n prevPropsRef.current.serviceConfig === serviceConfig,\n apiKeyStable: prevPropsRef.current.apiKey === apiKey,\n },\n })\n\n if (!apiKey || !serviceConfig) {\n debugLog('⚠️ SERVICE INIT SKIPPED', {\n renderCount: currentRender,\n reason: 'Missing apiKey or serviceConfig',\n })\n return\n }\n\n debugLog('🚀 CREATING NEW SERVICE', {\n renderCount: currentRender,\n apiKey: apiKey?.substring(0, 8) + '...',\n serviceConfigChanged:\n prevPropsRef.current.serviceConfig !== serviceConfig,\n })\n\n const newService = new StreamChatService({\n ...serviceConfig,\n apiKey,\n debug,\n })\n\n setService(newService)\n debugLog('✅ SERVICE SET', {\n renderCount: currentRender,\n serviceInstance: !!newService,\n })\n\n return () => {\n debugLog('🧹 SERVICE CLEANUP', {\n renderCount: currentRender,\n reason: 'Effect cleanup',\n })\n newService.disconnectUser().catch(console.error)\n }\n }, [apiKey, serviceConfig, debug, debugLog]) // Use serviceConfig object directly, not individual properties\n\n // Track if we've already connected this user with this service to prevent duplicate connections\n const connectedUserRef = useRef<{\n serviceId: StreamChatService\n userId: string\n } | null>(null)\n\n // Connect user when service and user are available\n useEffect(() => {\n debugLog('🔗 USER CONNECTION EFFECT TRIGGERED', {\n hasService: !!service,\n hasUser: !!user,\n userId: user?.id,\n isConnecting: connectingRef.current,\n isConnected: isConnected,\n dependencies: { service: !!service, userId: user?.id },\n })\n\n if (!service || !user) {\n debugLog('⚠️ USER CONNECTION SKIPPED', 'Missing service or user')\n return\n }\n\n if (connectingRef.current) {\n debugLog('⚠️ USER CONNECTION SKIPPED', 'Already connecting')\n return\n }\n\n // Check if we've already connected this exact user with this exact service instance\n if (\n connectedUserRef.current?.serviceId === service &&\n connectedUserRef.current?.userId === user.id\n ) {\n debugLog(\n '⚠️ USER CONNECTION SKIPPED',\n 'Already connected this user with this service'\n )\n return\n }\n\n const connectUser = async () => {\n debugLog('🚀 STARTING USER CONNECTION', { userId: user.id })\n connectingRef.current = true\n setIsLoading(true)\n setError(null)\n\n try {\n debugLog('📞 CALLING SERVICE.CONNECTUSER', { userId: user.id })\n const streamClient = await service.connectUser(user)\n setClient(streamClient)\n setIsConnected(true)\n connectedUserRef.current = { serviceId: service, userId: user.id } // Mark as connected\n debugLog('✅ USER CONNECTION SUCCESS', {\n userId: user.id,\n clientId: streamClient.userID,\n })\n } catch (err) {\n const errorMessage =\n err instanceof Error ? err.message : 'Connection failed'\n setError(errorMessage)\n debugLog('❌ USER CONNECTION ERROR', {\n userId: user.id,\n error: errorMessage,\n })\n } finally {\n setIsLoading(false)\n connectingRef.current = false\n debugLog('🔄 USER CONNECTION FINISHED', {\n userId: user.id,\n isConnected,\n })\n }\n }\n\n connectUser()\n }, [service, user, debugLog, isConnected]) // Remove isConnected to prevent circular dependency\n\n // Disconnect when user is removed (cleanup effect)\n useEffect(() => {\n debugLog('🔌 CLEANUP EFFECT REGISTERED', {\n hasService: !!service,\n isConnected,\n })\n return () => {\n if (service && isConnected) {\n debugLog(\n '🧹 CLEANUP EFFECT TRIGGERED',\n 'Cleaning up connection on unmount'\n )\n connectedUserRef.current = null // Reset connection tracking\n service.disconnectUser().catch(console.error)\n } else {\n debugLog('🔇 CLEANUP EFFECT SKIPPED', {\n hasService: !!service,\n isConnected,\n })\n }\n }\n }, [service, isConnected, debugLog])\n\n const refreshConnection = useCallback(async () => {\n debugLog('🔄 REFRESH CONNECTION CALLED', {\n hasService: !!service,\n hasUser: !!user,\n })\n\n if (!service || !user) {\n debugLog('⚠️ REFRESH CONNECTION SKIPPED', 'Missing service or user')\n return\n }\n\n debugLog('🚀 STARTING CONNECTION REFRESH', { userId: user.id })\n setIsLoading(true)\n try {\n debugLog('🔌 DISCONNECTING FOR REFRESH')\n await service.disconnectUser()\n debugLog('📞 RECONNECTING FOR REFRESH')\n const streamClient = await service.connectUser(user)\n setClient(streamClient)\n setIsConnected(true)\n setError(null)\n debugLog('✅ CONNECTION REFRESH SUCCESS', { userId: user.id })\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Refresh failed'\n setError(errorMessage)\n debugLog('❌ CONNECTION REFRESH ERROR', {\n userId: user.id,\n error: errorMessage,\n })\n } finally {\n setIsLoading(false)\n debugLog('🔄 CONNECTION REFRESH FINISHED', { userId: user.id })\n }\n }, [service, user, debugLog])\n\n // Memoize context value to prevent unnecessary re-renders\n const contextValue: MessagingContextValue = React.useMemo(() => {\n debugLog('💫 CONTEXT VALUE MEMOIZATION', {\n hasService: !!service,\n hasClient: !!client,\n isConnected,\n isLoading,\n hasError: !!error,\n capabilitiesKeys: Object.keys(capabilities),\n customizationKeys: Object.keys(customization),\n })\n\n return {\n service,\n client,\n isConnected,\n isLoading,\n error,\n capabilities,\n customization,\n refreshConnection,\n debug,\n }\n }, [\n service,\n client,\n isConnected,\n isLoading,\n error,\n capabilities,\n customization,\n refreshConnection,\n debug,\n debugLog,\n ])\n\n debugLog('🔄 RENDER END', {\n renderCount: renderCountRef.current,\n willRenderChat: !!(client && isConnected),\n contextValueReady: !!contextValue,\n })\n\n return (\n <MessagingContext.Provider value={contextValue}>\n {client && isConnected ? (\n <Chat client={client}>{children}</Chat>\n ) : (\n children\n )}\n </MessagingContext.Provider>\n )\n}\n","import { useMessagingContext } from '../providers/MessagingProvider';\nimport type { MessagingContextValue } from '../providers/MessagingProvider';\n\n/**\n * Hook to access messaging service and state\n */\nexport const useMessaging = (): MessagingContextValue => {\n return useMessagingContext();\n};\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.baseStyleClasses = void 0;\nconst react_1 = __importDefault(require(\"react\"));\nconst classnames_1 = __importDefault(require(\"classnames\"));\nexports.baseStyleClasses = (0, classnames_1.default)('text-sm', 'h-2xl', 'block', 'p-md', 'w-full', 'rounded-sm', 'bg-chalk', 'text-black', 'transition', 'duration-75', 'ease-out', '!outline-none');\nconst Base = ({ className, onChange, onChangeValue, appearance = 'default', ...props }, ref) => {\n const baseInputStyles = appearance === 'none' ? 'appearance-none' : exports.baseStyleClasses;\n const handleChangeValue = ({ target: { value, checked } }) => {\n if (props.type === 'checkbox') {\n return onChangeValue?.(checked);\n }\n return onChangeValue?.(value);\n };\n return react_1.default.createElement('input', {\n ...props,\n className: (0, classnames_1.default)(className, baseInputStyles),\n onChange: onChange || (onChangeValue && handleChangeValue),\n ref\n });\n};\nexports.default = react_1.default.forwardRef(Base);\n//# sourceMappingURL=Base.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst jsx_runtime_1 = require(\"react/jsx-runtime\");\nconst react_1 = __importDefault(require(\"react\"));\nconst classnames_1 = __importDefault(require(\"classnames\"));\nconst Base_1 = __importDefault(require(\"../../Base\"));\nconst SelectPill = ({ id, name, label, className = '', checked, defaultChecked, inactive, value, tabIndex, icon, ...props }, ref) => {\n const selected = checked || defaultChecked;\n const isInactive = inactive || props?.disabled;\n const handleKeyDown = ({ key, code }) => {\n if (props.onChangeValue && (key === 'Enter' || code === 'Space'))\n props.onChangeValue?.(value);\n };\n return ((0, jsx_runtime_1.jsx)(\"div\", { className: (0, classnames_1.default)('inline-flex', 'first:ml-xs', 'max-w-full'), children: (0, jsx_runtime_1.jsxs)(\"label\", { htmlFor: id, tabIndex: tabIndex, className: (0, classnames_1.default)('w-fit', 'h-10', 'px-md', 'rounded-lg', 'inline-flex', 'justify-center', 'border', 'hover:ring-1', 'hover:ring-sand', 'relative', 'transition duration-75 ease-out', 'max-w-full', className, {\n 'pointer-events-none': isInactive,\n 'cursor-pointer': !isInactive,\n // Selected\n 'border-black': selected,\n 'bg-black': selected,\n // Not selected\n 'bg-white': !selected,\n 'border-sand': !selected,\n 'hover:border-sand': !selected\n }), children: [(0, jsx_runtime_1.jsx)(Base_1.default, { type: \"checkbox\", id: id, name: name, value: value, checked: checked, defaultChecked: defaultChecked, appearance: \"none\", className: (0, classnames_1.default)('cursor-pointer', 'outline-none', 'focus-visible:ring-2', 'focus-visible:ring-black', 'absolute', '-top-[3px]', 'left-4px', 'w-[calc(100%+6px)]', 'h-[calc(100%+6px)]', 'rounded-[48px]', 'transition duration-75 ease-out'), disabled: isInactive, onKeyDown: handleKeyDown, ref: ref, ...props }), (0, jsx_runtime_1.jsxs)(\"span\", { className: (0, classnames_1.default)('pointer-events-none', 'select-none', 'self-center', 'text-sm', 'flex', 'mt-[1px]', 'truncate', {\n 'text-pebble': isInactive,\n 'text-white': selected,\n 'text-black': !selected && !isInactive\n }), children: [icon && (0, jsx_runtime_1.jsx)(\"div\", { className: \"icon mr-xs self-center\", children: icon }), (0, jsx_runtime_1.jsx)(\"span\", { className: \"label\", children: label || name })] })] }) }));\n};\nexports.default = react_1.default.forwardRef(SelectPill);\n//# sourceMappingURL=SelectPill.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst jsx_runtime_1 = require(\"react/jsx-runtime\");\nconst react_1 = __importDefault(require(\"react\"));\nconst SelectPillGroup = ({ children, label, className = '' }, ref) => ((0, jsx_runtime_1.jsxs)(\"fieldset\", { className: `${className} -ml-xs space-x-xs space-y-xs`, ref: ref, children: [label && (0, jsx_runtime_1.jsx)(\"legend\", { className: \"mb-sm ml-sm text-sm font-semibold\", children: label }), children] }));\nexports.default = react_1.default.forwardRef(SelectPillGroup);\n//# sourceMappingURL=SelectPillGroup.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InputSelectPillGroup = exports.default = void 0;\nvar SelectPill_1 = require(\"./SelectPill\");\nObject.defineProperty(exports, \"default\", { enumerable: true, get: function () { return __importDefault(SelectPill_1).default; } });\nvar SelectPillGroup_1 = require(\"./SelectPillGroup\");\nObject.defineProperty(exports, \"InputSelectPillGroup\", { enumerable: true, get: function () { return __importDefault(SelectPillGroup_1).default; } });\n//# sourceMappingURL=index.js.map","import classNames from \"classnames\";\nimport React from \"react\";\n\ninterface IconButtonProps\n extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"type\" | \"children\"\n > {\n label: string;\n children: React.ReactNode;\n className?: string;\n}\n\nexport function IconButton({ label, className, children, ...rest }: IconButtonProps) {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"rounded-full p-2 transition-colors focus-ring\",\n {\n \"cursor-not-allowed opacity-50\": rest.disabled,\n \"hover:bg-sand\": !rest.disabled,\n },\n className,\n )}\n {...rest}\n >\n <span className=\"sr-only\">{label}</span>\n {children}\n </button>\n );\n}","/**\n * Generate a fruit emoji based on a string id\n * Returns a consistent fruit emoji for the same id\n */\nconst EMOJIS = [\n '🍎', // Apple\n '🍌', // Banana\n '🍇', // Grape\n '🍊', // Orange\n '🍓', // Strawberry\n '🥥', // Coconut\n '🍒', // Cherry\n '🥭', // Mango\n '🍉', // Watermelon\n '🍋', // Lemon\n '🥝', // Kiwi\n '🫒', // Olive\n '🍈', // Melon\n]\n\n/**\n * Simple hash function to convert string to number\n */\nfunction hashString(str: string): number {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash = hash & hash // Convert to 32-bit integer\n }\n return Math.abs(hash)\n}\n\n/**\n * Get a fruit emoji based on an id string\n * @param id - The string id to generate emoji from\n * @returns A fruit emoji string\n */\nexport function getAvatarEmoji(id: string): string {\n const hash = hashString(id)\n const index = hash % EMOJIS.length\n return EMOJIS[index]\n}\n\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport { getAvatarEmoji } from './getAvatarEmoji'\n\nexport interface AvatarProps {\n id: string\n name: string\n image?: string\n size?: number\n className?: string\n}\n\n/**\n * Avatar component that displays a user image or colored initial fallback\n */\nexport const Avatar: React.FC<AvatarProps> = ({\n id,\n image,\n size = 40,\n className,\n}) => {\n const emoji = getAvatarEmoji(id)\n\n // Determine font size based on avatar size\n const getFontSizeClass = () => {\n if (size < 32) return 'text-xs'\n if (size < 56) return 'text-sm'\n return 'text-lg'\n }\n\n const fontSizeClass = getFontSizeClass()\n\n return (\n <div\n className={classNames(\n 'flex-shrink-0 overflow-hidden rounded-lg',\n className\n )}\n style={{ width: `${size}px`, height: `${size}px` }}\n >\n {image ? (\n <img\n src={image}\n alt=\"\"\n className=\"h-full w-full object-cover aspect-square\"\n />\n ) : (\n <div\n aria-hidden=\"true\"\n className={classNames(\n 'flex h-full w-full items-center justify-center font-semibold rounded-sm bg-[#FBFAF9]/60',\n fontSizeClass\n )}\n >\n {emoji}\n </div>\n )}\n </div>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\nimport { Channel } from 'stream-chat'\nimport { ChannelPreviewUIComponentProps } from 'stream-chat-react'\n\nimport { Avatar } from '../Avatar'\n\n/**\n * Custom channel preview that handles selection\n */\nconst CustomChannelPreview: React.FC<\n ChannelPreviewUIComponentProps & {\n selectedChannel?: Channel | null\n onChannelSelect: (channel: Channel) => void\n debug?: boolean\n }\n> = ({ channel, selectedChannel, onChannelSelect, debug = false, unread }) => {\n const isSelected = selectedChannel?.id === channel?.id\n\n const handleClick = () => {\n if (channel) {\n onChannelSelect(channel)\n }\n }\n\n // Get participant info\n const members = Object.values(channel?.state?.members || {})\n const participant = members.find(\n (member) => member.user?.id && member.user.id !== channel?._client?.userID\n )\n const participantName = participant?.user?.name || 'Conversation'\n const participantImage = participant?.user?.image\n\n // Get last message and format timestamp\n const lastMessage =\n channel?.state?.messages?.[channel.state.messages.length - 1]\n const lastMessageText = lastMessage?.text || 'No messages yet'\n const lastMessageTime = lastMessage?.created_at\n ? new Date(lastMessage.created_at).toLocaleTimeString([], {\n hour: '2-digit',\n minute: '2-digit',\n })\n : ''\n\n // Use the unread prop passed by Stream Chat (reactive and updates automatically)\n const unreadCount = unread ?? 0\n\n if (debug) {\n console.log('📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER', {\n channelId: channel?.id,\n isSelected,\n participantName,\n unreadCount,\n hasTimestamp: !!lastMessageTime,\n })\n }\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={classNames(\n 'w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring',\n {\n 'bg-primary-alt/10 border-l-4 border-l-primary': isSelected,\n 'hover:bg-sand': !isSelected,\n }\n )}\n >\n <div className=\"flex items-start gap-3\">\n {/* Avatar */}\n <Avatar\n id={participant?.user?.id || channel.id || 'unknown'}\n name={participantName}\n image={participantImage}\n size={44}\n />\n\n {/* Content column */}\n <div className=\"flex-1 min-w-0 flex flex-col gap-1\">\n {/* Name and timestamp row */}\n <div className=\"flex items-center justify-between gap-2\">\n <h3\n className={classNames(\n 'text-sm font-medium truncate',\n isSelected ? 'text-primary' : 'text-charcoal'\n )}\n >\n {participantName}\n </h3>\n {lastMessageTime && (\n <span className=\"text-xs text-stone flex-shrink-0\">\n {lastMessageTime}\n </span>\n )}\n </div>\n\n {/* Message and unread badge row */}\n <div className=\"flex items-center justify-between gap-2 min-w-0\">\n <p className=\"text-xs text-stone mr-2 flex-1 line-clamp-2\">\n {lastMessageText}\n </p>\n {unreadCount > 0 && (\n <span className=\"bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n </div>\n </div>\n </div>\n </button>\n )\n}\n\nexport default CustomChannelPreview\n","import SelectPill from '@linktr.ee/component-library/InputSelectPill'\nimport SelectPillGroup from '@linktr.ee/component-library/InputSelectPillGroup'\nimport { NotePencilIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\nimport {\n ChannelList as StreamChannelList,\n useChatContext,\n} from 'stream-chat-react'\n\nimport { useMessagingContext } from '../../providers/MessagingProvider'\nimport type { ChannelListProps } from '../../types'\nimport { IconButton } from '../IconButton'\n\nimport CustomChannelPreview from './CustomChannelPreview'\n\nenum ChannelFilter {\n All,\n Unread,\n}\n\n/**\n * Channel list component with customizable header and actions\n */\nexport const ChannelList: React.FC<ChannelListProps> = ({\n onChannelSelect,\n selectedChannel,\n showStartConversation = false,\n onStartConversation,\n participantLabel = 'participants',\n className,\n}) => {\n // Track renders\n const renderCountRef = React.useRef(0)\n renderCountRef.current++\n\n // Get debug flag from context\n const { debug = false } = useMessagingContext()\n\n if (debug) {\n console.log('📺 [ChannelList] 🔄 RENDER START', {\n renderCount: renderCountRef.current,\n selectedChannelId: selectedChannel?.id,\n showStartConversation,\n participantLabel,\n })\n }\n\n const { client } = useChatContext()\n\n if (debug) {\n console.log('📺 [ChannelList] 📡 CHAT CONTEXT', {\n renderCount: renderCountRef.current,\n hasClient: !!client,\n clientUserId: client?.userID,\n clientConnected: client?.wsConnection?.isHealthy,\n })\n }\n\n const [staticFilters, setStaticFilters] = useState<{\n type: string\n last_message_at: { $exists: boolean }\n has_unread: boolean | undefined\n }>({\n type: 'messaging',\n last_message_at: { $exists: true },\n has_unread: undefined,\n })\n\n // Filter for messaging channels\n const filters = React.useMemo(() => {\n const userId = client.userID\n\n const newFilters = {\n ...staticFilters,\n ...(userId && {\n members: { $in: [userId] },\n hidden: false,\n }),\n }\n\n if (debug) {\n console.log('📺 [ChannelList] 🔍 FILTERS MEMOIZED', {\n renderCount: renderCountRef.current,\n userId,\n filters: newFilters,\n })\n }\n\n return newFilters\n }, [client.userID, debug, staticFilters])\n\n return (\n <div\n className={classNames(\n 'messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden',\n className\n )}\n >\n {/* Header */}\n <div className=\"px-4 py-4 border-b border-sand bg-chalk\">\n <div className=\"flex items-center justify-between gap-3 min-h-10 min-w-0\">\n <div>\n <h2 className=\"text-lg font-semibold text-charcoal\">\n Conversations\n </h2>\n <SelectPillGroup>\n <SelectPill\n checked={!filters.has_unread}\n name=\"All\"\n onChange={() =>\n setStaticFilters((state) => ({\n ...state,\n has_unread: undefined,\n }))\n }\n value={ChannelFilter.All}\n />\n <SelectPill\n checked={filters.has_unread}\n name=\"Unread\"\n onChange={() =>\n setStaticFilters((state) => ({ ...state, has_unread: true }))\n }\n value={ChannelFilter.Unread}\n />\n </SelectPillGroup>\n </div>\n <div className=\"flex items-center gap-2\">\n {showStartConversation && onStartConversation && (\n <IconButton\n label=\"Start a new conversation\"\n onClick={onStartConversation}\n className=\"inline-flex size-10 items-center justify-center\"\n >\n <NotePencilIcon className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n </div>\n </div>\n\n {/* Channel List */}\n <div className=\"flex-1 overflow-hidden min-w-0\">\n {(() => {\n if (debug) {\n console.log('📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST', {\n renderCount: renderCountRef.current,\n filters,\n hasClient: !!client,\n clientUserId: client?.userID,\n })\n }\n\n return (\n <StreamChannelList\n filters={filters}\n sort={{ last_message_at: -1 }}\n options={{ limit: 30 }}\n Preview={(props) => {\n if (debug) {\n console.log('📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER', {\n channelId: props.channel?.id,\n selectedChannelId: selectedChannel?.id,\n isSelected: selectedChannel?.id === props.channel?.id,\n })\n }\n\n return (\n <CustomChannelPreview\n {...props}\n selectedChannel={selectedChannel}\n onChannelSelect={onChannelSelect}\n debug={debug}\n />\n )\n }}\n />\n )\n })()}\n </div>\n </div>\n )\n}\n","import classNames from \"classnames\";\nimport React from \"react\";\n\ninterface ActionButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"danger\";\n}\n\nconst ActionButton = ({\n variant = \"default\",\n className,\n children,\n ...rest\n}: ActionButtonProps) => {\n const isDanger = variant === \"danger\";\n return (\n <button\n type=\"button\"\n className={classNames(\n \"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\",\n isDanger\n ? \"text-danger hover:bg-danger/50\"\n : \"text-charcoal hover:bg-sand\",\n className,\n )}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nexport default ActionButton;\n","import { XIcon } from '@phosphor-icons/react'\n\nimport { IconButton } from '../IconButton'\n\ninterface CloseButtonProps {\n onClick: () => void\n}\n\nexport function CloseButton({ onClick }: CloseButtonProps) {\n return (\n <IconButton label=\"Close\" onClick={onClick} className=\"p-1\">\n <XIcon className=\"h-5 w-5 text-stone\" weight=\"bold\" />\n </IconButton>\n )\n}\n","import React from 'react'\n\n/**\n * Empty state component shown when a channel has no messages\n */\nexport const ChannelEmptyState: React.FC = () => (\n <div className=\"messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance\">\n <div className=\"text-center max-w-sm\">\n <h2 className=\"font-semibold text-charcoal mb-2\">No messages yet 👀</h2>\n\n <p className=\"text-stone text-xs\">\n Share to social media to generate more conversations\n </p>\n </div>\n </div>\n)\n\n","import {\n ArrowLeftIcon,\n DotsThreeIcon,\n FlagIcon,\n ProhibitInsetIcon,\n SignOutIcon,\n SpinnerGapIcon,\n} from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState, useCallback, useRef, useEffect } from 'react'\nimport { Channel as ChannelType, ChannelMemberResponse } from 'stream-chat'\nimport {\n Channel,\n Window,\n MessageList,\n MessageInput,\n useChannelStateContext,\n} from 'stream-chat-react'\n\nimport { useMessagingContext } from '../providers/MessagingProvider'\nimport type { ChannelViewProps } from '../types'\n\nimport ActionButton from './ActionButton'\nimport { Avatar } from './Avatar'\nimport { CloseButton } from './CloseButton'\nimport { IconButton } from './IconButton'\nimport { ChannelEmptyState } from './MessagingShell/ChannelEmptyState'\n\n// Custom user type with email and username\ntype CustomUser = {\n email?: string\n username?: string\n}\n\n// Blocked user from Stream Chat API\ntype BlockedUser = {\n blocked_user_id: string\n}\n\n/**\n * Custom message input component with render prop for actions\n */\nconst CustomMessageInput: React.FC<{\n renderActions?: () => React.ReactNode\n}> = ({ renderActions }) => (\n <div className=\"message-input flex items-center gap-2 p-4\">\n {renderActions && renderActions()}\n\n <div className=\"flex-1\">\n <MessageInput focus maxRows={4} />\n </div>\n </div>\n)\n\n/**\n * Custom channel header component\n */\nconst CustomChannelHeader: React.FC<{\n onBack?: () => void\n showBackButton: boolean\n onShowInfo?: () => void\n canShowInfo: boolean\n}> = ({ onBack, showBackButton, onShowInfo, canShowInfo }) => {\n const { channel } = useChannelStateContext()\n\n // Get participant info (excluding current user)\n const participant = React.useMemo(() => {\n const members = Object.values(channel.state.members || {})\n return members.find(\n (member) => member.user?.id && member.user.id !== channel._client.userID\n )\n }, [channel._client.userID, channel.state.members])\n\n const participantName =\n participant?.user?.name || participant?.user?.id || 'Unknown member'\n const participantImage = participant?.user?.image\n\n return (\n <div className=\"flex items-center justify-between gap-3 min-h-12\">\n <div className=\"flex items-center gap-3 min-w-0\">\n {showBackButton && onBack && (\n <button\n type=\"button\"\n onClick={onBack}\n 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\"\n aria-label=\"Back to conversations\"\n >\n <ArrowLeftIcon className=\"h-5 w-5 text-stone\" weight=\"bold\" />\n </button>\n )}\n\n {/* Avatar */}\n <Avatar\n id={participant?.user?.id || channel.id || 'unknown'}\n name={participantName}\n image={participantImage}\n size={40}\n />\n\n <div className=\"min-w-0\">\n <h1 className=\"text-lg font-semibold text-charcoal truncate\">\n {participantName}\n </h1>\n </div>\n </div>\n\n {canShowInfo && onShowInfo && (\n <IconButton label=\"Chat info\" onClick={onShowInfo}>\n <DotsThreeIcon className=\"h-6 w-6 text-charcoal\" weight=\"bold\" />\n </IconButton>\n )}\n </div>\n )\n}\n\n/**\n * Channel info dialog (matching original implementation)\n */\nconst ChannelInfoDialog: React.FC<{\n isOpen: boolean\n onClose: () => void\n participant: ChannelMemberResponse | undefined\n channel: ChannelType\n followerStatusLabel?: string\n onLeaveConversation?: (channel: ChannelType) => void\n onBlockParticipant?: (participantId?: string) => void\n}> = ({\n isOpen,\n onClose,\n participant,\n channel,\n followerStatusLabel,\n onLeaveConversation,\n onBlockParticipant,\n}) => {\n const { service, debug } = useMessagingContext()\n const dialogRef = useRef<HTMLDialogElement>(null)\n const [isParticipantBlocked, setIsParticipantBlocked] = useState(false)\n const [isLeaving, setIsLeaving] = useState(false)\n const [isUpdatingBlockStatus, setIsUpdatingBlockStatus] = useState(false)\n\n // Sync dialog open state with prop\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n if (isOpen) {\n dialog.showModal()\n } else {\n dialog.close()\n }\n }, [isOpen])\n\n // Check if participant is blocked\n const checkIsParticipantBlocked = useCallback(async () => {\n if (!service || !participant?.user?.id) return\n\n try {\n const blockedUsers = await service.getBlockedUsers()\n const isBlocked = blockedUsers.some(\n (user: BlockedUser) => user.blocked_user_id === participant?.user?.id\n )\n setIsParticipantBlocked(isBlocked)\n } catch (error) {\n console.error(\n '[ChannelInfoDialog] Failed to check blocked status:',\n error\n )\n }\n }, [service, participant?.user?.id])\n\n useEffect(() => {\n if (isOpen) {\n checkIsParticipantBlocked()\n }\n }, [isOpen, checkIsParticipantBlocked])\n\n const handleLeaveConversation = async () => {\n if (isLeaving) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Leave conversation', channel.cid)\n }\n setIsLeaving(true)\n\n try {\n const actingUserId = channel._client?.userID ?? null\n await channel.hide(actingUserId, false)\n\n if (onLeaveConversation) {\n await onLeaveConversation(channel)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to leave conversation', error)\n } finally {\n setIsLeaving(false)\n }\n }\n\n const handleBlockUser = async () => {\n if (isUpdatingBlockStatus || !service) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Block member', participant?.user?.id)\n }\n setIsUpdatingBlockStatus(true)\n\n try {\n await service.blockUser(participant?.user?.id)\n\n if (onBlockParticipant) {\n await onBlockParticipant(participant?.user?.id)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to block member', error)\n } finally {\n setIsUpdatingBlockStatus(false)\n }\n }\n\n const handleUnblockUser = async () => {\n if (isUpdatingBlockStatus || !service) return\n\n if (debug) {\n console.log('[ChannelInfoDialog] Unblock member', participant?.user?.id)\n }\n setIsUpdatingBlockStatus(true)\n\n try {\n await service.unBlockUser(participant?.user?.id)\n\n if (onBlockParticipant) {\n await onBlockParticipant(participant?.user?.id)\n }\n\n onClose()\n } catch (error) {\n console.error('[ChannelInfoDialog] Failed to unblock member', error)\n } finally {\n setIsUpdatingBlockStatus(false)\n }\n }\n\n const handleReportUser = () => {\n onClose()\n window.open(\n 'https://linktr.ee/s/about/trust-center/report',\n '_blank',\n 'noopener,noreferrer'\n )\n }\n\n if (!participant) return null\n\n const participantName =\n participant.user?.name || participant.user?.id || 'Unknown member'\n const participantImage = participant.user?.image\n const participantEmail = (participant.user as CustomUser)?.email\n const participantUsername = (participant.user as CustomUser)?.username\n const participantSecondary = participantEmail\n ? participantEmail\n : participantUsername\n ? `linktr.ee/${participantUsername}`\n : undefined\n const participantId = participant.user?.id || 'unknown'\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n ref={dialogRef}\n className=\"mes-dialog\"\n onClose={onClose}\n onClick={(e) => {\n if (e.target === dialogRef.current) {\n onClose()\n }\n }}\n >\n <div className=\"ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light\">\n <div className=\"flex items-center justify-between border-b border-sand px-4 py-3\">\n <h2 className=\"text-base font-semibold text-charcoal\">Chat info</h2>\n <CloseButton onClick={onClose} />\n </div>\n\n <div className=\"flex-1 px-2 overflow-y-auto w-full\">\n <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' }}>\n <div className=\"flex items-center gap-3 w-full\">\n <Avatar\n id={participantId}\n name={participantName}\n image={participantImage}\n size={88}\n className=\"!rounded-full\"\n />\n <div className=\"flex flex-col min-w-0 flex-1\">\n <p className=\"truncate text-base font-semibold text-charcoal\">\n {participantName}\n </p>\n {participantSecondary && (\n <p className=\"truncate text-sm text-[#00000055]\">\n {participantSecondary}\n </p>\n )}\n {followerStatusLabel && (\n <span\n className=\"mt-1 rounded-full text-xs font-normal w-fit\"\n style={{\n padding: '4px 8px',\n backgroundColor: followerStatusLabel === 'Subscribed to you' ? '#DCFCE7' : '#F5F5F4',\n color: followerStatusLabel === 'Subscribed to you' ? '#008236' : '#78716C',\n lineHeight: '133.333%',\n letterSpacing: '0.21px',\n }}\n >\n {followerStatusLabel}\n </span>\n )}\n </div>\n </div>\n </div>\n\n <ul className=\"flex flex-col gap-2 mt-2\">\n <li>\n <ActionButton\n onClick={handleLeaveConversation}\n disabled={isLeaving}\n aria-busy={isLeaving}\n >\n {isLeaving ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <SignOutIcon className=\"h-5 w-5\" />\n )}\n <span>Leave Conversation</span>\n </ActionButton>\n </li>\n <li>\n {isParticipantBlocked ? (\n <ActionButton\n onClick={handleUnblockUser}\n disabled={isUpdatingBlockStatus}\n aria-busy={isUpdatingBlockStatus}\n >\n {isUpdatingBlockStatus ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <ProhibitInsetIcon className=\"h-5 w-5\" />\n )}\n <span>Unblock</span>\n </ActionButton>\n ) : (\n <ActionButton\n onClick={handleBlockUser}\n disabled={isUpdatingBlockStatus}\n aria-busy={isUpdatingBlockStatus}\n >\n {isUpdatingBlockStatus ? (\n <SpinnerGapIcon className=\"h-5 w-5 animate-spin\" />\n ) : (\n <ProhibitInsetIcon className=\"h-5 w-5\" />\n )}\n <span>Block</span>\n </ActionButton>\n )}\n </li>\n <li>\n <ActionButton variant=\"danger\" onClick={handleReportUser}>\n <FlagIcon className=\"h-5 w-5\" />\n <span>Report</span>\n </ActionButton>\n </li>\n </ul>\n </div>\n </div>\n </dialog>\n )\n}\n\n/**\n * Inner component that has access to channel context\n */\nconst ChannelViewInner: React.FC<{\n onBack?: () => void\n showBackButton: boolean\n renderMessageInputActions?: (channel: ChannelType) => React.ReactNode\n onLeaveConversation?: (channel: ChannelType) => void\n onBlockParticipant?: (participantId?: string) => void\n CustomChannelEmptyState?: React.ComponentType\n}> = ({\n onBack,\n showBackButton,\n renderMessageInputActions,\n onLeaveConversation,\n onBlockParticipant,\n CustomChannelEmptyState = ChannelEmptyState,\n}) => {\n const { channel } = useChannelStateContext()\n const [showInfo, setShowInfo] = useState(false)\n\n // Check if channel has messages - using context to reactively subscribe to message updates\n const hasMessages = (channel?.state?.messages?.length ?? 0) > 0\n\n // Get participant info for info dialog\n const participant = React.useMemo(() => {\n const members = Object.values(channel.state.members || {})\n return members.find(\n (member) => member.user?.id && member.user.id !== channel._client.userID\n )\n }, [channel._client.userID, channel.state.members])\n\n // Get follower status label from channel data\n const followerStatusLabel = React.useMemo(() => {\n const channelExtraData = (channel.data ?? {}) as {\n followerStatus?: string\n isFollower?: boolean\n }\n \n // If explicit followerStatus is provided, use it\n if (channelExtraData.followerStatus) {\n return String(channelExtraData.followerStatus)\n }\n // If isFollower is explicitly defined, use it to determine status\n if (channelExtraData.isFollower !== undefined) {\n return channelExtraData.isFollower ? 'Subscribed to you' : 'Not subscribed'\n }\n // Otherwise, don't show any status\n return undefined\n }, [channel.data])\n\n return (\n <>\n <Window>\n {/* Custom Channel Header */}\n <div className=\"border-b border-sand bg-white px-4 py-3\">\n <CustomChannelHeader\n onBack={onBack}\n showBackButton={showBackButton}\n onShowInfo={() => setShowInfo(true)}\n canShowInfo={Boolean(participant)}\n />\n </div>\n\n {/* Message List */}\n <div className=\"flex-1 overflow-hidden relative\">\n <MessageList hideDeletedMessages hideNewMessageSeparator={false} />\n\n {/* Show custom empty state when no messages */}\n {!hasMessages && CustomChannelEmptyState && (\n <div className=\"absolute inset-0 w-full h-full bg-white\">\n <CustomChannelEmptyState />\n </div>\n )}\n </div>\n\n {/* Message Input */}\n <CustomMessageInput\n renderActions={() => renderMessageInputActions?.(channel)}\n />\n </Window>\n\n {/* Channel Info Dialog */}\n <ChannelInfoDialog\n isOpen={showInfo}\n onClose={() => setShowInfo(false)}\n participant={participant}\n channel={channel}\n followerStatusLabel={followerStatusLabel}\n onLeaveConversation={onLeaveConversation}\n onBlockParticipant={onBlockParticipant}\n />\n </>\n )\n}\n\n/**\n * Channel view component with message list and input\n */\nexport const ChannelView: React.FC<ChannelViewProps> = ({\n channel,\n onBack,\n showBackButton = false,\n renderMessageInputActions,\n onLeaveConversation,\n onBlockParticipant,\n className,\n CustomChannelEmptyState = ChannelEmptyState,\n}) => {\n return (\n <div\n className={classNames(\n 'messaging-channel-view h-full flex flex-col',\n className\n )}\n >\n <Channel channel={channel}>\n <ChannelViewInner\n onBack={onBack}\n showBackButton={showBackButton}\n renderMessageInputActions={renderMessageInputActions}\n onLeaveConversation={onLeaveConversation}\n onBlockParticipant={onBlockParticipant}\n CustomChannelEmptyState={CustomChannelEmptyState}\n />\n </Channel>\n </div>\n )\n}\n","import { MagnifyingGlassIcon, XIcon } from '@phosphor-icons/react'\nimport { useRef } from 'react'\n\nimport { IconButton } from '../IconButton'\n\ninterface SearchInputProps {\n searchQuery: string\n setSearchQuery: (value: string) => void\n placeholder: string\n}\n\nexport function SearchInput({\n searchQuery,\n setSearchQuery,\n placeholder,\n}: SearchInputProps) {\n const searchInputRef = useRef<HTMLInputElement>(null)\n\n return (\n <div className=\"relative\">\n <MagnifyingGlassIcon\n className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone\"\n weight=\"bold\"\n />\n\n <input\n ref={searchInputRef}\n type=\"text\"\n placeholder={placeholder}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent\"\n />\n\n {searchQuery && (\n <IconButton\n label=\"Clear search\"\n onClick={() => {\n setSearchQuery('')\n searchInputRef.current?.focus()\n }}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal\"\n >\n <XIcon className=\"h-4 w-4\" weight=\"bold\" />\n </IconButton>\n )}\n </div>\n )\n}\n","import { ChatCircleDotsIcon, SpinnerGapIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useCallback, useEffect, useState, useRef } from 'react'\n\nimport { useMessagingContext } from '../../providers/MessagingProvider'\nimport type { ParticipantPickerProps, Participant } from '../../types'\nimport { Avatar } from '../Avatar'\nimport { CloseButton } from '../CloseButton'\nimport { SearchInput } from '../SearchInput'\n\n/**\n * Generic participant picker component for starting conversations\n */\nexport const ParticipantPicker: React.FC<ParticipantPickerProps> = ({\n participantSource,\n onSelectParticipant,\n onClose,\n existingParticipantIds = new Set(),\n participantLabel = 'participants',\n searchPlaceholder = 'Search participants...',\n className,\n}) => {\n const { debug } = useMessagingContext()\n const [searchQuery, setSearchQuery] = useState('')\n const [participants, setParticipants] = useState<Participant[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [startingChatWithId, setStartingChatWithId] = useState<string | null>(\n null\n )\n\n // Track if we've already loaded participants to prevent repeated loading\n const loadedRef = useRef(false)\n\n // Load participants initially - wait for participantSource to finish loading first\n useEffect(() => {\n // Wait for the participantSource to finish loading before we try to load participants\n if (participantSource.loading) {\n if (debug) {\n console.log(\n '[ParticipantPicker] Waiting for participant source to finish loading...'\n )\n }\n return\n }\n\n if (loadedRef.current) return // Prevent multiple loads\n\n const loadInitialParticipants = async () => {\n if (debug) {\n console.log('[ParticipantPicker] Loading initial participants...')\n }\n setLoading(true)\n setError(null)\n\n try {\n const result = await participantSource.loadParticipants({\n search: '', // Load all participants initially\n limit: 100,\n })\n setParticipants(result.participants)\n loadedRef.current = true // Mark as loaded\n if (debug) {\n console.log(\n '[ParticipantPicker] Participants loaded successfully:',\n result.participants.length\n )\n }\n } catch (err) {\n const errorMessage =\n err instanceof Error ? err.message : 'Failed to load participants'\n setError(errorMessage)\n console.error('[ParticipantPicker] Failed to load participants:', err)\n // Don't mark as loaded on error, allow retry\n } finally {\n setLoading(false)\n }\n }\n\n loadInitialParticipants()\n }, [participantSource.loading, debug]) // Re-run when loading state changes\n\n // Filter participants by search query and existing participants\n const availableParticipants = participants\n .filter((participant) => !existingParticipantIds.has(participant.id))\n .filter((participant) => {\n if (!searchQuery) return true\n const searchLower = searchQuery.toLowerCase()\n return (\n participant.name.toLowerCase().includes(searchLower) ||\n participant.email?.toLowerCase().includes(searchLower) ||\n false\n )\n })\n\n const handleSelectParticipant = useCallback(\n async (participant: Participant) => {\n if (startingChatWithId) return // Prevent multiple clicks\n\n setStartingChatWithId(participant.id)\n try {\n await onSelectParticipant(participant)\n } catch (error) {\n console.error('[ParticipantPicker] Failed to start chat:', error)\n // Reset the loading state on error\n setStartingChatWithId(null)\n }\n // Note: Don't reset startingChatWithId on success because the dialog will close\n },\n [onSelectParticipant, startingChatWithId]\n )\n\n const handleKeyDown = (\n event: React.KeyboardEvent,\n participant: Participant\n ) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n handleSelectParticipant(participant)\n }\n }\n\n return (\n <div className={classNames('flex flex-col h-full', className)}>\n {/* Header */}\n <div className=\"px-4 py-4 border-b border-sand bg-chalk\">\n <div className=\"flex items-center justify-between mb-3\">\n <h2 className=\"text-lg font-semibold text-charcoal\">\n Start a new Conversation\n </h2>\n <CloseButton onClick={onClose} />\n </div>\n\n <p className=\"text-xs text-stone mb-3\">\n Select a {participantLabel.slice(0, -1)} to start messaging (\n {availableParticipants.length} available)\n {participantSource.totalCount !== undefined &&\n ` • ${participantSource.totalCount} ${participantLabel} total`}\n </p>\n\n <SearchInput\n searchQuery={searchQuery}\n setSearchQuery={setSearchQuery}\n placeholder={searchPlaceholder}\n />\n </div>\n\n {/* Error State */}\n {error && (\n <div className=\"p-4 text-sm text-danger bg-danger-alt\">\n Error loading {participantLabel}: {error}\n </div>\n )}\n\n {/* Participants List */}\n <div className=\"flex-1 overflow-auto\">\n {loading && availableParticipants.length === 0 ? (\n <div className=\"h-32 flex items-center justify-center\">\n <div className=\"flex items-center space-x-2\">\n <div className=\"w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent\"></div>\n <span className=\"text-sm text-stone\">\n Loading {participantLabel}...\n </span>\n </div>\n </div>\n ) : availableParticipants.length === 0 ? (\n <div className=\"p-6 text-center\">\n <div className=\"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand\">\n <ChatCircleDotsIcon className=\"h-8 w-8 text-charcoal\" />\n </div>\n <h3 className=\"text-sm font-semibold text-charcoal mb-2\">\n {searchQuery\n ? `No ${participantLabel} found`\n : participants.length > 0\n ? `Already chatting with all ${participantLabel}`\n : `No ${participantLabel} yet`}\n </h3>\n <p className=\"text-xs text-stone\">\n {searchQuery\n ? 'Try a different search term'\n : participants.length > 0\n ? `You have existing conversations with all your ${participantLabel}`\n : `${participantLabel.charAt(0).toUpperCase() + participantLabel.slice(1)} will appear here`}\n </p>\n </div>\n ) : (\n <ul className=\"space-y-0\">\n {availableParticipants.map((participant) => {\n const displayName =\n participant.name || participant.email || participant.id\n const displaySecondary =\n participant.email && participant.name\n ? participant.email\n : participant.phone\n\n return (\n <li key={participant.id}>\n <button\n type=\"button\"\n onClick={() => handleSelectParticipant(participant)}\n onKeyDown={(e) => handleKeyDown(e, participant)}\n 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\"\n >\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center space-x-3 flex-1 min-w-0\">\n {/* Avatar */}\n <Avatar\n id={participant.id}\n name={displayName}\n image={participant.image}\n size={40}\n />\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-medium text-charcoal truncate\">\n {displayName}\n </h4>\n {displaySecondary && (\n <p className=\"text-xs text-stone truncate\">\n {displaySecondary}\n </p>\n )}\n </div>\n </div>\n\n {/* Icon */}\n <div className=\"flex-shrink-0\">\n {startingChatWithId === participant.id ? (\n <SpinnerGapIcon className=\"h-5 w-5 text-primary animate-spin\" />\n ) : (\n <ChatCircleDotsIcon className=\"h-5 w-5 text-stone\" />\n )}\n </div>\n </div>\n </button>\n </li>\n )\n })}\n\n {/* Loading indicator */}\n {loading && (\n <li className=\"p-4 flex justify-center\">\n <div className=\"flex items-center space-x-2\">\n <div className=\"w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent\"></div>\n <span className=\"text-sm text-stone\">Loading more...</span>\n </div>\n </li>\n )}\n </ul>\n )}\n </div>\n </div>\n )\n}\n","import React from 'react'\n\n/**\n * Empty state component shown when no channel is selected\n */\nexport const EmptyState: React.FC<{\n hasChannels: boolean\n onStartConversation?: () => void\n participantLabel: string\n}> = ({ hasChannels, onStartConversation, participantLabel }) => (\n <div className=\"messaging-empty-state flex items-center justify-center h-full p-8 text-balance\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6\">\n <span className=\"text-4xl\">💬</span>\n </div>\n\n <h2 className=\"font-semibold text-charcoal\">Welcome to Messages</h2>\n\n <p className=\"text-stone text-sm mb-6\">\n {hasChannels ? (\n <>\n Choose a conversation from the list or{' '}\n {onStartConversation && (\n <TextButton onClick={onStartConversation}>\n start a new conversation with a {participantLabel.slice(0, -1)}.\n </TextButton>\n )}\n </>\n ) : (\n onStartConversation && (\n <>\n <TextButton onClick={onStartConversation}>\n Start a new conversation with one of your {participantLabel}\n </TextButton>{' '}\n to begin messaging.\n </>\n )\n )}\n </p>\n </div>\n </div>\n)\n\nconst TextButton = ({\n onClick,\n children,\n}: {\n onClick: () => void\n children: React.ReactNode\n}) => (\n <button\n type=\"button\"\n onClick={onClick}\n 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\"\n >\n {children}\n </button>\n)\n","import React from 'react'\n\n/**\n * Error state component shown when something goes wrong\n */\nexport const ErrorState: React.FC<{\n message: string\n onBack?: () => void\n}> = ({ message, onBack }) => (\n <div className=\"messaging-error-state flex items-center justify-center h-full p-8\">\n <div className=\"text-center max-w-sm\">\n <div className=\"w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6\">\n <span className=\"text-4xl\">⚠️</span>\n </div>\n\n <h2 className=\"font-semibold text-charcoal mb-2\">Oops!</h2>\n\n <p className=\"text-stone text-sm mb-6\">{message}</p>\n\n {onBack && (\n <button\n type=\"button\"\n onClick={onBack}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-primary hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors\"\n >\n Go Back\n </button>\n )}\n </div>\n </div>\n)\n","import classNames from 'classnames'\n\ntype LoadingProps = {\n className?: string\n message?: string\n}\n\nconst Loading = ({ className, message }: LoadingProps) => (\n <div\n className={classNames('flex items-center justify-center h-full', className)}\n >\n <svg viewBox=\"0 0 100 100\" className=\"size-8 fill-pebble\" stroke=\"none\">\n <circle cx=\"6\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 15 ; 0 -15; 0 15\"\n repeatCount=\"indefinite\"\n begin=\"0.1\"\n />\n </circle>\n <circle cx=\"30\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 10 ; 0 -10; 0 10\"\n repeatCount=\"indefinite\"\n begin=\"0.2\"\n />\n </circle>\n <circle cx=\"54\" cy=\"50\" r=\"6\">\n <animateTransform\n attributeName=\"transform\"\n dur=\"1s\"\n type=\"translate\"\n values=\"0 5 ; 0 -5; 0 5\"\n repeatCount=\"indefinite\"\n begin=\"0.3\"\n />\n </circle>\n </svg>\n {message && <span className=\"text-stone\">{message}</span>}\n </div>\n)\n\nexport default Loading\n","import Loading from '../Loading'\n\n/**\n * Loading state component\n */\nexport const LoadingState = () => (\n <div className=\"messaging-loading-state flex items-center justify-center h-full\">\n <div className=\"flex items-center\">\n <Loading className=\"w-6 h-6\" />\n <span className=\"text-sm text-stone\">Loading messages</span>\n </div>\n </div>\n)\n","import classNames from 'classnames'\nimport React, { useState, useCallback, useRef, useEffect } from 'react'\nimport type { Channel } from 'stream-chat'\n\nimport { useMessaging } from '../../hooks/useMessaging'\nimport type { MessagingShellProps, Participant } from '../../types'\nimport { ChannelList } from '../ChannelList'\nimport { ChannelView } from '../ChannelView'\nimport { ParticipantPicker } from '../ParticipantPicker'\n\nimport { EmptyState } from './EmptyState'\nimport { ErrorState } from './ErrorState'\nimport { LoadingState } from './LoadingState'\n\n/**\n * Main messaging interface component that combines channel list and channel view\n */\nexport const MessagingShell: React.FC<MessagingShellProps> = ({\n capabilities = {},\n className,\n renderMessageInputActions,\n onChannelSelect,\n onParticipantSelect,\n initialParticipantFilter,\n initialParticipantData,\n CustomChannelEmptyState,\n showChannelList = true,\n}) => {\n const {\n service,\n client,\n isConnected,\n isLoading,\n error,\n refreshConnection,\n debug,\n } = useMessaging()\n\n const [selectedChannel, setSelectedChannel] = useState<Channel | null>(null)\n const [hasChannels, setHasChannels] = useState(false)\n const [_showParticipantPicker, setShowParticipantPicker] = useState(false)\n const [existingParticipantIds, setExistingParticipantIds] = useState<\n Set<string>\n >(new Set())\n const [pickerKey, setPickerKey] = useState(0) // Key to force remount of ParticipantPicker\n const [directConversationMode, setDirectConversationMode] = useState(false)\n const [directConversationError, setDirectConversationError] = useState<\n string | null\n >(null)\n\n const participantPickerRef = useRef<HTMLDialogElement>(null)\n\n const {\n showStartConversation = false,\n participantSource,\n participantLabel = 'participants',\n } = capabilities\n\n // Track if we've already synced channels to prevent repeated API calls\n const syncedRef = useRef<string | null>(null)\n\n // Function to sync channels (extracted for reuse)\n const syncChannels = useCallback(async () => {\n if (!client || !isConnected) return\n\n const userId = client.userID\n if (!userId) return\n\n try {\n if (debug) {\n console.log('[MessagingShell] Syncing channels for user:', userId)\n }\n\n const channels = await client.queryChannels(\n {\n type: 'messaging',\n members: { $in: [userId] },\n },\n {},\n { limit: 100 }\n )\n\n const memberIds = new Set<string>()\n channels.forEach((channel: Channel) => {\n const members = channel.state.members\n Object.values(members).forEach((member) => {\n const memberId = member.user?.id\n if (memberId && memberId !== userId) {\n memberIds.add(memberId)\n }\n })\n })\n\n setExistingParticipantIds(memberIds)\n setHasChannels(channels.length > 0)\n syncedRef.current = userId // Mark as synced for this user\n\n if (debug) {\n console.log('[MessagingShell] Channels synced successfully:', {\n channelCount: channels.length,\n memberCount: memberIds.size,\n })\n }\n } catch (error) {\n console.error('[MessagingShell] Failed to sync channels:', error)\n // Don't mark as synced on error, allow retry\n }\n }, [client, isConnected, debug])\n\n // Sync existing channels to track which participants we can already message\n useEffect(() => {\n if (!client || !isConnected) return\n\n const userId = client.userID\n if (!userId) return\n\n // Prevent repeated sync for the same user\n if (syncedRef.current === userId) return\n\n syncChannels()\n }, [client, isConnected, syncChannels])\n\n // Load initial channel for direct conversation mode\n useEffect(() => {\n if (!initialParticipantFilter || !client || !isConnected) return\n\n const loadInitialChannel = async () => {\n const userId = client.userID\n if (!userId) return\n\n try {\n if (debug) {\n console.log(\n '[MessagingShell] Loading initial conversation with:',\n initialParticipantFilter\n )\n }\n\n const channels = await client.queryChannels(\n {\n type: 'messaging',\n members: { $eq: [userId, initialParticipantFilter] },\n },\n {},\n { limit: 1 }\n )\n\n if (channels.length > 0) {\n setSelectedChannel(channels[0])\n setDirectConversationMode(true)\n setDirectConversationError(null)\n\n // Notify parent component of channel selection\n if (onChannelSelect) {\n onChannelSelect(channels[0])\n }\n\n if (debug) {\n console.log(\n '[MessagingShell] Initial conversation loaded:',\n channels[0].id\n )\n }\n } else {\n // No channel found - try to create one if participant data is provided\n if (initialParticipantData && service) {\n if (debug) {\n console.log(\n '[MessagingShell] No conversation found, creating one for:',\n initialParticipantData\n )\n }\n\n try {\n // Use the existing service method to create the channel\n const channel = await service.startChannelWithParticipant({\n id: initialParticipantData.id,\n name: initialParticipantData.name,\n email: initialParticipantData.email,\n phone: initialParticipantData.phone,\n })\n\n setSelectedChannel(channel)\n setDirectConversationMode(true)\n setDirectConversationError(null)\n\n // Notify parent component of channel selection\n if (onChannelSelect) {\n onChannelSelect(channel)\n }\n\n if (debug) {\n console.log(\n '[MessagingShell] Channel created and loaded:',\n channel.id\n )\n }\n } catch (createErr) {\n console.error(\n '[MessagingShell] Failed to create conversation:',\n createErr\n )\n setDirectConversationError('Failed to create conversation')\n }\n } else {\n // No participant data provided, show error\n setDirectConversationError(\n 'No conversation found with this account'\n )\n\n if (debug) {\n console.log(\n '[MessagingShell] No conversation found for:',\n initialParticipantFilter\n )\n }\n }\n }\n } catch (err) {\n console.error(\n '[MessagingShell] Failed to load initial conversation:',\n err\n )\n setDirectConversationError('Failed to load conversation')\n }\n }\n\n loadInitialChannel()\n }, [\n initialParticipantFilter,\n initialParticipantData,\n client,\n isConnected,\n service,\n debug,\n onChannelSelect,\n ])\n\n const handleChannelSelect = useCallback(\n (channel: Channel) => {\n setSelectedChannel(channel)\n onChannelSelect?.(channel)\n },\n [onChannelSelect]\n )\n\n const handleBackToChannelList = useCallback(() => {\n // In direct conversation mode, don't allow going back to channel list\n // The parent component should handle navigation\n if (directConversationMode) return\n\n setSelectedChannel(null)\n }, [directConversationMode])\n\n const handleStartConversation = useCallback(() => {\n if (participantSource) {\n setPickerKey((prev) => prev + 1) // Increment key to force remount\n setShowParticipantPicker(true)\n participantPickerRef.current?.showModal()\n }\n }, [participantSource])\n\n const handleSelectParticipant = useCallback(\n async (participant: Participant) => {\n if (!service) return\n\n try {\n if (debug) {\n console.log(\n '[MessagingShell] Starting conversation with:',\n participant.id\n )\n }\n\n const channel = await service.startChannelWithParticipant({\n id: participant.id,\n name: participant.name,\n email: participant.email,\n phone: participant.phone,\n })\n\n // Show the channel\n try {\n await channel.show()\n } catch (error) {\n console.warn('[MessagingShell] Failed to unhide channel:', error)\n }\n\n setSelectedChannel(channel)\n setShowParticipantPicker(false)\n participantPickerRef.current?.close()\n\n onParticipantSelect?.(participant)\n } catch (error) {\n console.error('[MessagingShell] Failed to start conversation:', error)\n }\n },\n [service, onParticipantSelect, debug]\n )\n\n const handleCloseParticipantPicker = useCallback(() => {\n setShowParticipantPicker(false)\n participantPickerRef.current?.close()\n }, [])\n\n const handleLeaveConversation = useCallback(\n async (channel: Channel) => {\n if (debug) {\n console.log('[MessagingShell] Leaving conversation:', channel.id)\n }\n setSelectedChannel(null)\n setDirectConversationMode(false) // Exit direct conversation mode\n\n // Force re-sync to update the existing participants list\n syncedRef.current = null\n await syncChannels()\n },\n [syncChannels, debug]\n )\n\n const handleBlockParticipant = useCallback(\n async (participantId?: string) => {\n if (debug) {\n console.log('[MessagingShell] Blocking participant:', participantId)\n }\n setSelectedChannel(null)\n setDirectConversationMode(false) // Exit direct conversation mode\n\n // Force re-sync to update the existing participants list\n syncedRef.current = null\n await syncChannels()\n },\n [syncChannels, debug]\n )\n\n const isChannelSelected = Boolean(selectedChannel)\n\n // Show loading state\n if (isLoading) {\n return (\n <div className={classNames('h-full', className)}>\n <LoadingState />\n </div>\n )\n }\n\n // Show error state\n if (error) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState message={error} onBack={refreshConnection} />\n </div>\n )\n }\n\n // Show not connected state\n if (!isConnected || !client) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState\n message=\"Not connected to messaging service\"\n onBack={refreshConnection}\n />\n </div>\n )\n }\n\n // Show direct conversation error state\n if (directConversationError) {\n return (\n <div className={classNames('h-full', className)}>\n <ErrorState message={directConversationError} />\n </div>\n )\n }\n\n return (\n <div\n className={classNames(\n 'messaging-shell h-full bg-white overflow-hidden',\n className\n )}\n >\n <div className=\"flex h-full min-h-0\">\n {/* Channel List Sidebar */}\n <div\n className={classNames(\n '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',\n {\n // Explicitly hidden via prop or in direct conversation mode\n '!hidden': showChannelList === false || directConversationMode,\n // Normal mode: hide on mobile when channel selected, show on desktop\n 'hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]':\n showChannelList !== false &&\n !directConversationMode &&\n isChannelSelected,\n // Normal mode: show when no channel selected\n 'flex flex-col w-full lg:flex-1 lg:max-w-2xl':\n showChannelList !== false &&\n !directConversationMode &&\n !isChannelSelected,\n }\n )}\n >\n <ChannelList\n onChannelSelect={handleChannelSelect}\n selectedChannel={selectedChannel || undefined}\n showStartConversation={\n showStartConversation && Boolean(participantSource)\n }\n onStartConversation={handleStartConversation}\n participantLabel={participantLabel}\n />\n </div>\n\n {/* Channel View */}\n <div\n className={classNames(\n 'messaging-conversation-view flex-1 flex-col min-w-0 min-h-0',\n {\n // In direct conversation mode, always show (full width)\n flex: directConversationMode || isChannelSelected,\n // Normal mode: hide on mobile when no channel selected\n 'hidden lg:flex': !directConversationMode && !isChannelSelected,\n }\n )}\n >\n {selectedChannel ? (\n <div className=\"flex-1 min-h-0 flex flex-col\">\n <ChannelView\n channel={selectedChannel}\n key={selectedChannel.id}\n onBack={handleBackToChannelList}\n showBackButton={!directConversationMode}\n renderMessageInputActions={renderMessageInputActions}\n onLeaveConversation={handleLeaveConversation}\n onBlockParticipant={handleBlockParticipant}\n CustomChannelEmptyState={CustomChannelEmptyState}\n />\n </div>\n ) : (\n <EmptyState\n hasChannels={hasChannels}\n onStartConversation={\n showStartConversation ? handleStartConversation : undefined\n }\n participantLabel={participantLabel}\n />\n )}\n </div>\n </div>\n\n {/* Participant Picker Dialog */}\n {participantSource && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n ref={participantPickerRef}\n className=\"mes-dialog\"\n onClick={(e) => {\n if (e.target === participantPickerRef.current) {\n handleCloseParticipantPicker()\n }\n }}\n onClose={handleCloseParticipantPicker}\n >\n <div className=\"h-full w-full bg-white shadow-max-elevation-light\">\n <ParticipantPicker\n key={pickerKey}\n participantSource={participantSource}\n onSelectParticipant={handleSelectParticipant}\n onClose={handleCloseParticipantPicker}\n existingParticipantIds={existingParticipantIds}\n participantLabel={participantLabel}\n searchPlaceholder={`Search ${participantLabel}...`}\n />\n </div>\n </dialog>\n )}\n </div>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\n\nexport interface FaqListItemProps {\n question: string\n onClick: () => void\n loading?: boolean\n className?: string\n}\n\nexport const FaqListItem: React.FC<FaqListItemProps> = ({\n question,\n onClick,\n loading = false,\n className,\n}) => {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={loading}\n style={{ backgroundColor: '#E6E5E3' }}\n className={classNames(\n 'w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors',\n {\n 'hover:brightness-95 active:brightness-90': !loading,\n 'opacity-50 cursor-not-allowed': loading,\n },\n className\n )}\n >\n {question}\n </button>\n )\n}\n","import classNames from 'classnames'\nimport React from 'react'\n\nimport { Avatar } from '../Avatar'\n\nimport { FaqListItem } from './FaqListItem'\n\nexport interface Faq {\n id: string\n question: string\n answer: string\n enabled: boolean\n order?: number | null\n}\n\nexport interface FaqListProps {\n faqs: Faq[]\n onFaqClick: (faqId: string) => void\n loadingFaqId?: string | null\n headerText?: string\n className?: string\n avatarImage?: string\n avatarName?: string\n}\n\nexport const FaqList: React.FC<FaqListProps> = ({\n faqs,\n onFaqClick,\n loadingFaqId,\n headerText,\n className,\n avatarImage,\n avatarName,\n}) => {\n const enabledFaqs = faqs\n .filter((faq) => faq.enabled)\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n\n if (enabledFaqs.length === 0) {\n return null\n }\n\n return (\n <div className={classNames('px-4 py-6', className)}>\n <div className=\"flex gap-3 items-end\">\n {/* Avatar at bottom-left, outside grey background */}\n {(avatarImage || avatarName) && (\n <div className=\"flex-none\">\n <Avatar\n id={avatarName || 'account'}\n name={avatarName || 'Account'}\n image={avatarImage}\n size={24}\n />\n </div>\n )}\n\n {/* FAQs with grey background */}\n <div\n className=\"flex-1 rounded-lg p-4 space-y-3\"\n style={{ backgroundColor: '#F1F0EE' }}\n >\n {headerText && (\n <p className=\"text-md text-charcoal mb-4\">{headerText}</p>\n )}\n {enabledFaqs.map((faq) => (\n <FaqListItem\n key={faq.id}\n question={faq.question}\n onClick={() => onFaqClick(faq.id)}\n loading={loadingFaqId === faq.id}\n />\n ))}\n </div>\n </div>\n </div>\n )\n}\n","import { useState, useEffect, useCallback } from 'react';\n\nimport type { ParticipantSource, Participant } from '../types';\n\n/**\n * Hook for managing participant loading with search and pagination\n */\nexport const useParticipants = (\n participantSource: ParticipantSource,\n options: {\n initialSearch?: string;\n pageSize?: number;\n } = {}\n) => {\n const { initialSearch = '', pageSize = 20 } = options;\n \n const [participants, setParticipants] = useState<Participant[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [searchQuery, setSearchQuery] = useState(initialSearch);\n const [hasMore, setHasMore] = useState(true);\n const [cursor, setCursor] = useState<string | undefined>();\n\n // Load participants with current search query\n const loadParticipants = useCallback(async (\n reset = false,\n customSearch?: string\n ) => {\n if (loading) return;\n \n const search = customSearch !== undefined ? customSearch : searchQuery;\n \n setLoading(true);\n setError(null);\n\n try {\n const result = await participantSource.loadParticipants({\n search: search || undefined,\n limit: pageSize,\n cursor: reset ? undefined : cursor,\n });\n\n setParticipants(prev => \n reset ? result.participants : [...prev, ...result.participants]\n );\n setHasMore(result.hasMore);\n setCursor(result.nextCursor);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to load participants';\n setError(errorMessage);\n console.error('[useParticipants] Load error:', err);\n } finally {\n setLoading(false);\n }\n }, [participantSource, searchQuery, cursor, pageSize, loading]);\n\n // Load more participants (pagination)\n const loadMore = useCallback(() => {\n if (hasMore && !loading) {\n loadParticipants(false);\n }\n }, [hasMore, loading, loadParticipants]);\n\n // Search participants\n const search = useCallback((query: string) => {\n setSearchQuery(query);\n setCursor(undefined);\n loadParticipants(true, query);\n }, [loadParticipants]);\n\n // Refresh participants\n const refresh = useCallback(() => {\n setCursor(undefined);\n loadParticipants(true);\n }, [loadParticipants]);\n\n // Initial load - only run once when participantSource changes\n useEffect(() => {\n loadParticipants(true);\n }, [participantSource.loadParticipants]); // Only depend on the function to avoid loops\n\n return {\n participants,\n loading,\n error,\n searchQuery,\n hasMore,\n totalCount: participantSource.totalCount,\n loadMore,\n search,\n refresh,\n };\n};\n"],"names":["MessagingContext","createContext","useMessagingContext","useContext","MessagingProvider","children","user","serviceConfig","apiKey","capabilities","customization","debug","debugLog","useCallback","message","args","service","setService","useState","client","setClient","isConnected","setIsConnected","isLoading","setIsLoading","error","setError","connectingRef","useRef","prevPropsRef","renderCountRef","useEffect","currentRender","newService","StreamChatService","connectedUserRef","_a","_b","streamClient","err","errorMessage","refreshConnection","contextValue","React","jsx","Chat","useMessaging","__importDefault","this","mod","exports","react_1","require$$0","classnames_1","require$$1","Base","className","onChange","onChangeValue","appearance","props","ref","baseInputStyles","handleChangeValue","value","checked","SelectPill_1","jsx_runtime_1","require$$2","Base_1","require$$3","SelectPill","id","name","label","defaultChecked","inactive","tabIndex","icon","selected","isInactive","handleKeyDown","key","code","SelectPillGroup_1","SelectPillGroup","IconButton","rest","jsxs","classNames","EMOJIS","hashString","str","hash","i","char","getAvatarEmoji","index","Avatar","image","size","emoji","fontSizeClass","CustomChannelPreview","channel","selectedChannel","onChannelSelect","unread","isSelected","handleClick","participant","member","participantName","participantImage","_c","lastMessage","_e","_d","lastMessageText","lastMessageTime","unreadCount","_f","ChannelList","showStartConversation","onStartConversation","participantLabel","useChatContext","staticFilters","setStaticFilters","filters","userId","newFilters","state","NotePencilIcon","StreamChannelList","ActionButton","variant","CloseButton","onClick","XIcon","ChannelEmptyState","CustomMessageInput","renderActions","MessageInput","CustomChannelHeader","onBack","showBackButton","onShowInfo","canShowInfo","useChannelStateContext","ArrowLeftIcon","DotsThreeIcon","ChannelInfoDialog","isOpen","onClose","followerStatusLabel","onLeaveConversation","onBlockParticipant","dialogRef","isParticipantBlocked","setIsParticipantBlocked","isLeaving","setIsLeaving","isUpdatingBlockStatus","setIsUpdatingBlockStatus","dialog","checkIsParticipantBlocked","isBlocked","handleLeaveConversation","actingUserId","handleBlockUser","handleUnblockUser","handleReportUser","participantEmail","participantUsername","participantSecondary","participantId","_g","e","SpinnerGapIcon","SignOutIcon","ProhibitInsetIcon","FlagIcon","ChannelViewInner","renderMessageInputActions","CustomChannelEmptyState","showInfo","setShowInfo","hasMessages","channelExtraData","Fragment","Window","MessageList","ChannelView","Channel","SearchInput","searchQuery","setSearchQuery","placeholder","searchInputRef","MagnifyingGlassIcon","ParticipantPicker","participantSource","onSelectParticipant","existingParticipantIds","searchPlaceholder","participants","setParticipants","loading","setLoading","startingChatWithId","setStartingChatWithId","loadedRef","result","availableParticipants","searchLower","handleSelectParticipant","event","ChatCircleDotsIcon","displayName","displaySecondary","EmptyState","hasChannels","TextButton","ErrorState","Loading","LoadingState","MessagingShell","onParticipantSelect","initialParticipantFilter","initialParticipantData","showChannelList","setSelectedChannel","setHasChannels","_showParticipantPicker","setShowParticipantPicker","setExistingParticipantIds","pickerKey","setPickerKey","directConversationMode","setDirectConversationMode","directConversationError","setDirectConversationError","participantPickerRef","syncedRef","syncChannels","channels","memberIds","members","memberId","createErr","handleChannelSelect","handleBackToChannelList","handleStartConversation","prev","handleCloseParticipantPicker","handleBlockParticipant","isChannelSelected","FaqListItem","question","FaqList","faqs","onFaqClick","loadingFaqId","headerText","avatarImage","avatarName","enabledFaqs","faq","a","b","useParticipants","options","initialSearch","pageSize","hasMore","setHasMore","cursor","setCursor","loadParticipants","reset","customSearch","search","loadMore","query","refresh"],"mappings":";;;;;;AAiCA,MAAMA,KAAmBC,GAAqC;AAAA,EAC5D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,cAAc,CAAA;AAAA,EACd,eAAe,CAAA;AAAA,EACf,mBAAmB,YAAY;AAAA,EAAC;AAAA,EAChC,OAAO;AACT,CAAC,GAKYC,KAAsB,MAAMC,GAAWH,EAAgB,GAKvDI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AAU,MAAS,GACnBC,EAAiB,EAAI;AAAA,EACvB,GAAG,CAACA,CAAgB,CAAC;AAGrB,SAAAxP,EAAU,MAAM;AACd,IAAAwP,EAAiB,EAAI;AAAA,EACvB,GAAG,CAAC7E,EAAkB,gBAAgB,CAAC,GAEhC;AAAA,IACL,cAAAI;AAAA,IACA,SAAAE;AAAA,IACA,OAAAvL;AAAA,IACA,aAAA2K;AAAA,IACA,SAAA+E;AAAA,IACA,YAAYzE,EAAkB;AAAA,IAC9B,UAAAiF;AAAA,IACA,QAAAD;AAAA,IACA,SAAAG;AAAA,EAAA;AAEJ;","x_google_ignoreList":[2,3,4,5]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,6 @@ export const Avatar: React.FC<AvatarProps> = ({
22
22
  }) => {
23
23
  const emoji = getAvatarEmoji(id)
24
24
 
25
- const DEFAULT_COLOR = '#FBFAF9'
26
25
  // Determine font size based on avatar size
27
26
  const getFontSizeClass = () => {
28
27
  if (size < 32) return 'text-xs'
@@ -50,13 +49,9 @@ export const Avatar: React.FC<AvatarProps> = ({
50
49
  <div
51
50
  aria-hidden="true"
52
51
  className={classNames(
53
- 'flex h-full w-full items-center justify-center font-semibold rounded-sm',
52
+ 'flex h-full w-full items-center justify-center font-semibold rounded-sm bg-[#FBFAF9]/60',
54
53
  fontSizeClass
55
54
  )}
56
- style={{
57
- color: DEFAULT_COLOR,
58
- backgroundColor: `color-mix(in srgb, ${DEFAULT_COLOR} 60%, solid)`,
59
- }}
60
55
  >
61
56
  {emoji}
62
57
  </div>