organify-ui 0.3.24 → 0.3.26
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.
|
@@ -176,9 +176,9 @@ var buttonVariants = cva(
|
|
|
176
176
|
variant: {
|
|
177
177
|
default: "bg-primary !text-white hover:bg-primary/90",
|
|
178
178
|
destructive: "!bg-destructive !text-white hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
179
|
-
outline: "border
|
|
180
|
-
secondary: "bg-
|
|
181
|
-
ghost: "
|
|
179
|
+
outline: "border border-theme-strong bg-transparent text-theme hover:bg-theme-subtle",
|
|
180
|
+
secondary: "bg-theme-elevated text-theme hover:bg-theme-subtle",
|
|
181
|
+
ghost: "text-theme hover:bg-theme-subtle",
|
|
182
182
|
link: "!text-primary underline-offset-4 hover:underline"
|
|
183
183
|
},
|
|
184
184
|
size: {
|
|
@@ -221,7 +221,7 @@ function Button({
|
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
var inputVariants = cva(
|
|
224
|
-
"flex w-full bg-theme-
|
|
224
|
+
"flex w-full bg-theme-void backdrop-blur-md border border-theme-subtle rounded-xl px-4 py-3 text-sm font-light text-theme transition-all duration-[400ms] ease-[cubic-bezier(0.25,1,0.5,1)] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-theme-muted focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
225
225
|
{
|
|
226
226
|
variants: {
|
|
227
227
|
variant: {
|
|
@@ -2949,7 +2949,6 @@ function useChat(options = {}) {
|
|
|
2949
2949
|
}, [userId, user, options.workspaceMembers]);
|
|
2950
2950
|
const fetchRooms = useCallback(async () => {
|
|
2951
2951
|
if (initialRooms && initialRooms.length > 0) return;
|
|
2952
|
-
if (!workspaceId || workspaceId.startsWith("temp-")) return;
|
|
2953
2952
|
if (!userId) return;
|
|
2954
2953
|
setLoadingRooms(true);
|
|
2955
2954
|
setError(null);
|
|
@@ -2975,6 +2974,40 @@ function useChat(options = {}) {
|
|
|
2975
2974
|
setLoadingRooms(false);
|
|
2976
2975
|
}
|
|
2977
2976
|
}, [workspaceId, userId, gql, initialRooms]);
|
|
2977
|
+
const resolveUnknownUsers = useCallback(async (msgs) => {
|
|
2978
|
+
const unknownIds = [...new Set(msgs.map((m) => m.authorId).filter((id) => !userCache.has(id)))];
|
|
2979
|
+
if (unknownIds.length === 0 || !workspaceId || workspaceId.startsWith("temp-")) return;
|
|
2980
|
+
try {
|
|
2981
|
+
const data = await centralGql(
|
|
2982
|
+
"workspaces",
|
|
2983
|
+
`query($slug: String!) {
|
|
2984
|
+
workspace(slug: $slug) {
|
|
2985
|
+
members {
|
|
2986
|
+
userId
|
|
2987
|
+
user { id name email avatar }
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
}`,
|
|
2991
|
+
{ slug: workspaceId }
|
|
2992
|
+
// Hack: Assuming workspaceId is the slug for this query, ideally we'd query users directly if there was an endpoint, but this refreshes workspace members
|
|
2993
|
+
);
|
|
2994
|
+
const newMembers = data?.workspace?.members || [];
|
|
2995
|
+
setUserCache((prev) => {
|
|
2996
|
+
const next = new Map(prev);
|
|
2997
|
+
for (const member of newMembers) {
|
|
2998
|
+
if (member.user?.id && !next.has(member.user.id)) {
|
|
2999
|
+
next.set(member.user.id, {
|
|
3000
|
+
displayName: member.user.name || member.user.email || `User`,
|
|
3001
|
+
avatarUrl: member.user.avatar ?? void 0
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
return next;
|
|
3006
|
+
});
|
|
3007
|
+
} catch (e) {
|
|
3008
|
+
console.warn("[organify-chat] resolveUnknownUsers failed:", e);
|
|
3009
|
+
}
|
|
3010
|
+
}, [userCache, workspaceId, centralGql]);
|
|
2978
3011
|
const MESSAGE_FIELDS = `
|
|
2979
3012
|
id roomId authorId parentId
|
|
2980
3013
|
content edited editedAt createdAt
|
|
@@ -3003,9 +3036,11 @@ function useChat(options = {}) {
|
|
|
3003
3036
|
}`,
|
|
3004
3037
|
{ roomId, filter: { limit: 50 } }
|
|
3005
3038
|
);
|
|
3006
|
-
|
|
3039
|
+
const fetchedMessages = data.messages?.items ?? [];
|
|
3040
|
+
setMessages(fetchedMessages);
|
|
3007
3041
|
setHasMoreMessages(data.messages?.hasMore ?? false);
|
|
3008
3042
|
setMessageCursor(data.messages?.nextCursor ?? null);
|
|
3043
|
+
resolveUnknownUsers(fetchedMessages);
|
|
3009
3044
|
} catch (err) {
|
|
3010
3045
|
console.error("[organify-chat] fetchMessages:", err);
|
|
3011
3046
|
setError("Erro ao carregar mensagens.");
|
|
@@ -3033,6 +3068,7 @@ function useChat(options = {}) {
|
|
|
3033
3068
|
setMessages((prev) => [...olderMessages, ...prev]);
|
|
3034
3069
|
setHasMoreMessages(data.messages?.hasMore ?? false);
|
|
3035
3070
|
setMessageCursor(data.messages?.nextCursor ?? null);
|
|
3071
|
+
resolveUnknownUsers(olderMessages);
|
|
3036
3072
|
} catch (err) {
|
|
3037
3073
|
console.error("[organify-chat] loadMore:", err);
|
|
3038
3074
|
} finally {
|
|
@@ -4708,5 +4744,5 @@ function useAiInline({ gatewayUrl, workspaceId, projectId }) {
|
|
|
4708
4744
|
}
|
|
4709
4745
|
|
|
4710
4746
|
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-
|
|
4712
|
-
//# sourceMappingURL=chunk-
|
|
4747
|
+
//# sourceMappingURL=chunk-AV6TZPXE.js.map
|
|
4748
|
+
//# sourceMappingURL=chunk-AV6TZPXE.js.map
|