@linktr.ee/messaging-react 1.24.3-rc-1773689393 → 1.24.3-rc-1773798185

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
@@ -2,8 +2,8 @@ import { jsx as e, jsxs as i, Fragment as me } from "react/jsx-runtime";
2
2
  import T from "classnames";
3
3
  import B, { createContext as ot, useContext as lt, useCallback as L, useState as M, useRef as J, useEffect as Q, useMemo as Ee } from "react";
4
4
  import { StreamChatService as it } from "@linktr.ee/messaging-core";
5
- import { Chat as ct, ChannelList as dt, DateSeparator as ut, useChannelStateContext as Se, useChatContext as $e, areMessageUIPropsEqual as mt, useMessageReminder as ht, useComponentContext as ft, Attachment as gt, EditMessageModal as xt, MessageBlocked as bt, MessageBouncePrompt as Ct, MessageDeleted as Nt, MessageIsThreadReplyInChannelButtonIndicator as vt, MessageRepliesCountButton as wt, ReminderNotification as pt, StreamedMessageText as yt, messageHasAttachments as Et, messageHasReactions as _t, isDateSeparatorMessage as It, isMessageBlocked as St, isMessageBounced as Mt, MessageBounceModal as kt, Poll as Dt, MessageText as Tt, MessageErrorIcon as Rt, useMessageContext as je, useMessageComposer as Lt, useStateStore as Pt, MessageInput as Ut, useMessageInputContext as Ot, useMessageComposerHasSendableData as Ft, SimpleAttachmentSelector as At, QuotedMessagePreview as Bt, AttachmentPreviewList as $t, TextareaComposer as jt, MessageTimestamp as Te, Channel as Gt, WithComponents as Vt, Window as Ht, MessageList as zt } from "stream-chat-react";
6
- import { GiftIcon as Wt, XIcon as Me, SpinnerGapIcon as be, SignOutIcon as qt, ProhibitInsetIcon as Re, FlagIcon as Yt, ArrowUpIcon as Zt, SparkleIcon as Jt, ArrowLeftIcon as Le, StarIcon as Pe, DotsThreeIcon as Ue, MagnifyingGlassIcon as Qt, ChatCircleDotsIcon as Oe } from "@phosphor-icons/react";
5
+ import { Chat as ct, ChannelList as dt, DateSeparator as ut, useChannelStateContext as Se, useChatContext as $e, areMessageUIPropsEqual as mt, useMessageReminder as ht, useComponentContext as ft, Attachment as gt, EditMessageModal as xt, MessageBlocked as bt, MessageBouncePrompt as Ct, MessageDeleted as Nt, MessageIsThreadReplyInChannelButtonIndicator as vt, MessageRepliesCountButton as wt, ReminderNotification as pt, StreamedMessageText as yt, messageHasAttachments as Et, messageHasReactions as _t, isDateSeparatorMessage as It, isMessageBlocked as St, isMessageBounced as Mt, MessageBounceModal as kt, Poll as Dt, MessageText as Tt, MessageErrorIcon as Rt, useMessageContext as je, useMessageComposer as Lt, useStateStore as Ut, MessageInput as Pt, useMessageInputContext as Ot, useMessageComposerHasSendableData as Ft, SimpleAttachmentSelector as At, QuotedMessagePreview as Bt, AttachmentPreviewList as $t, TextareaComposer as jt, MessageTimestamp as Te, Channel as Gt, WithComponents as Vt, Window as Ht, MessageList as zt } from "stream-chat-react";
6
+ import { GiftIcon as Wt, XIcon as Me, SpinnerGapIcon as be, SignOutIcon as qt, ProhibitInsetIcon as Re, FlagIcon as Yt, ArrowUpIcon as Zt, SparkleIcon as Jt, ArrowLeftIcon as Le, StarIcon as Ue, DotsThreeIcon as Pe, MagnifyingGlassIcon as Qt, ChatCircleDotsIcon as Oe } from "@phosphor-icons/react";
7
7
  import { LinkPreviewsManager as Fe } from "stream-chat";
