@realtimexsco/live-chat 1.3.0 → 1.3.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/README.md +194 -13
- package/dist/index.cjs +227 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +78 -10
- package/dist/index.d.ts +78 -10
- package/dist/index.mjs +227 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -370,7 +370,6 @@ var init_socket_service = __esm({
|
|
|
370
370
|
});
|
|
371
371
|
this.disconnect();
|
|
372
372
|
}
|
|
373
|
-
console.log("Socket: Starting connection to", config.url);
|
|
374
373
|
this.currentConfig = config;
|
|
375
374
|
this.isConnecting = true;
|
|
376
375
|
const store = getStore();
|
|
@@ -379,7 +378,6 @@ var init_socket_service = __esm({
|
|
|
379
378
|
this.socket = io(config.url, config.options);
|
|
380
379
|
this.socket.on("connect", () => {
|
|
381
380
|
this.isConnecting = false;
|
|
382
|
-
console.log("Connected to socket with ID:", this.socket?.id);
|
|
383
381
|
setConnected({ socketId: this.socket?.id || "" });
|
|
384
382
|
this.emitGetOnlineUsers();
|
|
385
383
|
});
|
|
@@ -880,8 +878,16 @@ var init_conversation_helpers = __esm({
|
|
|
880
878
|
},
|
|
881
879
|
existing
|
|
882
880
|
);
|
|
883
|
-
|
|
884
|
-
|
|
881
|
+
if (index < 0) {
|
|
882
|
+
return [normalized, ...conversations];
|
|
883
|
+
}
|
|
884
|
+
if (lastMessageChanged) {
|
|
885
|
+
const withoutExisting = conversations.filter((_, itemIndex) => itemIndex !== index);
|
|
886
|
+
return [normalized, ...withoutExisting];
|
|
887
|
+
}
|
|
888
|
+
const next = [...conversations];
|
|
889
|
+
next[index] = normalized;
|
|
890
|
+
return next;
|
|
885
891
|
};
|
|
886
892
|
findConversationById = (conversations, conversationId) => {
|
|
887
893
|
if (!conversationId) return void 0;
|
|
@@ -1086,13 +1092,109 @@ var init_connection_actions = __esm({
|
|
|
1086
1092
|
});
|
|
1087
1093
|
}
|
|
1088
1094
|
});
|
|
1089
|
-
|
|
1095
|
+
|
|
1096
|
+
// src/services/api/query-params.ts
|
|
1097
|
+
function resolveChatApiKey(url) {
|
|
1098
|
+
if (!url) return null;
|
|
1099
|
+
const path = url.split("?")[0] || "";
|
|
1100
|
+
if (path.includes("/user/login/client-user")) return "login";
|
|
1101
|
+
if (path.includes("/user/list")) return "users";
|
|
1102
|
+
if (path.includes("/conversation/list")) return "conversations";
|
|
1103
|
+
if (path.includes("/conversation/get/information/")) return "conversationInfo";
|
|
1104
|
+
if (path.includes("/message/get-all-from-conversation")) return "messages";
|
|
1105
|
+
if (path.includes("message/pinned-messages") || path.includes("/message/pinned-messages")) {
|
|
1106
|
+
return "pinnedMessages";
|
|
1107
|
+
}
|
|
1108
|
+
if (path.includes("message/starred-messages") || path.includes("/message/starred-messages")) {
|
|
1109
|
+
return "starredMessages";
|
|
1110
|
+
}
|
|
1111
|
+
if (path.includes("/message/search-messages")) return "searchMessages";
|
|
1112
|
+
if (path.includes("/message/searched-message/context")) return "searchMessagesContext";
|
|
1113
|
+
if (path.includes("/conversation/group/create")) return "createGroup";
|
|
1114
|
+
if (path.includes("/conversation/group/permission/update")) return "updateGroupPermissions";
|
|
1115
|
+
if (path.includes("/conversation/group/information/update")) return "updateGroupInfo";
|
|
1116
|
+
if (path.includes("/conversation/group/participants/add-remove")) return "manageMembers";
|
|
1117
|
+
if (path.includes("/conversation/group/admins/add-remove")) return "manageAdmins";
|
|
1118
|
+
if (path.includes("/user/block-unblock")) return "blockUnblock";
|
|
1119
|
+
if (path.includes("/aws/upload/get-presigned-urls")) return "presignedUrls";
|
|
1120
|
+
return null;
|
|
1121
|
+
}
|
|
1122
|
+
function isChatGetApiKey(key) {
|
|
1123
|
+
return !!key && CHAT_GET_API_KEYS.includes(key);
|
|
1124
|
+
}
|
|
1125
|
+
function normalizeQueryParams(params) {
|
|
1126
|
+
if (!params || typeof params !== "object") return {};
|
|
1127
|
+
const next = {};
|
|
1128
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1129
|
+
if (value === void 0 || value === null) continue;
|
|
1130
|
+
const trimmedKey = String(key).trim();
|
|
1131
|
+
if (!trimmedKey) continue;
|
|
1132
|
+
next[trimmedKey] = String(value);
|
|
1133
|
+
}
|
|
1134
|
+
return next;
|
|
1135
|
+
}
|
|
1136
|
+
function normalizeQueryParamsByApi(byApi) {
|
|
1137
|
+
if (!byApi || typeof byApi !== "object") return {};
|
|
1138
|
+
const next = {};
|
|
1139
|
+
for (const [apiKey, params] of Object.entries(byApi)) {
|
|
1140
|
+
if (apiKey === "all" || apiKey === "get") continue;
|
|
1141
|
+
next[apiKey] = normalizeQueryParams(params);
|
|
1142
|
+
}
|
|
1143
|
+
return next;
|
|
1144
|
+
}
|
|
1145
|
+
var CHAT_GET_API_KEYS, CHAT_API_KEYS;
|
|
1146
|
+
var init_query_params = __esm({
|
|
1147
|
+
"src/services/api/query-params.ts"() {
|
|
1148
|
+
CHAT_GET_API_KEYS = [
|
|
1149
|
+
"users",
|
|
1150
|
+
"conversations",
|
|
1151
|
+
"conversationInfo",
|
|
1152
|
+
"messages",
|
|
1153
|
+
"pinnedMessages",
|
|
1154
|
+
"starredMessages",
|
|
1155
|
+
"searchMessages",
|
|
1156
|
+
"searchMessagesContext"
|
|
1157
|
+
];
|
|
1158
|
+
CHAT_API_KEYS = [
|
|
1159
|
+
"all",
|
|
1160
|
+
/** All GET endpoints listed in CHAT_GET_API_KEYS */
|
|
1161
|
+
"get",
|
|
1162
|
+
"login",
|
|
1163
|
+
...CHAT_GET_API_KEYS,
|
|
1164
|
+
"createGroup",
|
|
1165
|
+
"updateGroupPermissions",
|
|
1166
|
+
"updateGroupInfo",
|
|
1167
|
+
"manageMembers",
|
|
1168
|
+
"manageAdmins",
|
|
1169
|
+
"blockUnblock",
|
|
1170
|
+
"presignedUrls"
|
|
1171
|
+
];
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
function resolveParamsForRequest(url, method) {
|
|
1175
|
+
const apiKey = resolveChatApiKey(url);
|
|
1176
|
+
const httpMethod = (method || "get").toLowerCase();
|
|
1177
|
+
const isGet = httpMethod === "get";
|
|
1178
|
+
const perApi = apiKey ? chatQueryParamsByApi[apiKey] : void 0;
|
|
1179
|
+
const applyShared = Object.keys(chatQueryParams).length > 0 && (chatQueryParamApis.includes("all") || chatQueryParamApis.includes("get") && isGet && isChatGetApiKey(apiKey) || apiKey != null && chatQueryParamApis.includes(apiKey));
|
|
1180
|
+
if (!applyShared && !perApi) return {};
|
|
1181
|
+
return {
|
|
1182
|
+
...applyShared ? chatQueryParams : {},
|
|
1183
|
+
...perApi || {}
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
var chatClientId, chatAccessToken, chatBaseUrl, chatSocketUrl, chatQueryParams, chatQueryParamApis, chatQueryParamsByApi, setChatClientId, getChatClientId, setChatAccessToken, setChatBaseURL, getChatBaseUrl, setChatSocketUrl, getChatSocketUrl, setChatQueryParams, getChatQueryParams, setChatQueryParamApis, getChatQueryParamApis, setChatQueryParamsByApi, getChatQueryParamsByApi, rateLimitResetAt, isRateLimited, apiClient;
|
|
1090
1187
|
var init_client = __esm({
|
|
1091
1188
|
"src/services/api/client.ts"() {
|
|
1189
|
+
init_query_params();
|
|
1190
|
+
init_query_params();
|
|
1092
1191
|
chatClientId = "";
|
|
1093
1192
|
chatAccessToken = "";
|
|
1094
1193
|
chatBaseUrl = "";
|
|
1095
1194
|
chatSocketUrl = "";
|
|
1195
|
+
chatQueryParams = {};
|
|
1196
|
+
chatQueryParamApis = ["get"];
|
|
1197
|
+
chatQueryParamsByApi = {};
|
|
1096
1198
|
setChatClientId = (id) => {
|
|
1097
1199
|
chatClientId = id.trim();
|
|
1098
1200
|
};
|
|
@@ -1109,6 +1211,22 @@ var init_client = __esm({
|
|
|
1109
1211
|
chatSocketUrl = url.trim();
|
|
1110
1212
|
};
|
|
1111
1213
|
getChatSocketUrl = () => chatSocketUrl;
|
|
1214
|
+
setChatQueryParams = (params) => {
|
|
1215
|
+
chatQueryParams = normalizeQueryParams(params);
|
|
1216
|
+
};
|
|
1217
|
+
getChatQueryParams = () => ({ ...chatQueryParams });
|
|
1218
|
+
setChatQueryParamApis = (apis) => {
|
|
1219
|
+
if (!apis?.length) {
|
|
1220
|
+
chatQueryParamApis = ["get"];
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
chatQueryParamApis = [...apis];
|
|
1224
|
+
};
|
|
1225
|
+
getChatQueryParamApis = () => [...chatQueryParamApis];
|
|
1226
|
+
setChatQueryParamsByApi = (byApi) => {
|
|
1227
|
+
chatQueryParamsByApi = normalizeQueryParamsByApi(byApi);
|
|
1228
|
+
};
|
|
1229
|
+
getChatQueryParamsByApi = () => ({ ...chatQueryParamsByApi });
|
|
1112
1230
|
rateLimitResetAt = 0;
|
|
1113
1231
|
isRateLimited = () => Date.now() < rateLimitResetAt;
|
|
1114
1232
|
apiClient = axios.create({
|
|
@@ -1125,6 +1243,11 @@ var init_client = __esm({
|
|
|
1125
1243
|
config.headers.set("platform", "web");
|
|
1126
1244
|
config.headers.set("is-tenant", "true");
|
|
1127
1245
|
config.headers.set("x-client-id", chatClientId);
|
|
1246
|
+
const requestUrl = String(config.url || "");
|
|
1247
|
+
const scopedParams = resolveParamsForRequest(requestUrl, config.method);
|
|
1248
|
+
if (Object.keys(scopedParams).length > 0) {
|
|
1249
|
+
config.params = { ...scopedParams, ...config.params };
|
|
1250
|
+
}
|
|
1128
1251
|
try {
|
|
1129
1252
|
const { useStore: useStore2 } = (init_useStore(), __toCommonJS(useStore_exports));
|
|
1130
1253
|
const accessToken = useStore2.getState().accessToken || chatAccessToken;
|
|
@@ -4310,6 +4433,9 @@ var Chat = ({
|
|
|
4310
4433
|
loggedUserDetails,
|
|
4311
4434
|
apiUrl,
|
|
4312
4435
|
socketUrl,
|
|
4436
|
+
queryParams,
|
|
4437
|
+
queryParamApis,
|
|
4438
|
+
queryParamsByApi,
|
|
4313
4439
|
channelsData,
|
|
4314
4440
|
messagesData,
|
|
4315
4441
|
onMessageReceived,
|
|
@@ -4329,6 +4455,9 @@ var Chat = ({
|
|
|
4329
4455
|
if (!clientId || !loggedUserDetails) return;
|
|
4330
4456
|
setSessionReady(false);
|
|
4331
4457
|
setChatClientId(clientId);
|
|
4458
|
+
setChatQueryParams(queryParams);
|
|
4459
|
+
setChatQueryParamApis(queryParamApis);
|
|
4460
|
+
setChatQueryParamsByApi(queryParamsByApi);
|
|
4332
4461
|
const resolvedApiUrl = resolveApiUrl(apiUrl);
|
|
4333
4462
|
const resolvedSocketUrl = resolveSocketUrl(socketUrl, resolvedApiUrl);
|
|
4334
4463
|
if (resolvedApiUrl) setChatBaseURL(resolvedApiUrl);
|
|
@@ -4398,9 +4527,22 @@ var Chat = ({
|
|
|
4398
4527
|
initializeChat();
|
|
4399
4528
|
return () => {
|
|
4400
4529
|
setSessionReady(false);
|
|
4530
|
+
setChatQueryParams({});
|
|
4531
|
+
setChatQueryParamApis(["get"]);
|
|
4532
|
+
setChatQueryParamsByApi({});
|
|
4401
4533
|
socket_service_default.disconnect();
|
|
4402
4534
|
};
|
|
4403
4535
|
}, [client?.id, loggedUserDetails?._id, loggedUserDetails?.email, accessToken, apiUrl, socketUrl, setSession, setSessionReady]);
|
|
4536
|
+
const queryConfigKey = JSON.stringify({
|
|
4537
|
+
queryParams: queryParams ?? {},
|
|
4538
|
+
queryParamApis: queryParamApis ?? ["get"],
|
|
4539
|
+
queryParamsByApi: queryParamsByApi ?? {}
|
|
4540
|
+
});
|
|
4541
|
+
React2.useEffect(() => {
|
|
4542
|
+
setChatQueryParams(queryParams);
|
|
4543
|
+
setChatQueryParamApis(queryParamApis);
|
|
4544
|
+
setChatQueryParamsByApi(queryParamsByApi);
|
|
4545
|
+
}, [queryConfigKey]);
|
|
4404
4546
|
React2.useEffect(() => {
|
|
4405
4547
|
if (lastDM && onMessageReceived) {
|
|
4406
4548
|
onMessageReceived(lastDM);
|
|
@@ -5272,19 +5414,6 @@ function SheetTitle({
|
|
|
5272
5414
|
}
|
|
5273
5415
|
);
|
|
5274
5416
|
}
|
|
5275
|
-
function SheetDescription({
|
|
5276
|
-
className,
|
|
5277
|
-
...props
|
|
5278
|
-
}) {
|
|
5279
|
-
return /* @__PURE__ */ jsx(
|
|
5280
|
-
Dialog$1.Description,
|
|
5281
|
-
{
|
|
5282
|
-
"data-slot": "sheet-description",
|
|
5283
|
-
className: cn("text-muted-foreground text-sm", className),
|
|
5284
|
-
...props
|
|
5285
|
-
}
|
|
5286
|
-
);
|
|
5287
|
-
}
|
|
5288
5417
|
function AlertDialog({
|
|
5289
5418
|
...props
|
|
5290
5419
|
}) {
|
|
@@ -5612,7 +5741,7 @@ function useCreateChatDialog({
|
|
|
5612
5741
|
onUserSelect?.({
|
|
5613
5742
|
id: user._id,
|
|
5614
5743
|
name: user.name.charAt(0).toUpperCase() + user.name.slice(1),
|
|
5615
|
-
image: user.image ||
|
|
5744
|
+
image: user.image || void 0,
|
|
5616
5745
|
email: user.email,
|
|
5617
5746
|
isOnline: onlineUsersIds.includes(user._id),
|
|
5618
5747
|
isGroup: false,
|
|
@@ -6024,14 +6153,14 @@ var LoggedUserDetails = ({
|
|
|
6024
6153
|
isActive: loggedUserDetails?.isActive ?? true,
|
|
6025
6154
|
createdAt: loggedUserDetails?.createdAt ? new Date(loggedUserDetails.createdAt) : /* @__PURE__ */ new Date(),
|
|
6026
6155
|
updatedAt: loggedUserDetails?.updatedAt ? new Date(loggedUserDetails.updatedAt) : /* @__PURE__ */ new Date(),
|
|
6027
|
-
image: loggedUserDetails?.image ||
|
|
6156
|
+
image: loggedUserDetails?.image || void 0
|
|
6028
6157
|
};
|
|
6029
6158
|
return /* @__PURE__ */ jsxs("div", { className: "shrink-0 border-b border-(--chat-border) bg-(--chat-surface) px-3 pb-3 pt-3", children: [
|
|
6030
6159
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
6031
6160
|
/* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
|
|
6032
6161
|
/* @__PURE__ */ jsxs(Avatar, { className: "size-8 ring-1 ring-(--chat-surface)", children: [
|
|
6033
|
-
/* @__PURE__ */ jsx(AvatarImage, { src: user
|
|
6034
|
-
/* @__PURE__ */ jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: user.name.charAt(0).toUpperCase() })
|
|
6162
|
+
user.image ? /* @__PURE__ */ jsx(AvatarImage, { src: user.image, alt: user.name }) : null,
|
|
6163
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: (user.name || "?").charAt(0).toUpperCase() })
|
|
6035
6164
|
] }),
|
|
6036
6165
|
/* @__PURE__ */ jsx("span", { className: "absolute -bottom-0.5 -right-0.5 size-2 rounded-full border-2 border-(--chat-surface) bg-(--chat-online)" })
|
|
6037
6166
|
] }),
|
|
@@ -6650,7 +6779,7 @@ function useChannelList({ debouncedSearch = "" }) {
|
|
|
6650
6779
|
const conversationId = String(c._id);
|
|
6651
6780
|
const { id: otherParticipantId, user: resolvedUser } = isGroup ? { id: conversationId, user: null } : resolveOtherParticipant(c, loggedUserDetails?._id, allUsers);
|
|
6652
6781
|
const name = isGroup ? c.groupName || c.name || "Group Chat" : resolvedUser?.name || "Unknown User";
|
|
6653
|
-
const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image ||
|
|
6782
|
+
const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image || void 0;
|
|
6654
6783
|
const isOnline = isGroup ? false : otherParticipantId ? onlineUserIds.includes(otherParticipantId) : false;
|
|
6655
6784
|
const unreadCount = normalizeUnreadCount(c.unreadCount, loggedUserDetails?._id);
|
|
6656
6785
|
const isTyping = typingUsersByConv[String(c._id)]?.length > 0;
|
|
@@ -6735,7 +6864,7 @@ function ChannelListItem({ channel, activeChannel, onChannelSelect }) {
|
|
|
6735
6864
|
children: [
|
|
6736
6865
|
/* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
|
|
6737
6866
|
/* @__PURE__ */ jsxs(Avatar, { className: "size-9", children: [
|
|
6738
|
-
/* @__PURE__ */ jsx(AvatarImage, { src: channel.image, alt: channel.name }),
|
|
6867
|
+
channel.image ? /* @__PURE__ */ jsx(AvatarImage, { src: channel.image, alt: channel.name }) : null,
|
|
6739
6868
|
/* @__PURE__ */ jsx(AvatarFallback, { className: cn(
|
|
6740
6869
|
"text-[10px] font-medium",
|
|
6741
6870
|
isActive ? "bg-(--chat-theme-20) text-(--chat-theme)" : "bg-(--chat-input-bg) text-(--chat-muted)"
|
|
@@ -8377,6 +8506,18 @@ function MessageForwardedLabel({ isSender, className, overlay }) {
|
|
|
8377
8506
|
}
|
|
8378
8507
|
);
|
|
8379
8508
|
}
|
|
8509
|
+
function GroupSenderName({ name, className }) {
|
|
8510
|
+
return /* @__PURE__ */ jsx(
|
|
8511
|
+
"span",
|
|
8512
|
+
{
|
|
8513
|
+
className: cn(
|
|
8514
|
+
"block max-w-full truncate text-[13px] font-semibold leading-[1.15] tracking-tight text-(--chat-incoming-text)",
|
|
8515
|
+
className
|
|
8516
|
+
),
|
|
8517
|
+
children: name
|
|
8518
|
+
}
|
|
8519
|
+
);
|
|
8520
|
+
}
|
|
8380
8521
|
|
|
8381
8522
|
// src/chat/lib/chat-message-bubble.ts
|
|
8382
8523
|
function getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext) {
|
|
@@ -8403,7 +8544,7 @@ function getChatBubbleClasses({
|
|
|
8403
8544
|
const resolvedSurface = surface ?? (isSender ? "sent" : "received");
|
|
8404
8545
|
const isNeutral = resolvedSurface === "neutral";
|
|
8405
8546
|
return cn(
|
|
8406
|
-
"relative
|
|
8547
|
+
"relative",
|
|
8407
8548
|
getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext),
|
|
8408
8549
|
resolvedSurface === "sent" && "chat-bubble-sent bg-(--chat-theme) text-white",
|
|
8409
8550
|
resolvedSurface === "received" && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
|
|
@@ -10228,7 +10369,7 @@ function MessageAttachmentsView({
|
|
|
10228
10369
|
})
|
|
10229
10370
|
),
|
|
10230
10371
|
children: [
|
|
10231
|
-
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx("
|
|
10372
|
+
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx("div", { className: "px-0.5 pb-1", children: /* @__PURE__ */ jsx(GroupSenderName, { name: senderName }) }),
|
|
10232
10373
|
isBubbleLayout && isForwarded && !isForwardedImageOnly && /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
|
|
10233
10374
|
isBubbleLayout && replySnippet ? /* @__PURE__ */ jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
|
|
10234
10375
|
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
@@ -11640,42 +11781,60 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
|
|
|
11640
11781
|
{ key: "allowMemberRemove", label: "Only Admin Can Remove Members", desc: "Only administrators can remove other participants.", inverted: true },
|
|
11641
11782
|
{ key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
|
|
11642
11783
|
];
|
|
11643
|
-
return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxs(ChatSheetContent, { className: "
|
|
11644
|
-
/* @__PURE__ */
|
|
11645
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-
|
|
11646
|
-
/* @__PURE__ */ jsx(
|
|
11647
|
-
/* @__PURE__ */ jsx(SheetTitle, { className:
|
|
11784
|
+
return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
|
|
11785
|
+
/* @__PURE__ */ jsxs(SheetHeader, { className: chatSheetHeaderClass, children: [
|
|
11786
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11787
|
+
/* @__PURE__ */ jsx(UserKey, { size: 15, className: "shrink-0 text-(--chat-theme)" }),
|
|
11788
|
+
/* @__PURE__ */ jsx(SheetTitle, { className: chatSheetTitleClass, children: "Group Permissions" })
|
|
11648
11789
|
] }),
|
|
11649
|
-
/* @__PURE__ */ jsx(
|
|
11650
|
-
] })
|
|
11651
|
-
/* @__PURE__ */
|
|
11652
|
-
/* @__PURE__ */ jsxs("
|
|
11653
|
-
/* @__PURE__ */ jsx("
|
|
11654
|
-
/* @__PURE__ */ jsx("
|
|
11790
|
+
/* @__PURE__ */ jsx("p", { className: chatSheetSubtitleClass, children: "Manage what members can and cannot do in this group." })
|
|
11791
|
+
] }),
|
|
11792
|
+
/* @__PURE__ */ jsxs("div", { className: cn(chatSheetBodyClass, "flex flex-col px-2.5 py-2"), children: [
|
|
11793
|
+
/* @__PURE__ */ jsxs("section", { className: "mb-2.5 flex-1", children: [
|
|
11794
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
|
|
11795
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => /* @__PURE__ */ jsxs(
|
|
11796
|
+
"div",
|
|
11797
|
+
{
|
|
11798
|
+
className: cn(
|
|
11799
|
+
"flex items-start justify-between gap-3 py-2.5",
|
|
11800
|
+
index < permissionItems.length - 1 && "border-b border-(--chat-border)"
|
|
11801
|
+
),
|
|
11802
|
+
children: [
|
|
11803
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-0.5", children: [
|
|
11804
|
+
/* @__PURE__ */ jsx("p", { className: "text-[12px] font-semibold leading-snug text-(--chat-text)", children: item.label }),
|
|
11805
|
+
/* @__PURE__ */ jsx("p", { className: "text-[10px] leading-relaxed text-(--chat-muted)", children: item.desc })
|
|
11806
|
+
] }),
|
|
11807
|
+
/* @__PURE__ */ jsx(
|
|
11808
|
+
Switch,
|
|
11809
|
+
{
|
|
11810
|
+
size: "sm",
|
|
11811
|
+
className: "mt-0.5 shrink-0 data-[state=checked]:bg-(--chat-theme) data-[state=unchecked]:bg-(--chat-border)",
|
|
11812
|
+
checked: "inverted" in item && item.inverted ? !permissions[item.key] : permissions[item.key],
|
|
11813
|
+
onCheckedChange: () => handleToggle(item.key)
|
|
11814
|
+
}
|
|
11815
|
+
)
|
|
11816
|
+
]
|
|
11817
|
+
},
|
|
11818
|
+
item.key
|
|
11819
|
+
)) })
|
|
11655
11820
|
] }),
|
|
11656
|
-
/* @__PURE__ */ jsx(
|
|
11657
|
-
|
|
11821
|
+
/* @__PURE__ */ jsx("div", { className: "sticky bottom-0 border-t border-(--chat-border) bg-(--chat-surface) px-0.5 pt-2.5 pb-1", children: /* @__PURE__ */ jsx(
|
|
11822
|
+
Button,
|
|
11658
11823
|
{
|
|
11659
|
-
|
|
11660
|
-
|
|
11824
|
+
size: "sm",
|
|
11825
|
+
className: "h-8 w-full border border-(--chat-theme) bg-(--chat-theme) text-[12px] text-white hover:opacity-90 disabled:opacity-50",
|
|
11826
|
+
onClick: handleSave,
|
|
11827
|
+
disabled: isSaving,
|
|
11828
|
+
children: isSaving ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11829
|
+
/* @__PURE__ */ jsx(Loader2, { className: "mr-1 size-3 animate-spin" }),
|
|
11830
|
+
"Saving..."
|
|
11831
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11832
|
+
/* @__PURE__ */ jsx(Save, { className: "mr-1 size-3" }),
|
|
11833
|
+
"Save Permissions"
|
|
11834
|
+
] })
|
|
11661
11835
|
}
|
|
11662
|
-
)
|
|
11663
|
-
] }
|
|
11664
|
-
/* @__PURE__ */ jsx("div", { className: "border-t border-(--chat-border) bg-(--chat-elevated) p-6", children: /* @__PURE__ */ jsx(
|
|
11665
|
-
Button,
|
|
11666
|
-
{
|
|
11667
|
-
className: "w-full h-11 font-bold shadow-sm",
|
|
11668
|
-
onClick: handleSave,
|
|
11669
|
-
disabled: isSaving,
|
|
11670
|
-
children: isSaving ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11671
|
-
/* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
11672
|
-
"Saving Changes..."
|
|
11673
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11674
|
-
/* @__PURE__ */ jsx(Save, { className: "mr-2 h-4 w-4" }),
|
|
11675
|
-
"Save Permissions"
|
|
11676
|
-
] })
|
|
11677
|
-
}
|
|
11678
|
-
) })
|
|
11836
|
+
) })
|
|
11837
|
+
] })
|
|
11679
11838
|
] }) });
|
|
11680
11839
|
};
|
|
11681
11840
|
var PermissionDrawer_default = PermissionDrawer;
|
|
@@ -12846,7 +13005,7 @@ var MessageToolbar = ({
|
|
|
12846
13005
|
}
|
|
12847
13006
|
),
|
|
12848
13007
|
/* @__PURE__ */ jsxs(Popover, { open: isReactionOpen, onOpenChange: setIsReactionOpen, children: [
|
|
12849
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-
|
|
13008
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-text) hover:bg-(--chat-hover)", children: /* @__PURE__ */ jsx(Smile, { className: "size-3.5" }) }) }),
|
|
12850
13009
|
/* @__PURE__ */ jsx(
|
|
12851
13010
|
PopoverContent,
|
|
12852
13011
|
{
|
|
@@ -13682,7 +13841,7 @@ function MessageItemTextBubble({
|
|
|
13682
13841
|
),
|
|
13683
13842
|
children: [
|
|
13684
13843
|
isForwarded && /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
|
|
13685
|
-
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx(
|
|
13844
|
+
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx(GroupSenderName, { name: senderName, className: "mb-0.5" }),
|
|
13686
13845
|
/* @__PURE__ */ jsx(
|
|
13687
13846
|
MessageReplySnippet_default,
|
|
13688
13847
|
{
|
|
@@ -15965,7 +16124,7 @@ function useForwardModal({ isOpen, onClose, items, onForwardComplete }) {
|
|
|
15965
16124
|
(u) => String(u._id) === otherParticipantId
|
|
15966
16125
|
);
|
|
15967
16126
|
const name = isGroup ? c.groupName || "Group Chat" : resolvedUser?.name || otherParticipantData?.name || "Unknown User";
|
|
15968
|
-
const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image ||
|
|
16127
|
+
const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image || void 0;
|
|
15969
16128
|
return {
|
|
15970
16129
|
id: isGroup ? String(c._id) : otherParticipantId,
|
|
15971
16130
|
conversationId: String(c._id),
|
|
@@ -16433,6 +16592,9 @@ var ChatMain = ({
|
|
|
16433
16592
|
accessToken,
|
|
16434
16593
|
apiUrl,
|
|
16435
16594
|
socketUrl,
|
|
16595
|
+
queryParams,
|
|
16596
|
+
queryParamApis,
|
|
16597
|
+
queryParamsByApi,
|
|
16436
16598
|
themeColor = "#7494ec",
|
|
16437
16599
|
theme,
|
|
16438
16600
|
uiConfig,
|
|
@@ -16499,6 +16661,9 @@ var ChatMain = ({
|
|
|
16499
16661
|
uiConfig: uiConfigObj,
|
|
16500
16662
|
apiUrl,
|
|
16501
16663
|
socketUrl,
|
|
16664
|
+
queryParams,
|
|
16665
|
+
queryParamApis,
|
|
16666
|
+
queryParamsByApi,
|
|
16502
16667
|
children: /* @__PURE__ */ jsx(
|
|
16503
16668
|
ChatAlertsProvider,
|
|
16504
16669
|
{
|
|
@@ -16892,6 +17057,6 @@ var packageDefaultComponents = {
|
|
|
16892
17057
|
// src/index.ts
|
|
16893
17058
|
var index_default = ChatMain_default;
|
|
16894
17059
|
|
|
16895
|
-
export { Channel, ChannelHeaderView_default as ChannelHeader, ChannelListView_default as ChannelList, ChannelListItem_default as ChannelListItem, Chat, ChatAlertsProvider, ChatAvatar_default as ChatAvatar, ChatCustomizationProvider, ChatLayout_default as ChatLayout, ChatLocaleProvider, ChatMain_default as ChatMain, ChatThemeProvider, ChatViewport, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout_default as DefaultChatLayout, ForwardModalView as ForwardModal, HeaderCallActions_default as HeaderCallActions, LoggedUserDetails_default as LoggedUserDetails, ChannelMessageBoxView_default as MessageInput, MessageItemView as MessageItem, ActiveChannelMessagesView_default as MessageList, capitalizeFirst, index_default as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, downloadFile, getChatBaseUrl, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatCustomization, mergeChatLayoutConfig, packageDefaultComponents, resolveApiUrl, resolveSocketUrl, setChatAccessToken, setChatBaseURL, setChatClientId, setChatSocketUrl, showNotification, socket_service_default as socketService, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme };
|
|
17060
|
+
export { CHAT_API_KEYS, CHAT_GET_API_KEYS, Channel, ChannelHeaderView_default as ChannelHeader, ChannelListView_default as ChannelList, ChannelListItem_default as ChannelListItem, Chat, ChatAlertsProvider, ChatAvatar_default as ChatAvatar, ChatCustomizationProvider, ChatLayout_default as ChatLayout, ChatLocaleProvider, ChatMain_default as ChatMain, ChatThemeProvider, ChatViewport, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout_default as DefaultChatLayout, ForwardModalView as ForwardModal, HeaderCallActions_default as HeaderCallActions, LoggedUserDetails_default as LoggedUserDetails, ChannelMessageBoxView_default as MessageInput, MessageItemView as MessageItem, ActiveChannelMessagesView_default as MessageList, capitalizeFirst, index_default as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, downloadFile, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatCustomization, mergeChatLayoutConfig, packageDefaultComponents, resolveApiUrl, resolveChatApiKey, resolveSocketUrl, setChatAccessToken, setChatBaseURL, setChatClientId, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, socket_service_default as socketService, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme };
|
|
16896
17061
|
//# sourceMappingURL=index.mjs.map
|
|
16897
17062
|
//# sourceMappingURL=index.mjs.map
|