@dialtribe/chat-client 0.5.1 → 0.7.0
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/README.md +50 -3
- package/dist/index.d.mts +188 -5
- package/dist/index.d.ts +188 -5
- package/dist/index.js +444 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +443 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -300,6 +300,17 @@ var InboxStore = class extends Store {
|
|
|
300
300
|
this.removed.delete(roomId);
|
|
301
301
|
await this.refresh();
|
|
302
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Start a group with several people in one step. Each person's DM settings
|
|
305
|
+
* apply: those whose DMs are closed come back in `refused`. If only one
|
|
306
|
+
* person is left, `roomId` is your 1:1 with them.
|
|
307
|
+
*/
|
|
308
|
+
async createGroup(targetUserIds) {
|
|
309
|
+
const result = await this.client.dm("chat-dm-create-group", { targetUserIds });
|
|
310
|
+
this.removed.delete(result.roomId);
|
|
311
|
+
await this.refresh();
|
|
312
|
+
return { roomId: result.roomId, added: result.added ?? [], refused: result.refused ?? [] };
|
|
313
|
+
}
|
|
303
314
|
/** Add someone. Returns the room to show (a new group when added to a 1:1). */
|
|
304
315
|
async addParticipant(roomId, targetUserId, hint) {
|
|
305
316
|
const result = await this.client.dm("chat-dm-add-participant", {
|
|
@@ -638,6 +649,7 @@ var ChatClient = class {
|
|
|
638
649
|
this.rooms = /* @__PURE__ */ new Map();
|
|
639
650
|
this.inboxStore = null;
|
|
640
651
|
this.notificationsStore = null;
|
|
652
|
+
this.profiles = /* @__PURE__ */ new Map();
|
|
641
653
|
this.serverUrl = options.serverUrl.replace(/\/$/, "");
|
|
642
654
|
this.apiUrl = (options.apiUrl ?? "https://dialtribe.com").replace(/\/$/, "");
|
|
643
655
|
}
|
|
@@ -812,6 +824,40 @@ var ChatClient = class {
|
|
|
812
824
|
api(path, init = {}) {
|
|
813
825
|
return this.request(path, init, `${this.apiUrl}/api/public/v1`);
|
|
814
826
|
}
|
|
827
|
+
/**
|
|
828
|
+
* A person's mini-profile from Dialtribe, memoized per user for the life of
|
|
829
|
+
* the client. Network failures aren't remembered, so the next call retries.
|
|
830
|
+
*/
|
|
831
|
+
getProfile(userId) {
|
|
832
|
+
let lookup = this.profiles.get(userId);
|
|
833
|
+
if (!lookup) {
|
|
834
|
+
lookup = this.api(`/chat/profiles/${encodeURIComponent(userId)}`).then(
|
|
835
|
+
(profile) => ({ status: "ok", profile }),
|
|
836
|
+
(err) => {
|
|
837
|
+
if (err instanceof ChatRequestError && err.code === "not-found") {
|
|
838
|
+
return err.message === "not_supported" ? { status: "not_supported" } : { status: "hidden" };
|
|
839
|
+
}
|
|
840
|
+
this.profiles.delete(userId);
|
|
841
|
+
throw err;
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
this.profiles.set(userId, lookup);
|
|
845
|
+
}
|
|
846
|
+
return lookup;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* People whose handle starts with `query` (2+ characters), among those you can
|
|
850
|
+
* reach through this app's organization. Empty for apps not on Dialtribe identity.
|
|
851
|
+
*/
|
|
852
|
+
async searchPeople(query) {
|
|
853
|
+
try {
|
|
854
|
+
const { people } = await this.api(`/chat/people?q=${encodeURIComponent(query)}`);
|
|
855
|
+
return people;
|
|
856
|
+
} catch (err) {
|
|
857
|
+
if (err instanceof ChatRequestError && err.code === "not-found") return [];
|
|
858
|
+
throw err;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
815
861
|
/** A DM action on POST /dm (see DMS.md). */
|
|
816
862
|
dm(action, fields = {}) {
|
|
817
863
|
return this.request("/dm", { method: "POST", body: { action, ...fields } });
|
|
@@ -889,6 +935,24 @@ var MessagesUiStore = class extends Store {
|
|
|
889
935
|
openItem(itemId) {
|
|
890
936
|
this.update({ open: true, view: { kind: "item", itemId } });
|
|
891
937
|
}
|
|
938
|
+
/** The view to return to from a profile or the composer (never another overlay). */
|
|
939
|
+
returnTo() {
|
|
940
|
+
const current = this.getSnapshot().view;
|
|
941
|
+
return current.kind === "profile" || current.kind === "compose" ? current.from : current;
|
|
942
|
+
}
|
|
943
|
+
/** Show a person's mini-profile, returning to the current view on back. */
|
|
944
|
+
openProfile(userId, hint) {
|
|
945
|
+
this.update({ open: true, view: { kind: "profile", userId, from: this.returnTo(), hint } });
|
|
946
|
+
}
|
|
947
|
+
/** Show the "Start new" composer, returning to the current view on back. */
|
|
948
|
+
openCompose() {
|
|
949
|
+
this.update({ open: true, view: { kind: "compose", from: this.returnTo() } });
|
|
950
|
+
}
|
|
951
|
+
/** From a mini-profile or the composer, return to where it was opened. */
|
|
952
|
+
back() {
|
|
953
|
+
const { view } = this.getSnapshot();
|
|
954
|
+
this.update({ view: view.kind === "profile" || view.kind === "compose" ? view.from : { kind: "inbox" } });
|
|
955
|
+
}
|
|
892
956
|
};
|
|
893
957
|
var ClientContext = react.createContext(null);
|
|
894
958
|
var MessagesUiContext = react.createContext(null);
|
|
@@ -1003,6 +1067,19 @@ function useDialtribeMessages() {
|
|
|
1003
1067
|
openRoom: (roomId) => ui.openRoom(roomId),
|
|
1004
1068
|
openItem: (itemId) => ui.openItem(itemId),
|
|
1005
1069
|
openNotifications: () => ui.openNotifications(),
|
|
1070
|
+
openProfile: (userId, hint) => ui.openProfile(userId, hint),
|
|
1071
|
+
back: () => ui.back(),
|
|
1072
|
+
openCompose: () => ui.openCompose(),
|
|
1073
|
+
startConversation: async (userIds) => {
|
|
1074
|
+
if (userIds.length === 1) {
|
|
1075
|
+
const { roomId } = await client.inbox.requestDM(userIds[0]);
|
|
1076
|
+
ui.openRoom(roomId);
|
|
1077
|
+
return { roomId, added: userIds, refused: [] };
|
|
1078
|
+
}
|
|
1079
|
+
const result = await client.inbox.createGroup(userIds);
|
|
1080
|
+
ui.openRoom(result.roomId);
|
|
1081
|
+
return result;
|
|
1082
|
+
},
|
|
1006
1083
|
messageUser: async (userId, hint) => {
|
|
1007
1084
|
const result = await client.inbox.requestDM(userId, hint);
|
|
1008
1085
|
ui.openRoom(result.roomId);
|
|
@@ -1054,6 +1131,8 @@ function ChatMessageItem({
|
|
|
1054
1131
|
message,
|
|
1055
1132
|
config,
|
|
1056
1133
|
showAvatar = false,
|
|
1134
|
+
onAuthorClick,
|
|
1135
|
+
authorLabel = (name) => `View profile of ${name}`,
|
|
1057
1136
|
onReply,
|
|
1058
1137
|
onReact,
|
|
1059
1138
|
modActions
|
|
@@ -1081,7 +1160,7 @@ function ChatMessageItem({
|
|
|
1081
1160
|
message.replyPreview.text
|
|
1082
1161
|
] }),
|
|
1083
1162
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-message-row", children: [
|
|
1084
|
-
showAvatar && /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: message.authorName, url: message.avatarUrl, size: 28, className: "dtc-message-avatar" }),
|
|
1163
|
+
showAvatar && (onAuthorClick ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-person-btn", onClick: onAuthorClick, "aria-label": authorLabel(message.authorName), children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: message.authorName, url: message.avatarUrl, size: 28, className: "dtc-message-avatar" }) }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: message.authorName, url: message.avatarUrl, size: 28, className: "dtc-message-avatar" })),
|
|
1085
1164
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-message-content", children: [
|
|
1086
1165
|
message.isHost && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-badge dtc-badge-host", children: "HOST" }),
|
|
1087
1166
|
message.isModerator && !message.isHost && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-badge dtc-badge-mod", children: "MOD" }),
|
|
@@ -1094,7 +1173,16 @@ function ChatMessageItem({
|
|
|
1094
1173
|
children: flair.tag
|
|
1095
1174
|
}
|
|
1096
1175
|
),
|
|
1097
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1176
|
+
onAuthorClick ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1177
|
+
"button",
|
|
1178
|
+
{
|
|
1179
|
+
type: "button",
|
|
1180
|
+
className: `dtc-person-btn dtc-author ${message.isHost ? "dtc-author-host" : message.isModerator ? "dtc-author-mod" : ""}`,
|
|
1181
|
+
onClick: onAuthorClick,
|
|
1182
|
+
"aria-label": authorLabel(message.authorName),
|
|
1183
|
+
children: message.authorName
|
|
1184
|
+
}
|
|
1185
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `dtc-author ${message.isHost ? "dtc-author-host" : message.isModerator ? "dtc-author-mod" : ""}`, children: message.authorName }),
|
|
1098
1186
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-message-text", children: message.message })
|
|
1099
1187
|
] }),
|
|
1100
1188
|
showActions && (onReply || onReact || modActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-actions", children: [
|
|
@@ -1203,7 +1291,9 @@ function ChatPanel({
|
|
|
1203
1291
|
showAvatars = false,
|
|
1204
1292
|
canSend = true,
|
|
1205
1293
|
emptyLabel = "No messages yet",
|
|
1206
|
-
placeholder
|
|
1294
|
+
placeholder,
|
|
1295
|
+
onAuthorClick,
|
|
1296
|
+
authorLabel
|
|
1207
1297
|
}) {
|
|
1208
1298
|
const chat = useChatRoomContext();
|
|
1209
1299
|
const { messages, config, pinnedMessages, typingUsers, hasMoreHistory } = chat;
|
|
@@ -1271,6 +1361,8 @@ function ChatPanel({
|
|
|
1271
1361
|
message: msg,
|
|
1272
1362
|
config,
|
|
1273
1363
|
showAvatar: showAvatars,
|
|
1364
|
+
onAuthorClick: onAuthorClick && !msg.isBotMessage ? () => onAuthorClick({ userId: msg.authorId, name: msg.authorName, avatarUrl: msg.avatarUrl ?? null }) : void 0,
|
|
1365
|
+
authorLabel,
|
|
1274
1366
|
onReply: () => setReplyTo(msg),
|
|
1275
1367
|
onReact: (id, emoji) => void chat.addReaction(id, emoji).catch(() => {
|
|
1276
1368
|
}),
|
|
@@ -1361,7 +1453,21 @@ var DEFAULT_LABELS = {
|
|
|
1361
1453
|
if (s < 86400) return `${Math.floor(s / 3600)}h`;
|
|
1362
1454
|
if (s < 604800) return `${Math.floor(s / 86400)}d`;
|
|
1363
1455
|
return date.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
1364
|
-
}
|
|
1456
|
+
},
|
|
1457
|
+
viewSiteProfile: (site) => site ? `View ${site} profile` : "View profile",
|
|
1458
|
+
alsoOn: "Also on",
|
|
1459
|
+
message: "Message",
|
|
1460
|
+
viewProfileOf: (name) => `View profile of ${name}`,
|
|
1461
|
+
members: "Members",
|
|
1462
|
+
newMessage: "New message",
|
|
1463
|
+
searchPeople: "Search by handle",
|
|
1464
|
+
recent: "Recent",
|
|
1465
|
+
noPeopleFound: "No one found",
|
|
1466
|
+
start: "Start",
|
|
1467
|
+
cantMessage: (names) => `${names} can't be messaged right now`,
|
|
1468
|
+
openConversation: "Open conversation",
|
|
1469
|
+
removePerson: (name) => `Remove ${name}`,
|
|
1470
|
+
startFailed: "Couldn't start the conversation. Try again."
|
|
1365
1471
|
};
|
|
1366
1472
|
function badgeText(count) {
|
|
1367
1473
|
return count > 99 ? "99+" : String(count);
|
|
@@ -1513,10 +1619,12 @@ function KebabIcon() {
|
|
|
1513
1619
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "19", r: "1.8" })
|
|
1514
1620
|
] });
|
|
1515
1621
|
}
|
|
1516
|
-
function ConversationView({ roomId, labels, onBack, onClose, confirm }) {
|
|
1622
|
+
function ConversationView({ roomId, labels, onBack, onClose, confirm, onOpenProfile }) {
|
|
1517
1623
|
const inbox = useChatRooms();
|
|
1518
1624
|
const room = inbox.rooms.find((r) => r.roomId === roomId);
|
|
1519
1625
|
const { setVisible } = inbox;
|
|
1626
|
+
const [membersOpen, setMembersOpen] = react.useState(false);
|
|
1627
|
+
const other = room?.kind === "dm" ? room.participants[0] : void 0;
|
|
1520
1628
|
react.useEffect(() => setVisible(roomId), [setVisible, roomId]);
|
|
1521
1629
|
const isRequest = room?.myStatus === "pending";
|
|
1522
1630
|
const isClosed = room?.state === "closed";
|
|
@@ -1559,13 +1667,53 @@ function ConversationView({ roomId, labels, onBack, onClose, confirm }) {
|
|
|
1559
1667
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation", children: [
|
|
1560
1668
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation-header", children: [
|
|
1561
1669
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onBack, "aria-label": labels.back, title: labels.back, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeft, {}) }),
|
|
1562
|
-
|
|
1563
|
-
|
|
1670
|
+
other ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1671
|
+
"button",
|
|
1672
|
+
{
|
|
1673
|
+
type: "button",
|
|
1674
|
+
className: "dtc-person-btn dtc-conversation-person",
|
|
1675
|
+
onClick: () => onOpenProfile(other.userId, { name: other.name, avatarUrl: other.avatarUrl }),
|
|
1676
|
+
"aria-label": labels.viewProfileOf(other.name),
|
|
1677
|
+
children: [
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: other.name, url: other.avatarUrl, size: 28 }),
|
|
1679
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title", children: room?.name ?? "" })
|
|
1680
|
+
]
|
|
1681
|
+
}
|
|
1682
|
+
) : room?.kind === "group" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1683
|
+
"button",
|
|
1684
|
+
{
|
|
1685
|
+
type: "button",
|
|
1686
|
+
className: "dtc-person-btn dtc-conversation-person",
|
|
1687
|
+
onClick: () => setMembersOpen((v) => !v),
|
|
1688
|
+
"aria-expanded": membersOpen,
|
|
1689
|
+
"aria-label": labels.members,
|
|
1690
|
+
children: [
|
|
1691
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: room.name, size: 28 }),
|
|
1692
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title", children: room.name })
|
|
1693
|
+
]
|
|
1694
|
+
}
|
|
1695
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1696
|
+
room && /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: room.name, size: 28 }),
|
|
1697
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title", children: room?.name ?? "" })
|
|
1698
|
+
] }),
|
|
1564
1699
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-conversation-actions", children: [
|
|
1565
1700
|
/* @__PURE__ */ jsxRuntime.jsx(ConversationMenu, { label: labels.moreOptions, items: menuItems }),
|
|
1566
1701
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onClose, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
|
|
1567
1702
|
] })
|
|
1568
1703
|
] }),
|
|
1704
|
+
membersOpen && room?.kind === "group" && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "dtc-member-list", "aria-label": labels.members, children: room.participants.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1705
|
+
"button",
|
|
1706
|
+
{
|
|
1707
|
+
type: "button",
|
|
1708
|
+
className: "dtc-member",
|
|
1709
|
+
onClick: () => onOpenProfile(p.userId, { name: p.name, avatarUrl: p.avatarUrl }),
|
|
1710
|
+
"aria-label": labels.viewProfileOf(p.name),
|
|
1711
|
+
children: [
|
|
1712
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: p.name, url: p.avatarUrl, size: 24 }),
|
|
1713
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-member-name", children: p.name })
|
|
1714
|
+
]
|
|
1715
|
+
}
|
|
1716
|
+
) }, p.userId)) }),
|
|
1569
1717
|
isRequest && room && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-request-banner", role: "region", "aria-label": labels.requests, children: [
|
|
1570
1718
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.wantsToMessage(room.name) }),
|
|
1571
1719
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-request-actions", children: [
|
|
@@ -1597,7 +1745,9 @@ function ConversationView({ roomId, labels, onBack, onClose, confirm }) {
|
|
|
1597
1745
|
showPinnedMessages: false,
|
|
1598
1746
|
canSend: !isRequest && !isClosed,
|
|
1599
1747
|
emptyLabel: labels.noMessages,
|
|
1600
|
-
placeholder: labels.messagePlaceholder
|
|
1748
|
+
placeholder: labels.messagePlaceholder,
|
|
1749
|
+
onAuthorClick: (a) => onOpenProfile(a.userId, { name: a.name, avatarUrl: a.avatarUrl }),
|
|
1750
|
+
authorLabel: labels.viewProfileOf
|
|
1601
1751
|
}
|
|
1602
1752
|
) })
|
|
1603
1753
|
] });
|
|
@@ -1701,6 +1851,238 @@ function NotificationsPanel({ labels, onClose, onOpen, onOpened }) {
|
|
|
1701
1851
|
] })
|
|
1702
1852
|
] });
|
|
1703
1853
|
}
|
|
1854
|
+
function fallbackProfile(userId, hint, canMessage) {
|
|
1855
|
+
return {
|
|
1856
|
+
userId,
|
|
1857
|
+
name: hint?.name || userId,
|
|
1858
|
+
handle: null,
|
|
1859
|
+
avatarUrl: hint?.avatarUrl ?? null,
|
|
1860
|
+
bio: null,
|
|
1861
|
+
current: null,
|
|
1862
|
+
apps: [],
|
|
1863
|
+
canMessage
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
function ProfileView({
|
|
1867
|
+
userId,
|
|
1868
|
+
hint,
|
|
1869
|
+
labels,
|
|
1870
|
+
onBack,
|
|
1871
|
+
onClose,
|
|
1872
|
+
onNavigate,
|
|
1873
|
+
onMessage,
|
|
1874
|
+
hideMessage,
|
|
1875
|
+
getProfileUrl,
|
|
1876
|
+
profileActions
|
|
1877
|
+
}) {
|
|
1878
|
+
const client = useChatClient();
|
|
1879
|
+
const [lookup, setLookup] = react.useState(null);
|
|
1880
|
+
react.useEffect(() => {
|
|
1881
|
+
let live = true;
|
|
1882
|
+
setLookup(null);
|
|
1883
|
+
client.getProfile(userId).then(
|
|
1884
|
+
(result) => live && setLookup(result),
|
|
1885
|
+
() => live && setLookup({ status: "not_supported" })
|
|
1886
|
+
);
|
|
1887
|
+
return () => {
|
|
1888
|
+
live = false;
|
|
1889
|
+
};
|
|
1890
|
+
}, [client, userId]);
|
|
1891
|
+
const profile = lookup?.status === "ok" ? lookup.profile : fallbackProfile(userId, hint, lookup?.status !== "hidden");
|
|
1892
|
+
const fallbackUrl = lookup?.status === "not_supported" ? getProfileUrl?.(userId) ?? null : null;
|
|
1893
|
+
const primary = profile.current ? { url: profile.current.profileUrl, label: labels.viewSiteProfile(profile.current.siteName) } : fallbackUrl ? { url: fallbackUrl, label: labels.viewSiteProfile("") } : null;
|
|
1894
|
+
const showHandle = !!profile.handle && profile.handle.toLowerCase() !== profile.name.toLowerCase();
|
|
1895
|
+
const showMessage = !hideMessage && lookup !== null && profile.canMessage;
|
|
1896
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation", children: [
|
|
1897
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation-header", children: [
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onBack, "aria-label": labels.back, title: labels.back, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeft2, {}) }),
|
|
1899
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title" }),
|
|
1900
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onClose, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon2, {}) })
|
|
1901
|
+
] }),
|
|
1902
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-profile", children: [
|
|
1903
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-profile-head", children: [
|
|
1904
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: profile.name, url: profile.avatarUrl, size: 64 }),
|
|
1905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-profile-names", children: [
|
|
1906
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-profile-name", children: profile.name }),
|
|
1907
|
+
showHandle && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-profile-handle", children: [
|
|
1908
|
+
"@",
|
|
1909
|
+
profile.handle
|
|
1910
|
+
] })
|
|
1911
|
+
] })
|
|
1912
|
+
] }),
|
|
1913
|
+
profile.bio && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "dtc-profile-bio", children: profile.bio }),
|
|
1914
|
+
primary && /* @__PURE__ */ jsxRuntime.jsx("a", { className: "dtc-btn dtc-btn-primary dtc-profile-primary", href: primary.url, onClick: onNavigate, children: primary.label }),
|
|
1915
|
+
profile.apps.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-profile-sites", children: [
|
|
1916
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-profile-sites-title", children: labels.alsoOn }),
|
|
1917
|
+
profile.apps.map((site) => {
|
|
1918
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1919
|
+
site.iconUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "dtc-profile-site-icon", src: site.iconUrl, alt: "" }) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: site.siteName, size: 20, className: "dtc-profile-site-icon" }),
|
|
1920
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-profile-site-name", children: site.siteName }),
|
|
1921
|
+
site.url && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, {})
|
|
1922
|
+
] });
|
|
1923
|
+
return site.url ? /* @__PURE__ */ jsxRuntime.jsx("a", { className: "dtc-profile-site", href: site.url, target: "_blank", rel: "noopener noreferrer", children: body }, site.appId) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-profile-site", children: body }, site.appId);
|
|
1924
|
+
})
|
|
1925
|
+
] }),
|
|
1926
|
+
showMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1927
|
+
"button",
|
|
1928
|
+
{
|
|
1929
|
+
type: "button",
|
|
1930
|
+
className: "dtc-btn dtc-profile-message",
|
|
1931
|
+
onClick: () => onMessage(userId, { name: profile.name, avatarUrl: profile.avatarUrl }),
|
|
1932
|
+
children: labels.message
|
|
1933
|
+
}
|
|
1934
|
+
),
|
|
1935
|
+
profileActions && lookup !== null && lookup.status !== "hidden" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dtc-profile-actions", children: profileActions(profile) })
|
|
1936
|
+
] })
|
|
1937
|
+
] });
|
|
1938
|
+
}
|
|
1939
|
+
function ChevronLeft2() {
|
|
1940
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 18l-6-6 6-6" }) });
|
|
1941
|
+
}
|
|
1942
|
+
function CloseIcon2() {
|
|
1943
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) });
|
|
1944
|
+
}
|
|
1945
|
+
function ArrowIcon() {
|
|
1946
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 17L17 7M9 7h8v8" }) });
|
|
1947
|
+
}
|
|
1948
|
+
var SEARCH_MIN = 2;
|
|
1949
|
+
var SEARCH_DEBOUNCE_MS = 250;
|
|
1950
|
+
function ComposeView({ labels, onBack, onClose, onOpenRoom }) {
|
|
1951
|
+
const client = useChatClient();
|
|
1952
|
+
const inbox = useChatRooms();
|
|
1953
|
+
const [query, setQuery] = react.useState("");
|
|
1954
|
+
const [results, setResults] = react.useState(null);
|
|
1955
|
+
const [picked, setPicked] = react.useState([]);
|
|
1956
|
+
const [busy, setBusy] = react.useState(false);
|
|
1957
|
+
const [notice, setNotice] = react.useState(null);
|
|
1958
|
+
const inputRef = react.useRef(null);
|
|
1959
|
+
const selfId = client.self?.userId;
|
|
1960
|
+
react.useEffect(() => inputRef.current?.focus(), []);
|
|
1961
|
+
const recent = react.useMemo(() => {
|
|
1962
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1963
|
+
const people = [];
|
|
1964
|
+
for (const room of inbox.rooms) {
|
|
1965
|
+
for (const p of room.participants) {
|
|
1966
|
+
if (p.userId === selfId || seen.has(p.userId)) continue;
|
|
1967
|
+
seen.add(p.userId);
|
|
1968
|
+
people.push({ userId: p.userId, name: p.name, handle: null, avatarUrl: p.avatarUrl });
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return people;
|
|
1972
|
+
}, [inbox.rooms, selfId]);
|
|
1973
|
+
const q = query.trim().replace(/^@/, "");
|
|
1974
|
+
react.useEffect(() => {
|
|
1975
|
+
if (q.length < SEARCH_MIN) {
|
|
1976
|
+
setResults(null);
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
let live = true;
|
|
1980
|
+
const timer = setTimeout(() => {
|
|
1981
|
+
client.searchPeople(q).then(
|
|
1982
|
+
(people) => live && setResults(people),
|
|
1983
|
+
() => live && setResults([])
|
|
1984
|
+
);
|
|
1985
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
1986
|
+
return () => {
|
|
1987
|
+
live = false;
|
|
1988
|
+
clearTimeout(timer);
|
|
1989
|
+
};
|
|
1990
|
+
}, [client, q]);
|
|
1991
|
+
const searching = q.length >= SEARCH_MIN;
|
|
1992
|
+
const list = searching ? results ?? [] : recent;
|
|
1993
|
+
const pickedIds = new Set(picked.map((p) => p.userId));
|
|
1994
|
+
const toggle = (person) => {
|
|
1995
|
+
setNotice(null);
|
|
1996
|
+
setPicked(
|
|
1997
|
+
(current) => current.some((p) => p.userId === person.userId) ? current.filter((p) => p.userId !== person.userId) : [...current, person]
|
|
1998
|
+
);
|
|
1999
|
+
};
|
|
2000
|
+
const namesOf = (ids) => picked.filter((p) => ids.includes(p.userId)).map((p) => p.name).join(", ");
|
|
2001
|
+
const start = async () => {
|
|
2002
|
+
if (!picked.length || busy) return;
|
|
2003
|
+
setBusy(true);
|
|
2004
|
+
setNotice(null);
|
|
2005
|
+
try {
|
|
2006
|
+
if (picked.length === 1) {
|
|
2007
|
+
const { roomId } = await client.inbox.requestDM(picked[0].userId, {
|
|
2008
|
+
name: picked[0].name,
|
|
2009
|
+
avatarUrl: picked[0].avatarUrl ?? void 0
|
|
2010
|
+
});
|
|
2011
|
+
onOpenRoom(roomId);
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
const result = await client.inbox.createGroup(picked.map((p) => p.userId));
|
|
2015
|
+
if (result.refused.length) setNotice({ text: labels.cantMessage(namesOf(result.refused)), roomId: result.roomId });
|
|
2016
|
+
else onOpenRoom(result.roomId);
|
|
2017
|
+
} catch (err) {
|
|
2018
|
+
const refused = err instanceof ChatRequestError && err.code === "dm-not-allowed";
|
|
2019
|
+
setNotice({ text: refused ? labels.cantMessage(namesOf(picked.map((p) => p.userId))) : labels.startFailed, roomId: null });
|
|
2020
|
+
} finally {
|
|
2021
|
+
setBusy(false);
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation", children: [
|
|
2025
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation-header", children: [
|
|
2026
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onBack, "aria-label": labels.back, title: labels.back, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeft3, {}) }),
|
|
2027
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title", children: labels.newMessage }),
|
|
2028
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: onClose, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon3, {}) })
|
|
2029
|
+
] }),
|
|
2030
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-compose", children: [
|
|
2031
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-compose-field", children: [
|
|
2032
|
+
picked.map((p) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-compose-chip", children: [
|
|
2033
|
+
p.name,
|
|
2034
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => toggle(p), "aria-label": labels.removePerson(p.name), children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon3, { size: 12 }) })
|
|
2035
|
+
] }, p.userId)),
|
|
2036
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2037
|
+
"input",
|
|
2038
|
+
{
|
|
2039
|
+
ref: inputRef,
|
|
2040
|
+
className: "dtc-compose-input",
|
|
2041
|
+
value: query,
|
|
2042
|
+
onChange: (e) => setQuery(e.target.value.slice(0, 50)),
|
|
2043
|
+
onKeyDown: (e) => {
|
|
2044
|
+
if (e.key === "Backspace" && !query && picked.length) setPicked(picked.slice(0, -1));
|
|
2045
|
+
},
|
|
2046
|
+
placeholder: picked.length ? "" : labels.searchPeople,
|
|
2047
|
+
"aria-label": labels.searchPeople
|
|
2048
|
+
}
|
|
2049
|
+
)
|
|
2050
|
+
] }),
|
|
2051
|
+
!searching && recent.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-profile-sites-title", children: labels.recent }),
|
|
2052
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "dtc-compose-list", children: list.map((person) => {
|
|
2053
|
+
const on = pickedIds.has(person.userId);
|
|
2054
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "dtc-member", "aria-pressed": on, onClick: () => toggle(person), children: [
|
|
2055
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: person.name, url: person.avatarUrl, size: 32 }),
|
|
2056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-compose-names", children: [
|
|
2057
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-member-name", children: person.name }),
|
|
2058
|
+
person.handle && person.handle.toLowerCase() !== person.name.toLowerCase() && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "dtc-profile-handle", children: [
|
|
2059
|
+
"@",
|
|
2060
|
+
person.handle
|
|
2061
|
+
] })
|
|
2062
|
+
] }),
|
|
2063
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `dtc-compose-check ${on ? "dtc-compose-check-on" : ""}`, "aria-hidden": "true", children: on && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) })
|
|
2064
|
+
] }) }, person.userId);
|
|
2065
|
+
}) }),
|
|
2066
|
+
searching && results !== null && results.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dtc-empty", children: labels.noPeopleFound })
|
|
2067
|
+
] }),
|
|
2068
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-compose-footer", children: [
|
|
2069
|
+
notice && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation-note", children: [
|
|
2070
|
+
notice.text,
|
|
2071
|
+
notice.roomId && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-text-btn", onClick: () => onOpenRoom(notice.roomId), children: labels.openConversation })
|
|
2072
|
+
] }),
|
|
2073
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-btn dtc-btn-primary dtc-compose-start", disabled: !picked.length || busy, onClick: () => void start(), children: labels.start })
|
|
2074
|
+
] })
|
|
2075
|
+
] });
|
|
2076
|
+
}
|
|
2077
|
+
function ChevronLeft3() {
|
|
2078
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 18l-6-6 6-6" }) });
|
|
2079
|
+
}
|
|
2080
|
+
function CloseIcon3({ size = 18 }) {
|
|
2081
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: size, height: size, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) });
|
|
2082
|
+
}
|
|
2083
|
+
function CheckIcon() {
|
|
2084
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12l5 5L20 7" }) });
|
|
2085
|
+
}
|
|
1704
2086
|
var RAIL_WIDTH = 64;
|
|
1705
2087
|
var EDGE_SWIPE_ZONE = 24;
|
|
1706
2088
|
var SWIPE_DISTANCE = 60;
|
|
@@ -1717,7 +2099,9 @@ function DialtribeMessages({
|
|
|
1717
2099
|
railDmLimit = 5,
|
|
1718
2100
|
mobileBreakpoint = 768,
|
|
1719
2101
|
confirm: hostConfirm,
|
|
1720
|
-
notifications = false
|
|
2102
|
+
notifications = false,
|
|
2103
|
+
getProfileUrl,
|
|
2104
|
+
profileActions
|
|
1721
2105
|
}) {
|
|
1722
2106
|
const labels = react.useMemo(() => ({ ...DEFAULT_LABELS, ...labelOverrides }), [labelOverrides]);
|
|
1723
2107
|
const inbox = useChatRooms();
|
|
@@ -1784,6 +2168,14 @@ function DialtribeMessages({
|
|
|
1784
2168
|
item.id
|
|
1785
2169
|
);
|
|
1786
2170
|
};
|
|
2171
|
+
const client = useChatClient();
|
|
2172
|
+
const openProfile = (userId, hint) => ui.openProfile(userId, hint);
|
|
2173
|
+
const hideMessageFor = (userId, from) => {
|
|
2174
|
+
if (client.self?.userId === userId) return true;
|
|
2175
|
+
if (from.kind !== "room") return false;
|
|
2176
|
+
const room = inbox.rooms.find((r) => r.roomId === from.roomId);
|
|
2177
|
+
return room?.kind === "dm" && room.participants[0]?.userId === userId;
|
|
2178
|
+
};
|
|
1787
2179
|
const style = { ...themeVars(theme), "--dtc-panel-width": `${panelWidth}px`, "--dtc-rail-width": `${RAIL_WIDTH}px` };
|
|
1788
2180
|
const showRail = !isMobile || isOpen;
|
|
1789
2181
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1798,7 +2190,25 @@ function DialtribeMessages({
|
|
|
1798
2190
|
rollup > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-badge-count dtc-badge-float", children: badgeText(rollup) })
|
|
1799
2191
|
] }),
|
|
1800
2192
|
isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-messages-panel", role: "dialog", "aria-label": activeItem?.label ?? labels.messages, children: [
|
|
1801
|
-
view.kind === "
|
|
2193
|
+
view.kind === "compose" ? /* @__PURE__ */ jsxRuntime.jsx(ComposeView, { labels, onBack: ui.back, onClose: ui.close, onOpenRoom: ui.openRoom }) : view.kind === "profile" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2194
|
+
ProfileView,
|
|
2195
|
+
{
|
|
2196
|
+
userId: view.userId,
|
|
2197
|
+
hint: view.hint,
|
|
2198
|
+
labels,
|
|
2199
|
+
onBack: ui.back,
|
|
2200
|
+
onClose: ui.close,
|
|
2201
|
+
onNavigate: () => {
|
|
2202
|
+
if (isMobile) ui.close();
|
|
2203
|
+
},
|
|
2204
|
+
onMessage: (userId, hint) => void ui.messageUser(userId, { name: hint.name, avatarUrl: hint.avatarUrl ?? void 0 }).catch(() => {
|
|
2205
|
+
}),
|
|
2206
|
+
hideMessage: hideMessageFor(view.userId, view.from),
|
|
2207
|
+
getProfileUrl,
|
|
2208
|
+
profileActions
|
|
2209
|
+
},
|
|
2210
|
+
view.userId
|
|
2211
|
+
) : view.kind === "notifications" && notifications !== false ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1802
2212
|
NotificationsPanel,
|
|
1803
2213
|
{
|
|
1804
2214
|
labels,
|
|
@@ -1811,7 +2221,8 @@ function DialtribeMessages({
|
|
|
1811
2221
|
) : activeItem ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dtc-item-panel", children: typeof activeItem.panel === "function" ? activeItem.panel({ close: ui.close }) : activeItem.panel }) : view.kind !== "room" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1812
2222
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-panel-header", children: [
|
|
1813
2223
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-panel-title", children: labels.messages }),
|
|
1814
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.
|
|
2224
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.openCompose, "aria-label": labels.newMessage, title: labels.newMessage, children: /* @__PURE__ */ jsxRuntime.jsx(ComposeIcon, {}) }),
|
|
2225
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.close, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon4, {}) })
|
|
1815
2226
|
] }),
|
|
1816
2227
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1817
2228
|
MessagesInbox,
|
|
@@ -1828,9 +2239,18 @@ function DialtribeMessages({
|
|
|
1828
2239
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "dtc-conversation-header", children: [
|
|
1829
2240
|
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { name: activeContext.label, url: activeContext.avatarUrl, size: 28 }),
|
|
1830
2241
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dtc-conversation-title", children: activeContext.label }),
|
|
1831
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.close, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2242
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "dtc-icon-btn", onClick: ui.close, "aria-label": labels.close, title: labels.close, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon4, {}) })
|
|
1832
2243
|
] }),
|
|
1833
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChatRoomProvider, { roomId: activeContext.roomId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2244
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChatRoomProvider, { roomId: activeContext.roomId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2245
|
+
ChatPanel,
|
|
2246
|
+
{
|
|
2247
|
+
showHeader: false,
|
|
2248
|
+
emptyLabel: labels.noMessages,
|
|
2249
|
+
placeholder: labels.messagePlaceholder,
|
|
2250
|
+
onAuthorClick: (a) => openProfile(a.userId, { name: a.name, avatarUrl: a.avatarUrl }),
|
|
2251
|
+
authorLabel: labels.viewProfileOf
|
|
2252
|
+
}
|
|
2253
|
+
) })
|
|
1834
2254
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1835
2255
|
ConversationView,
|
|
1836
2256
|
{
|
|
@@ -1838,7 +2258,8 @@ function DialtribeMessages({
|
|
|
1838
2258
|
labels,
|
|
1839
2259
|
onBack: ui.openInbox,
|
|
1840
2260
|
onClose: ui.close,
|
|
1841
|
-
confirm
|
|
2261
|
+
confirm,
|
|
2262
|
+
onOpenProfile: openProfile
|
|
1842
2263
|
},
|
|
1843
2264
|
view.roomId
|
|
1844
2265
|
),
|
|
@@ -2061,7 +2482,13 @@ function useNotificationsBadge(enabled) {
|
|
|
2061
2482
|
const snapshot = react.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
2062
2483
|
return enabled ? snapshot.unreadCount : 0;
|
|
2063
2484
|
}
|
|
2064
|
-
function
|
|
2485
|
+
function ComposeIcon() {
|
|
2486
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
2487
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 20h9" }),
|
|
2488
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z" })
|
|
2489
|
+
] });
|
|
2490
|
+
}
|
|
2491
|
+
function CloseIcon4() {
|
|
2065
2492
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) });
|
|
2066
2493
|
}
|
|
2067
2494
|
|
|
@@ -2072,10 +2499,12 @@ exports.ChatMessageItem = ChatMessageItem;
|
|
|
2072
2499
|
exports.ChatPanel = ChatPanel;
|
|
2073
2500
|
exports.ChatRequestError = ChatRequestError;
|
|
2074
2501
|
exports.ChatRoomProvider = ChatRoomProvider;
|
|
2502
|
+
exports.ComposeView = ComposeView;
|
|
2075
2503
|
exports.DEFAULT_LABELS = DEFAULT_LABELS;
|
|
2076
2504
|
exports.DialtribeChatProvider = DialtribeChatProvider;
|
|
2077
2505
|
exports.DialtribeMessages = DialtribeMessages;
|
|
2078
2506
|
exports.NotificationsPanel = NotificationsPanel;
|
|
2507
|
+
exports.ProfileView = ProfileView;
|
|
2079
2508
|
exports.parseReactions = parseReactions;
|
|
2080
2509
|
exports.useChatClient = useChatClient;
|
|
2081
2510
|
exports.useChatConnection = useChatConnection;
|