organify-ui 0.3.32 → 0.3.34

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.
@@ -2947,6 +2947,41 @@ function useChat(options = {}) {
2947
2947
  return next;
2948
2948
  });
2949
2949
  }, [userId, user, options.workspaceMembers]);
2950
+ const GET_USER_SNAPSHOT = `
2951
+ query GetUserSnapshot($id: String!) {
2952
+ userSnapshot(id: $id) {
2953
+ id name avatarUrl email
2954
+ }
2955
+ }
2956
+ `;
2957
+ useEffect(() => {
2958
+ if (!userId || isDemoMode) return;
2959
+ const missingIds = Array.from(new Set(messages.map((m) => m.authorId))).filter(
2960
+ (id) => !userCache.has(id) && id !== "system"
2961
+ );
2962
+ if (missingIds.length === 0) return;
2963
+ missingIds.forEach(async (id) => {
2964
+ setUserCache((prev) => {
2965
+ const next = new Map(prev);
2966
+ if (!next.has(id)) next.set(id, { displayName: `User ${id.substring(0, 5)}` });
2967
+ return next;
2968
+ });
2969
+ try {
2970
+ const data = await centralGql("workspaces", GET_USER_SNAPSHOT, { id });
2971
+ if (data?.userSnapshot) {
2972
+ setUserCache((prev) => {
2973
+ const next = new Map(prev);
2974
+ next.set(id, {
2975
+ displayName: data.userSnapshot.name || data.userSnapshot.email || `User ${id.substring(0, 5)}`,
2976
+ avatarUrl: data.userSnapshot.avatarUrl || void 0
2977
+ });
2978
+ return next;
2979
+ });
2980
+ }
2981
+ } catch (err) {
2982
+ }
2983
+ });
2984
+ }, [messages, userCache, userId, isDemoMode, centralGql]);
2950
2985
  const fetchRooms = useCallback(async () => {
2951
2986
  if (initialRooms && initialRooms.length > 0) return;
2952
2987
  if (!workspaceId || workspaceId.startsWith("temp-")) return;
@@ -3525,8 +3560,8 @@ function useChat(options = {}) {
3525
3560
  useEffect(() => {
3526
3561
  if (!userId || !activeRoomId) return;
3527
3562
  if (isDemoMode) return;
3528
- const chatServiceUrl = api?.services?.chat || gatewayUrl;
3529
- const wsUrl = chatServiceUrl.replace(/^http/, "ws") + "/graphql/chat";
3563
+ const baseUrl = api?.services?.chat || typeof process !== "undefined" && process.env.NEXT_PUBLIC_GATEWAY_URL || "https://organify-gateway-service.onrender.com";
3564
+ const wsUrl = baseUrl.replace(/^http/, "ws") + "/graphql/chat";
3530
3565
  let ws = null;
3531
3566
  let pingInterval;
3532
3567
  let reconnectTimer;
@@ -4708,5 +4743,5 @@ function useAiInline({ gatewayUrl, workspaceId, projectId }) {
4708
4743
  }
4709
4744
 
4710
4745
  export { AiChatSidebar, Alert, Button, ChatMessages, ChatSidebar, CommandBar, CreateRoomDialog, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, InlineAiButton, Input, Label, MOCK_PROJECTS, MOCK_USERS, MentionPopover, MessageBubble, MessageInput, OrgLoader, OrgLoaderInline, OrganifyChat, ResponsiveDialog, RoomManagementPanel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TypingIndicatorMock, UserAvatar, UserDisplayName, alertVariants, buttonVariants, generateAutoReplies, getMockMentionOptions, getRoomPermissions, inputVariants, invalidateUserCache, orgLoaderVariants, resolveUser, seedUserCache, typingIndicator, useAiInline, useChat, useResolvedUser };
4711
- //# sourceMappingURL=chunk-GI5LONCN.js.map
4712
- //# sourceMappingURL=chunk-GI5LONCN.js.map
4746
+ //# sourceMappingURL=chunk-UVGTWHUC.js.map
4747
+ //# sourceMappingURL=chunk-UVGTWHUC.js.map