8
8
  const Ge = ot({
9
9
  service: null,
@@ -129,10 +129,10 @@ const Ge = ot({
129
129
  clientId: C.userID
130
130
  });
131
131
  } catch (C) {
132
- const U = C instanceof Error ? C.message : "Connection failed";
133
- b(U), a("❌ USER CONNECTION ERROR", {
132
+ const P = C instanceof Error ? C.message : "Connection failed";
133
+ b(P), a("❌ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: U
135
+ error: P
136
136
  });
137
137
  } finally {
138
138
  y(!1), S.current = !1, a("🔄 USER CONNECTION FINISHED", {
@@ -575,8 +575,8 @@ const ds = ({
575
575
  }) => {
576
576
  var z, j, ne, ae, G, K, re;
577
577
  const { service: r, debug: y } = ve(), [E, b] = M(!1), [S, p] = M(!1), [x, w] = M(!1), R = L(async () => {
578
- var P;
579
- if (!(!r || !((P = n == null ? void 0 : n.user) != null && P.id)))
578
+ var U;
579
+ if (!(!r || !((U = n == null ? void 0 : n.user) != null && U.id)))
580
580
  try {
581
581
  const A = (await r.getBlockedUsers()).some(
582
582
  (V) => {
@@ -596,11 +596,11 @@ const ds = ({
596
596
  R();
597
597
  }, [R]);
598
598
  const u = async () => {
599
- var P;
599
+ var U;
600
600
  if (!S) {
601
601
  g == null || g(), y && console.log("[ChannelInfoDialog] Leave conversation", o.cid), p(!0);
602
602
  try {
603
- const O = ((P = o._client) == null ? void 0 : P.userID) ?? null;
603
+ const O = ((U = o._client) == null ? void 0 : U.userID) ?? null;
604
604
  await o.hide(O, !1), h && await h(o), s();
605
605
  } catch (O) {
606
606
  console.error("[ChannelInfoDialog] Failed to leave conversation", O);
@@ -609,9 +609,9 @@ const ds = ({
609
609
  }
610
610
  }
611
611
  }, m = async () => {
612
- var P, O, A;
612
+ var U, O, A;
613
613
  if (!(x || !r)) {
614
- f == null || f(), y && console.log("[ChannelInfoDialog] Block member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), w(!0);
614
+ f == null || f(), y && console.log("[ChannelInfoDialog] Block member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), w(!0);
615
615
  try {
616
616
  await r.blockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
617
617
  } catch (V) {
@@ -621,9 +621,9 @@ const ds = ({
621
621
  }
622
622
  }
623
623
  }, d = async () => {
624
- var P, O, A;
624
+ var U, O, A;
625
625
  if (!(x || !r)) {
626
- f == null || f(), y && console.log("[ChannelInfoDialog] Unblock member", (P = n == null ? void 0 : n.user) == null ? void 0 : P.id), w(!0);
626
+ f == null || f(), y && console.log("[ChannelInfoDialog] Unblock member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), w(!0);
627
627
  try {
628
628
  await r.unBlockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
629
629
  } catch (V) {
@@ -640,7 +640,7 @@ const ds = ({
640
640
  );
641
641
  };
642
642
  if (!n) return null;
643
- const C = ((j = n.user) == null ? void 0 : j.name) || ((ne = n.user) == null ? void 0 : ne.id) || "Unknown member", U = (ae = n.user) == null ? void 0 : ae.image, X = (G = n.user) == null ? void 0 : G.email, Y = (K = n.user) == null ? void 0 : K.username, q = X || (Y ? `linktr.ee/${Y}` : void 0), D = ((re = n.user) == null ? void 0 : re.id) || "unknown";
643
+ const C = ((j = n.user) == null ? void 0 : j.name) || ((ne = n.user) == null ? void 0 : ne.id) || "Unknown member", P = (ae = n.user) == null ? void 0 : ae.image, X = (G = n.user) == null ? void 0 : G.email, Y = (K = n.user) == null ? void 0 : K.username, q = X || (Y ? `linktr.ee/${Y}` : void 0), D = ((re = n.user) == null ? void 0 : re.id) || "unknown";
644
644
  return (
645
645
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
646
646
  /* @__PURE__ */ e(
@@ -649,8 +649,8 @@ const ds = ({
649
649
  ref: t,
650
650
  className: "mes-dialog group",
651
651
  onClose: s,
652
- onClick: (P) => {
653
- P.target === t.current && s();
652
+ onClick: (U) => {
653
+ U.target === t.current && s();
654
654
  },
655
655
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
656
656
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
@@ -669,7 +669,7 @@ const ds = ({
669
669
  {
670
670
  id: D,
671
671
  name: C,
672
- image: U,
672
+ image: P,
673
673
  size: 88,
674
674
  shape: "circle"
675
675
  }
@@ -677,7 +677,7 @@ const ds = ({
677
677
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
678
678
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: C }),
679
679
  q && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: q }),
680
- l && /* @__PURE__ */ e(
680
+ l && !N && /* @__PURE__ */ e(
681
681
  "span",
682
682
  {
683
683
  className: "mt-1 rounded-full text-xs font-normal w-fit",
@@ -844,7 +844,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
844
844
  EditMessageModal: d = xt,
845
845
  MessageBlocked: k = bt,
846
846
  MessageBouncePrompt: C = Ct,
847
- MessageDeleted: U = Nt,
847
+ MessageDeleted: P = Nt,
848
848
  MessageIsThreadReplyInChannelButtonIndicator: X = vt,
849
849
  MessageRepliesCountButton: Y = wt,
850
850
  ReminderNotification: q = pt,
@@ -860,12 +860,12 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
860
860
  if (It(r))
861
861
  return null;
862
862
  if (r.deleted_at || r.type === "deleted")
863
- return /* @__PURE__ */ e(U, { message: r });
863
+ return /* @__PURE__ */ e(P, { message: r });
864
864
  if (St(r))
865
865
  return /* @__PURE__ */ e(k, {});
866
- const K = !E && !!r.reply_count, re = !E && r.show_in_channel && r.parent_id, P = r.status === "failed" && ((de = r.error) == null ? void 0 : de.status) !== 403, O = Mt(r);
866
+ const K = !E && !!r.reply_count, re = !E && r.show_in_channel && r.parent_id, U = r.status === "failed" && ((de = r.error) == null ? void 0 : de.status) !== 403, O = Mt(r);
867
867
  let A;
868
- P ? A = () => f(r) : O && (A = () => p(!0));
868
+ U ? A = () => f(r) : O && (A = () => p(!0));
869
869
  const V = I(), ce = T(
870
870
  "str-chat__message str-chat__message-simple",
871
871
  `str-chat__message--${r.type}`,
@@ -915,7 +915,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
915
915
  "div",
916
916
  {
917
917
  className: T("str-chat__message-inner", {
918
- "str-chat__simple-message--error-failed": P || O
918
+ "str-chat__simple-message--error-failed": U || O
919
919
  }),
920
920
  "data-testid": "message-inner",
921
921
  onClick: A,
@@ -1038,7 +1038,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
1038
1038
  }
1039
1039
  );
1040
1040
  }, ps = () => {
1041
- const { linkPreviewsManager: t } = Lt(), { linkPreviews: s } = Pt(
1041
+ const { linkPreviewsManager: t } = Lt(), { linkPreviews: s } = Ut(
1042
1042
  t.state,
1043
1043
  vs
1044
1044
  ), n = (l) => {
@@ -1088,7 +1088,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
1088
1088
  renderActions: t
1089
1089
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
1090
1090
  t && (t == null ? void 0 : t()),
1091
- /* @__PURE__ */ e(Ut, { Input: ys })
1091
+ /* @__PURE__ */ e(Pt, { Input: ys })
1092
1092
  ] }), _s = [
1093
1093
  "SYSTEM_DM_AGENT_PAUSED",
1094
1094
  "SYSTEM_DM_AGENT_RESUMED"
@@ -1259,7 +1259,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1259
1259
  type: "button",
1260
1260
  "aria-label": f ? "Unstar conversation" : "Star conversation",
1261
1261
  children: /* @__PURE__ */ e(
1262
- Pe,
1262
+ Ue,
1263
1263
  {
1264
1264
  className: T("size-5", {
1265
1265
  "text-yellow-600": f,
@@ -1277,7 +1277,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1277
1277
  onClick: n,
1278
1278
  type: "button",
1279
1279
  "aria-label": "Show info",
1280
- children: /* @__PURE__ */ e(Ue, { className: "size-5 text-black/90" })
1280
+ children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
1281
1281
  }
1282
1282
  )
1283
1283
  ] })
@@ -1314,7 +1314,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1314
1314
  type: "button",
1315
1315
  "aria-label": f ? "Unstar conversation" : "Star conversation",
1316
1316
  children: /* @__PURE__ */ e(
1317
- Pe,
1317
+ Ue,
1318
1318
  {
1319
1319
  className: T("size-5", {
1320
1320
  "text-yellow-600": f,
@@ -1332,7 +1332,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1332
1332
  onClick: n,
1333
1333
  type: "button",
1334
1334
  "aria-label": "Show info",
1335
- children: /* @__PURE__ */ e(Ue, { className: "size-5 text-black/90" })
1335
+ children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
1336
1336
  }
1337
1337
  )
1338
1338
  ] })
@@ -1467,9 +1467,9 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1467
1467
  const u = L(
1468
1468
  async (m, d, k) => {
1469
1469
  var D;
1470
- const C = ((D = t.data) == null ? void 0 : D.chatbot_paused) === !0, U = r && !C, X = {
1470
+ const C = ((D = t.data) == null ? void 0 : D.chatbot_paused) === !0, P = r && !C, X = {
1471
1471
  ...d,
1472
- ...U && { silent: !0 },
1472
+ ...P && { silent: !0 },
1473
1473
  ...y && {
1474
1474
  metadata: {
1475
1475
  ...d.metadata ?? {},
@@ -1478,7 +1478,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1478
1478
  }
1479
1479
  }, Y = {
1480
1480
  ...k,
1481
- ...U && { skip_push: !0 }
1481
+ ...P && { skip_push: !0 }
1482
1482
  }, q = await t.sendMessage(X, Y);
1483
1483
  return E == null || E(q), q;
1484
1484
  },
@@ -1568,7 +1568,7 @@ function Ls({
1568
1568
  )
1569
1569
  ] });
1570
1570
  }
1571
- const Ps = ({
1571
+ const Us = ({
1572
1572
  participantSource: t,
1573
1573
  onSelectParticipant: s,
1574
1574
  onClose: n,
@@ -1705,7 +1705,7 @@ const Ps = ({
1705
1705
  ] }) })
1706
1706
  ] }) })
1707
1707
  ] });
1708
- }, Us = ({ className: t }) => /* @__PURE__ */ i(
1708
+ }, Ps = ({ className: t }) => /* @__PURE__ */ i(
1709
1709
  "svg",
1710
1710
  {
1711
1711
  width: "140",
@@ -1841,7 +1841,7 @@ const Ps = ({
1841
1841
  }
1842
1842
  ), Je = B.memo(
1843
1843
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1844
- /* @__PURE__ */ e(Us, {}),
1844
+ /* @__PURE__ */ e(Ps, {}),
1845
1845
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1846
1846
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1847
1847
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
@@ -1894,12 +1894,12 @@ const zs = ({
1894
1894
  const {
1895
1895
  service: k,
1896
1896
  client: C,
1897
- isConnected: U,
1897
+ isConnected: P,
1898
1898
  isLoading: X,
1899
1899
  error: Y,
1900
1900
  refreshConnection: q,
1901
1901
  debug: D
1902
- } = Xt(), [z, j] = M(null), [ne, ae] = M(!1), [G, K] = M(!1), [re, P] = M(!1), [O, A] = M(/* @__PURE__ */ new Set()), [V, ce] = M(0), [W, oe] = M(!1), [ee, Z] = M(null), te = J(null), {
1902
+ } = Xt(), [z, j] = M(null), [ne, ae] = M(!1), [G, K] = M(!1), [re, U] = M(!1), [O, A] = M(/* @__PURE__ */ new Set()), [V, ce] = M(0), [W, oe] = M(!1), [ee, Z] = M(null), te = J(null), {
1903
1903
  participantSource: de,
1904
1904
  participantLabel: ue = "participants",
1905
1905
  showDeleteConversation: Qe = !0
@@ -1917,7 +1917,7 @@ const zs = ({
1917
1917
  ...v
1918
1918
  };
1919
1919
  }, [v, C == null ? void 0 : C.userID]), he = J(null), le = L(async () => {
1920
- if (!C || !U) return;
1920
+ if (!C || !P) return;
1921
1921
  const _ = C.userID;
1922
1922
  if (_)
1923
1923
  try {
@@ -1944,13 +1944,13 @@ const zs = ({
1944
1944
  } catch (H) {
1945
1945
  console.error("[MessagingShell] Failed to sync channels:", H);
1946
1946
  }
1947
- }, [C, U, D]);
1947
+ }, [C, P, D]);
1948
1948
  Q(() => {
1949
- if (!C || !U) return;
1949
+ if (!C || !P) return;
1950
1950
  const _ = C.userID;
1951
1951
  _ && he.current !== _ && le();
1952
- }, [C, U, le]), Q(() => {
1953
- if (!a || !C || !U) return;
1952
+ }, [C, P, le]), Q(() => {
1953
+ if (!a || !C || !P) return;
1954
1954
  (async () => {
1955
1955
  const H = C.userID;
1956
1956
  if (H)
@@ -2012,7 +2012,7 @@ const zs = ({
2012
2012
  a,
2013
2013
  c,
2014
2014
  C,
2015
- U,
2015
+ P,
2016
2016
  k,
2017
2017
  D,
2018
2018
  l
@@ -2044,7 +2044,7 @@ const zs = ({
2044
2044
  } catch ($) {
2045
2045
  console.warn("[MessagingShell] Failed to unhide channel:", $);
2046
2046
  }
2047
- j(F), P(!1), (H = te.current) == null || H.close(), h == null || h(_);
2047
+ j(F), U(!1), (H = te.current) == null || H.close(), h == null || h(_);
2048
2048
  } catch (F) {
2049
2049
  console.error("[MessagingShell] Failed to start conversation:", F);
2050
2050
  }
@@ -2052,7 +2052,7 @@ const zs = ({
2052
2052
  [k, h, D]
2053
2053
  ), fe = L(() => {
2054
2054
  var _;
2055
- P(!1), (_ = te.current) == null || _.close();
2055
+ U(!1), (_ = te.current) == null || _.close();
2056
2056
  }, []), st = L(
2057
2057
  (_) => {
2058
2058
  _.target === te.current && fe();
@@ -2069,7 +2069,7 @@ const zs = ({
2069
2069
  },
2070
2070
  [le, D]
2071
2071
  ), ge = !!z;
2072
- return X ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : Y ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Ce, { message: Y, onBack: q }) }) : !U || !C ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(
2072
+ return X ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : Y ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Ce, { message: Y, onBack: q }) }) : !P || !C ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(
2073
2073
  Ce,
2074
2074
  {
2075
2075
  message: "Not connected to messaging service",
@@ -2169,7 +2169,7 @@ const zs = ({
2169
2169
  onClick: st,
2170
2170
  onClose: fe,
2171
2171
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
2172
- Ps,
2172
+ Us,
2173
2173
  {
2174
2174
  participantSource: de,
2175
2175
  onSelectParticipant: tt,
@@ -2300,7 +2300,7 @@ export {
2300
2300
  xs as MessageVoteButtons,
2301
2301
  Hs as MessagingProvider,
2302
2302
  zs as MessagingShell,
2303
- Ps as ParticipantPicker,
2303
+ Us as ParticipantPicker,
2304
2304
  ss as formatRelativeTime,
2305
2305
  hs as useMessageVote,
2306
2306
  Xt as useMessaging,