@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.cjs
CHANGED
|
@@ -380,7 +380,6 @@ var init_socket_service = __esm({
|
|
|
380
380
|
});
|
|
381
381
|
this.disconnect();
|
|
382
382
|
}
|
|
383
|
-
console.log("Socket: Starting connection to", config.url);
|
|
384
383
|
this.currentConfig = config;
|
|
385
384
|
this.isConnecting = true;
|
|
386
385
|
const store = getStore();
|
|
@@ -389,7 +388,6 @@ var init_socket_service = __esm({
|
|
|
389
388
|
this.socket = socket_ioClient.io(config.url, config.options);
|
|
390
389
|
this.socket.on("connect", () => {
|
|
391
390
|
this.isConnecting = false;
|
|
392
|
-
console.log("Connected to socket with ID:", this.socket?.id);
|
|
393
391
|
setConnected({ socketId: this.socket?.id || "" });
|
|
394
392
|
this.emitGetOnlineUsers();
|
|
395
393
|
});
|
|
@@ -890,8 +888,16 @@ var init_conversation_helpers = __esm({
|
|
|
890
888
|
},
|
|
891
889
|
existing
|
|
892
890
|
);
|
|
893
|
-
|
|
894
|
-
|
|
891
|
+
if (index < 0) {
|
|
892
|
+
return [normalized, ...conversations];
|
|
893
|
+
}
|
|
894
|
+
if (lastMessageChanged) {
|
|
895
|
+
const withoutExisting = conversations.filter((_, itemIndex) => itemIndex !== index);
|
|
896
|
+
return [normalized, ...withoutExisting];
|
|
897
|
+
}
|
|
898
|
+
const next = [...conversations];
|
|
899
|
+
next[index] = normalized;
|
|
900
|
+
return next;
|
|
895
901
|
};
|
|
896
902
|
findConversationById = (conversations, conversationId) => {
|
|
897
903
|
if (!conversationId) return void 0;
|
|
@@ -1096,13 +1102,109 @@ var init_connection_actions = __esm({
|
|
|
1096
1102
|
});
|
|
1097
1103
|
}
|
|
1098
1104
|
});
|
|
1099
|
-
|
|
1105
|
+
|
|
1106
|
+
// src/services/api/query-params.ts
|
|
1107
|
+
function resolveChatApiKey(url) {
|
|
1108
|
+
if (!url) return null;
|
|
1109
|
+
const path = url.split("?")[0] || "";
|
|
1110
|
+
if (path.includes("/user/login/client-user")) return "login";
|
|
1111
|
+
if (path.includes("/user/list")) return "users";
|
|
1112
|
+
if (path.includes("/conversation/list")) return "conversations";
|
|
1113
|
+
if (path.includes("/conversation/get/information/")) return "conversationInfo";
|
|
1114
|
+
if (path.includes("/message/get-all-from-conversation")) return "messages";
|
|
1115
|
+
if (path.includes("message/pinned-messages") || path.includes("/message/pinned-messages")) {
|
|
1116
|
+
return "pinnedMessages";
|
|
1117
|
+
}
|
|
1118
|
+
if (path.includes("message/starred-messages") || path.includes("/message/starred-messages")) {
|
|
1119
|
+
return "starredMessages";
|
|
1120
|
+
}
|
|
1121
|
+
if (path.includes("/message/search-messages")) return "searchMessages";
|
|
1122
|
+
if (path.includes("/message/searched-message/context")) return "searchMessagesContext";
|
|
1123
|
+
if (path.includes("/conversation/group/create")) return "createGroup";
|
|
1124
|
+
if (path.includes("/conversation/group/permission/update")) return "updateGroupPermissions";
|
|
1125
|
+
if (path.includes("/conversation/group/information/update")) return "updateGroupInfo";
|
|
1126
|
+
if (path.includes("/conversation/group/participants/add-remove")) return "manageMembers";
|
|
1127
|
+
if (path.includes("/conversation/group/admins/add-remove")) return "manageAdmins";
|
|
1128
|
+
if (path.includes("/user/block-unblock")) return "blockUnblock";
|
|
1129
|
+
if (path.includes("/aws/upload/get-presigned-urls")) return "presignedUrls";
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
function isChatGetApiKey(key) {
|
|
1133
|
+
return !!key && exports.CHAT_GET_API_KEYS.includes(key);
|
|
1134
|
+
}
|
|
1135
|
+
function normalizeQueryParams(params) {
|
|
1136
|
+
if (!params || typeof params !== "object") return {};
|
|
1137
|
+
const next = {};
|
|
1138
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1139
|
+
if (value === void 0 || value === null) continue;
|
|
1140
|
+
const trimmedKey = String(key).trim();
|
|
1141
|
+
if (!trimmedKey) continue;
|
|
1142
|
+
next[trimmedKey] = String(value);
|
|
1143
|
+
}
|
|
1144
|
+
return next;
|
|
1145
|
+
}
|
|
1146
|
+
function normalizeQueryParamsByApi(byApi) {
|
|
1147
|
+
if (!byApi || typeof byApi !== "object") return {};
|
|
1148
|
+
const next = {};
|
|
1149
|
+
for (const [apiKey, params] of Object.entries(byApi)) {
|
|
1150
|
+
if (apiKey === "all" || apiKey === "get") continue;
|
|
1151
|
+
next[apiKey] = normalizeQueryParams(params);
|
|
1152
|
+
}
|
|
1153
|
+
return next;
|
|
1154
|
+
}
|
|
1155
|
+
exports.CHAT_GET_API_KEYS = void 0; exports.CHAT_API_KEYS = void 0;
|
|
1156
|
+
var init_query_params = __esm({
|
|
1157
|
+
"src/services/api/query-params.ts"() {
|
|
1158
|
+
exports.CHAT_GET_API_KEYS = [
|
|
1159
|
+
"users",
|
|
1160
|
+
"conversations",
|
|
1161
|
+
"conversationInfo",
|
|
1162
|
+
"messages",
|
|
1163
|
+
"pinnedMessages",
|
|
1164
|
+
"starredMessages",
|
|
1165
|
+
"searchMessages",
|
|
1166
|
+
"searchMessagesContext"
|
|
1167
|
+
];
|
|
1168
|
+
exports.CHAT_API_KEYS = [
|
|
1169
|
+
"all",
|
|
1170
|
+
/** All GET endpoints listed in CHAT_GET_API_KEYS */
|
|
1171
|
+
"get",
|
|
1172
|
+
"login",
|
|
1173
|
+
...exports.CHAT_GET_API_KEYS,
|
|
1174
|
+
"createGroup",
|
|
1175
|
+
"updateGroupPermissions",
|
|
1176
|
+
"updateGroupInfo",
|
|
1177
|
+
"manageMembers",
|
|
1178
|
+
"manageAdmins",
|
|
1179
|
+
"blockUnblock",
|
|
1180
|
+
"presignedUrls"
|
|
1181
|
+
];
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
function resolveParamsForRequest(url, method) {
|
|
1185
|
+
const apiKey = resolveChatApiKey(url);
|
|
1186
|
+
const httpMethod = (method || "get").toLowerCase();
|
|
1187
|
+
const isGet = httpMethod === "get";
|
|
1188
|
+
const perApi = apiKey ? chatQueryParamsByApi[apiKey] : void 0;
|
|
1189
|
+
const applyShared = Object.keys(chatQueryParams).length > 0 && (chatQueryParamApis.includes("all") || chatQueryParamApis.includes("get") && isGet && isChatGetApiKey(apiKey) || apiKey != null && chatQueryParamApis.includes(apiKey));
|
|
1190
|
+
if (!applyShared && !perApi) return {};
|
|
1191
|
+
return {
|
|
1192
|
+
...applyShared ? chatQueryParams : {},
|
|
1193
|
+
...perApi || {}
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
var chatClientId, chatAccessToken, chatBaseUrl, chatSocketUrl, chatQueryParams, chatQueryParamApis, chatQueryParamsByApi; exports.setChatClientId = void 0; var getChatClientId; exports.setChatAccessToken = void 0; exports.setChatBaseURL = void 0; exports.getChatBaseUrl = void 0; exports.setChatSocketUrl = void 0; exports.getChatSocketUrl = void 0; exports.setChatQueryParams = void 0; exports.getChatQueryParams = void 0; exports.setChatQueryParamApis = void 0; exports.getChatQueryParamApis = void 0; exports.setChatQueryParamsByApi = void 0; exports.getChatQueryParamsByApi = void 0; var rateLimitResetAt, isRateLimited, apiClient;
|
|
1100
1197
|
var init_client = __esm({
|
|
1101
1198
|
"src/services/api/client.ts"() {
|
|
1199
|
+
init_query_params();
|
|
1200
|
+
init_query_params();
|
|
1102
1201
|
chatClientId = "";
|
|
1103
1202
|
chatAccessToken = "";
|
|
1104
1203
|
chatBaseUrl = "";
|
|
1105
1204
|
chatSocketUrl = "";
|
|
1205
|
+
chatQueryParams = {};
|
|
1206
|
+
chatQueryParamApis = ["get"];
|
|
1207
|
+
chatQueryParamsByApi = {};
|
|
1106
1208
|
exports.setChatClientId = (id) => {
|
|
1107
1209
|
chatClientId = id.trim();
|
|
1108
1210
|
};
|
|
@@ -1119,6 +1221,22 @@ var init_client = __esm({
|
|
|
1119
1221
|
chatSocketUrl = url.trim();
|
|
1120
1222
|
};
|
|
1121
1223
|
exports.getChatSocketUrl = () => chatSocketUrl;
|
|
1224
|
+
exports.setChatQueryParams = (params) => {
|
|
1225
|
+
chatQueryParams = normalizeQueryParams(params);
|
|
1226
|
+
};
|
|
1227
|
+
exports.getChatQueryParams = () => ({ ...chatQueryParams });
|
|
1228
|
+
exports.setChatQueryParamApis = (apis) => {
|
|
1229
|
+
if (!apis?.length) {
|
|
1230
|
+
chatQueryParamApis = ["get"];
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
chatQueryParamApis = [...apis];
|
|
1234
|
+
};
|
|
1235
|
+
exports.getChatQueryParamApis = () => [...chatQueryParamApis];
|
|
1236
|
+
exports.setChatQueryParamsByApi = (byApi) => {
|
|
1237
|
+
chatQueryParamsByApi = normalizeQueryParamsByApi(byApi);
|
|
1238
|
+
};
|
|
1239
|
+
exports.getChatQueryParamsByApi = () => ({ ...chatQueryParamsByApi });
|
|
1122
1240
|
rateLimitResetAt = 0;
|
|
1123
1241
|
isRateLimited = () => Date.now() < rateLimitResetAt;
|
|
1124
1242
|
apiClient = axios__default.default.create({
|
|
@@ -1135,6 +1253,11 @@ var init_client = __esm({
|
|
|
1135
1253
|
config.headers.set("platform", "web");
|
|
1136
1254
|
config.headers.set("is-tenant", "true");
|
|
1137
1255
|
config.headers.set("x-client-id", chatClientId);
|
|
1256
|
+
const requestUrl = String(config.url || "");
|
|
1257
|
+
const scopedParams = resolveParamsForRequest(requestUrl, config.method);
|
|
1258
|
+
if (Object.keys(scopedParams).length > 0) {
|
|
1259
|
+
config.params = { ...scopedParams, ...config.params };
|
|
1260
|
+
}
|
|
1138
1261
|
try {
|
|
1139
1262
|
const { useStore: useStore2 } = (init_useStore(), __toCommonJS(useStore_exports));
|
|
1140
1263
|
const accessToken = useStore2.getState().accessToken || chatAccessToken;
|
|
@@ -4320,6 +4443,9 @@ var Chat = ({
|
|
|
4320
4443
|
loggedUserDetails,
|
|
4321
4444
|
apiUrl,
|
|
4322
4445
|
socketUrl,
|
|
4446
|
+
queryParams,
|
|
4447
|
+
queryParamApis,
|
|
4448
|
+
queryParamsByApi,
|
|
4323
4449
|
channelsData,
|
|
4324
4450
|
messagesData,
|
|
4325
4451
|
onMessageReceived,
|
|
@@ -4339,6 +4465,9 @@ var Chat = ({
|
|
|
4339
4465
|
if (!clientId || !loggedUserDetails) return;
|
|
4340
4466
|
setSessionReady(false);
|
|
4341
4467
|
exports.setChatClientId(clientId);
|
|
4468
|
+
exports.setChatQueryParams(queryParams);
|
|
4469
|
+
exports.setChatQueryParamApis(queryParamApis);
|
|
4470
|
+
exports.setChatQueryParamsByApi(queryParamsByApi);
|
|
4342
4471
|
const resolvedApiUrl = resolveApiUrl(apiUrl);
|
|
4343
4472
|
const resolvedSocketUrl = resolveSocketUrl(socketUrl, resolvedApiUrl);
|
|
4344
4473
|
if (resolvedApiUrl) exports.setChatBaseURL(resolvedApiUrl);
|
|
@@ -4408,9 +4537,22 @@ var Chat = ({
|
|
|
4408
4537
|
initializeChat();
|
|
4409
4538
|
return () => {
|
|
4410
4539
|
setSessionReady(false);
|
|
4540
|
+
exports.setChatQueryParams({});
|
|
4541
|
+
exports.setChatQueryParamApis(["get"]);
|
|
4542
|
+
exports.setChatQueryParamsByApi({});
|
|
4411
4543
|
exports.socketService.disconnect();
|
|
4412
4544
|
};
|
|
4413
4545
|
}, [client?.id, loggedUserDetails?._id, loggedUserDetails?.email, accessToken, apiUrl, socketUrl, setSession, setSessionReady]);
|
|
4546
|
+
const queryConfigKey = JSON.stringify({
|
|
4547
|
+
queryParams: queryParams ?? {},
|
|
4548
|
+
queryParamApis: queryParamApis ?? ["get"],
|
|
4549
|
+
queryParamsByApi: queryParamsByApi ?? {}
|
|
4550
|
+
});
|
|
4551
|
+
React2__default.default.useEffect(() => {
|
|
4552
|
+
exports.setChatQueryParams(queryParams);
|
|
4553
|
+
exports.setChatQueryParamApis(queryParamApis);
|
|
4554
|
+
exports.setChatQueryParamsByApi(queryParamsByApi);
|
|
4555
|
+
}, [queryConfigKey]);
|
|
4414
4556
|
React2__default.default.useEffect(() => {
|
|
4415
4557
|
if (lastDM && onMessageReceived) {
|
|
4416
4558
|
onMessageReceived(lastDM);
|
|
@@ -5282,19 +5424,6 @@ function SheetTitle({
|
|
|
5282
5424
|
}
|
|
5283
5425
|
);
|
|
5284
5426
|
}
|
|
5285
|
-
function SheetDescription({
|
|
5286
|
-
className,
|
|
5287
|
-
...props
|
|
5288
|
-
}) {
|
|
5289
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5290
|
-
radixUi.Dialog.Description,
|
|
5291
|
-
{
|
|
5292
|
-
"data-slot": "sheet-description",
|
|
5293
|
-
className: cn("text-muted-foreground text-sm", className),
|
|
5294
|
-
...props
|
|
5295
|
-
}
|
|
5296
|
-
);
|
|
5297
|
-
}
|
|
5298
5427
|
function AlertDialog({
|
|
5299
5428
|
...props
|
|
5300
5429
|
}) {
|
|
@@ -5622,7 +5751,7 @@ function useCreateChatDialog({
|
|
|
5622
5751
|
onUserSelect?.({
|
|
5623
5752
|
id: user._id,
|
|
5624
5753
|
name: user.name.charAt(0).toUpperCase() + user.name.slice(1),
|
|
5625
|
-
image: user.image ||
|
|
5754
|
+
image: user.image || void 0,
|
|
5626
5755
|
email: user.email,
|
|
5627
5756
|
isOnline: onlineUsersIds.includes(user._id),
|
|
5628
5757
|
isGroup: false,
|
|
@@ -6034,14 +6163,14 @@ var LoggedUserDetails = ({
|
|
|
6034
6163
|
isActive: loggedUserDetails?.isActive ?? true,
|
|
6035
6164
|
createdAt: loggedUserDetails?.createdAt ? new Date(loggedUserDetails.createdAt) : /* @__PURE__ */ new Date(),
|
|
6036
6165
|
updatedAt: loggedUserDetails?.updatedAt ? new Date(loggedUserDetails.updatedAt) : /* @__PURE__ */ new Date(),
|
|
6037
|
-
image: loggedUserDetails?.image ||
|
|
6166
|
+
image: loggedUserDetails?.image || void 0
|
|
6038
6167
|
};
|
|
6039
6168
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 border-b border-(--chat-border) bg-(--chat-surface) px-3 pb-3 pt-3", children: [
|
|
6040
6169
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
6041
6170
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative shrink-0", children: [
|
|
6042
6171
|
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-8 ring-1 ring-(--chat-surface)", children: [
|
|
6043
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user
|
|
6044
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: user.name.charAt(0).toUpperCase() })
|
|
6172
|
+
user.image ? /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image, alt: user.name }) : null,
|
|
6173
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: (user.name || "?").charAt(0).toUpperCase() })
|
|
6045
6174
|
] }),
|
|
6046
6175
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -bottom-0.5 -right-0.5 size-2 rounded-full border-2 border-(--chat-surface) bg-(--chat-online)" })
|
|
6047
6176
|
] }),
|
|
@@ -6660,7 +6789,7 @@ function useChannelList({ debouncedSearch = "" }) {
|
|
|
6660
6789
|
const conversationId = String(c._id);
|
|
6661
6790
|
const { id: otherParticipantId, user: resolvedUser } = isGroup ? { id: conversationId, user: null } : resolveOtherParticipant(c, loggedUserDetails?._id, allUsers);
|
|
6662
6791
|
const name = isGroup ? c.groupName || c.name || "Group Chat" : resolvedUser?.name || "Unknown User";
|
|
6663
|
-
const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image ||
|
|
6792
|
+
const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image || void 0;
|
|
6664
6793
|
const isOnline = isGroup ? false : otherParticipantId ? onlineUserIds.includes(otherParticipantId) : false;
|
|
6665
6794
|
const unreadCount = normalizeUnreadCount(c.unreadCount, loggedUserDetails?._id);
|
|
6666
6795
|
const isTyping = typingUsersByConv[String(c._id)]?.length > 0;
|
|
@@ -6745,7 +6874,7 @@ function ChannelListItem({ channel, activeChannel, onChannelSelect }) {
|
|
|
6745
6874
|
children: [
|
|
6746
6875
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative shrink-0", children: [
|
|
6747
6876
|
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-9", children: [
|
|
6748
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: channel.image, alt: channel.name }),
|
|
6877
|
+
channel.image ? /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: channel.image, alt: channel.name }) : null,
|
|
6749
6878
|
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: cn(
|
|
6750
6879
|
"text-[10px] font-medium",
|
|
6751
6880
|
isActive ? "bg-(--chat-theme-20) text-(--chat-theme)" : "bg-(--chat-input-bg) text-(--chat-muted)"
|
|
@@ -8387,6 +8516,18 @@ function MessageForwardedLabel({ isSender, className, overlay }) {
|
|
|
8387
8516
|
}
|
|
8388
8517
|
);
|
|
8389
8518
|
}
|
|
8519
|
+
function GroupSenderName({ name, className }) {
|
|
8520
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8521
|
+
"span",
|
|
8522
|
+
{
|
|
8523
|
+
className: cn(
|
|
8524
|
+
"block max-w-full truncate text-[13px] font-semibold leading-[1.15] tracking-tight text-(--chat-incoming-text)",
|
|
8525
|
+
className
|
|
8526
|
+
),
|
|
8527
|
+
children: name
|
|
8528
|
+
}
|
|
8529
|
+
);
|
|
8530
|
+
}
|
|
8390
8531
|
|
|
8391
8532
|
// src/chat/lib/chat-message-bubble.ts
|
|
8392
8533
|
function getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext) {
|
|
@@ -8413,7 +8554,7 @@ function getChatBubbleClasses({
|
|
|
8413
8554
|
const resolvedSurface = surface ?? (isSender ? "sent" : "received");
|
|
8414
8555
|
const isNeutral = resolvedSurface === "neutral";
|
|
8415
8556
|
return cn(
|
|
8416
|
-
"relative
|
|
8557
|
+
"relative",
|
|
8417
8558
|
getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext),
|
|
8418
8559
|
resolvedSurface === "sent" && "chat-bubble-sent bg-(--chat-theme) text-white",
|
|
8419
8560
|
resolvedSurface === "received" && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
|
|
@@ -10238,7 +10379,7 @@ function MessageAttachmentsView({
|
|
|
10238
10379
|
})
|
|
10239
10380
|
),
|
|
10240
10381
|
children: [
|
|
10241
|
-
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx("
|
|
10382
|
+
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-0.5 pb-1", children: /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName }) }),
|
|
10242
10383
|
isBubbleLayout && isForwarded && !isForwardedImageOnly && /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
|
|
10243
10384
|
isBubbleLayout && replySnippet ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
|
|
10244
10385
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
@@ -11650,42 +11791,60 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
|
|
|
11650
11791
|
{ key: "allowMemberRemove", label: "Only Admin Can Remove Members", desc: "Only administrators can remove other participants.", inverted: true },
|
|
11651
11792
|
{ key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
|
|
11652
11793
|
];
|
|
11653
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(ChatSheetContent, { className: "
|
|
11654
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11655
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-
|
|
11656
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11657
|
-
/* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className:
|
|
11794
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
|
|
11795
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { className: chatSheetHeaderClass, children: [
|
|
11796
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11797
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserKey, { size: 15, className: "shrink-0 text-(--chat-theme)" }),
|
|
11798
|
+
/* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: chatSheetTitleClass, children: "Group Permissions" })
|
|
11658
11799
|
] }),
|
|
11659
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11660
|
-
] })
|
|
11661
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11662
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
11663
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
11664
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
11800
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: chatSheetSubtitleClass, children: "Manage what members can and cannot do in this group." })
|
|
11801
|
+
] }),
|
|
11802
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(chatSheetBodyClass, "flex flex-col px-2.5 py-2"), children: [
|
|
11803
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mb-2.5 flex-1", children: [
|
|
11804
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
|
|
11805
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11806
|
+
"div",
|
|
11807
|
+
{
|
|
11808
|
+
className: cn(
|
|
11809
|
+
"flex items-start justify-between gap-3 py-2.5",
|
|
11810
|
+
index < permissionItems.length - 1 && "border-b border-(--chat-border)"
|
|
11811
|
+
),
|
|
11812
|
+
children: [
|
|
11813
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-0.5", children: [
|
|
11814
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] font-semibold leading-snug text-(--chat-text)", children: item.label }),
|
|
11815
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] leading-relaxed text-(--chat-muted)", children: item.desc })
|
|
11816
|
+
] }),
|
|
11817
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11818
|
+
Switch,
|
|
11819
|
+
{
|
|
11820
|
+
size: "sm",
|
|
11821
|
+
className: "mt-0.5 shrink-0 data-[state=checked]:bg-(--chat-theme) data-[state=unchecked]:bg-(--chat-border)",
|
|
11822
|
+
checked: "inverted" in item && item.inverted ? !permissions[item.key] : permissions[item.key],
|
|
11823
|
+
onCheckedChange: () => handleToggle(item.key)
|
|
11824
|
+
}
|
|
11825
|
+
)
|
|
11826
|
+
]
|
|
11827
|
+
},
|
|
11828
|
+
item.key
|
|
11829
|
+
)) })
|
|
11665
11830
|
] }),
|
|
11666
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11667
|
-
|
|
11831
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky bottom-0 border-t border-(--chat-border) bg-(--chat-surface) px-0.5 pt-2.5 pb-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11832
|
+
Button,
|
|
11668
11833
|
{
|
|
11669
|
-
|
|
11670
|
-
|
|
11834
|
+
size: "sm",
|
|
11835
|
+
className: "h-8 w-full border border-(--chat-theme) bg-(--chat-theme) text-[12px] text-white hover:opacity-90 disabled:opacity-50",
|
|
11836
|
+
onClick: handleSave,
|
|
11837
|
+
disabled: isSaving,
|
|
11838
|
+
children: isSaving ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11839
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 size-3 animate-spin" }),
|
|
11840
|
+
"Saving..."
|
|
11841
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11842
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "mr-1 size-3" }),
|
|
11843
|
+
"Save Permissions"
|
|
11844
|
+
] })
|
|
11671
11845
|
}
|
|
11672
|
-
)
|
|
11673
|
-
] }
|
|
11674
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-(--chat-border) bg-(--chat-elevated) p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11675
|
-
Button,
|
|
11676
|
-
{
|
|
11677
|
-
className: "w-full h-11 font-bold shadow-sm",
|
|
11678
|
-
onClick: handleSave,
|
|
11679
|
-
disabled: isSaving,
|
|
11680
|
-
children: isSaving ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11681
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
11682
|
-
"Saving Changes..."
|
|
11683
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11684
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "mr-2 h-4 w-4" }),
|
|
11685
|
-
"Save Permissions"
|
|
11686
|
-
] })
|
|
11687
|
-
}
|
|
11688
|
-
) })
|
|
11846
|
+
) })
|
|
11847
|
+
] })
|
|
11689
11848
|
] }) });
|
|
11690
11849
|
};
|
|
11691
11850
|
var PermissionDrawer_default = PermissionDrawer;
|
|
@@ -12856,7 +13015,7 @@ var MessageToolbar = ({
|
|
|
12856
13015
|
}
|
|
12857
13016
|
),
|
|
12858
13017
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isReactionOpen, onOpenChange: setIsReactionOpen, children: [
|
|
12859
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-
|
|
13018
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-text) hover:bg-(--chat-hover)", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "size-3.5" }) }) }),
|
|
12860
13019
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12861
13020
|
PopoverContent,
|
|
12862
13021
|
{
|
|
@@ -13692,7 +13851,7 @@ function MessageItemTextBubble({
|
|
|
13692
13851
|
),
|
|
13693
13852
|
children: [
|
|
13694
13853
|
isForwarded && /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
|
|
13695
|
-
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13854
|
+
!isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName, className: "mb-0.5" }),
|
|
13696
13855
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13697
13856
|
MessageReplySnippet_default,
|
|
13698
13857
|
{
|
|
@@ -15975,7 +16134,7 @@ function useForwardModal({ isOpen, onClose, items, onForwardComplete }) {
|
|
|
15975
16134
|
(u) => String(u._id) === otherParticipantId
|
|
15976
16135
|
);
|
|
15977
16136
|
const name = isGroup ? c.groupName || "Group Chat" : resolvedUser?.name || otherParticipantData?.name || "Unknown User";
|
|
15978
|
-
const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image ||
|
|
16137
|
+
const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image || void 0;
|
|
15979
16138
|
return {
|
|
15980
16139
|
id: isGroup ? String(c._id) : otherParticipantId,
|
|
15981
16140
|
conversationId: String(c._id),
|
|
@@ -16443,6 +16602,9 @@ var ChatMain = ({
|
|
|
16443
16602
|
accessToken,
|
|
16444
16603
|
apiUrl,
|
|
16445
16604
|
socketUrl,
|
|
16605
|
+
queryParams,
|
|
16606
|
+
queryParamApis,
|
|
16607
|
+
queryParamsByApi,
|
|
16446
16608
|
themeColor = "#7494ec",
|
|
16447
16609
|
theme,
|
|
16448
16610
|
uiConfig,
|
|
@@ -16509,6 +16671,9 @@ var ChatMain = ({
|
|
|
16509
16671
|
uiConfig: uiConfigObj,
|
|
16510
16672
|
apiUrl,
|
|
16511
16673
|
socketUrl,
|
|
16674
|
+
queryParams,
|
|
16675
|
+
queryParamApis,
|
|
16676
|
+
queryParamsByApi,
|
|
16512
16677
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16513
16678
|
ChatAlertsProvider,
|
|
16514
16679
|
{
|
|
@@ -16939,6 +17104,7 @@ exports.mergeChatCustomization = mergeChatCustomization;
|
|
|
16939
17104
|
exports.mergeChatLayoutConfig = mergeChatLayoutConfig;
|
|
16940
17105
|
exports.packageDefaultComponents = packageDefaultComponents;
|
|
16941
17106
|
exports.resolveApiUrl = resolveApiUrl;
|
|
17107
|
+
exports.resolveChatApiKey = resolveChatApiKey;
|
|
16942
17108
|
exports.resolveSocketUrl = resolveSocketUrl;
|
|
16943
17109
|
exports.showNotification = showNotification;
|
|
16944
17110
|
exports.uniqueList = uniqueList;
|