@messenger-box/tailwind-ui-inbox 10.0.3-alpha.108 → 10.0.3-alpha.109
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/CHANGELOG.md +4 -0
- package/lib/components/AIAgent/AIAgent.d.ts.map +1 -1
- package/lib/components/AIAgent/AIAgent.js +19 -195
- package/lib/components/AIAgent/AIAgent.js.map +1 -1
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -1
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +16 -9
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -1
- package/lib/components/slot-fill/chat-message-filler.js +1 -1
- package/lib/components/slot-fill/chat-message-filler.js.map +1 -1
- package/lib/compute.d.ts.map +1 -1
- package/lib/compute.js +18 -8
- package/lib/compute.js.map +1 -1
- package/lib/container/AiLandingInput.d.ts.map +1 -1
- package/lib/container/AiLandingInput.js +3 -4
- package/lib/container/AiLandingInput.js.map +1 -1
- package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -1
- package/lib/container/InboxAiMessagesLoader.js +5 -2
- package/lib/container/InboxAiMessagesLoader.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/module.js +7 -7
- package/lib/module.js.map +1 -1
- package/lib/routes.json +22 -9
- package/lib/templates/InboxWithAi.d.ts.map +1 -1
- package/lib/templates/InboxWithAi.js +0 -1
- package/lib/templates/InboxWithAi.js.map +1 -1
- package/lib/templates/InboxWithAi.tsx +0 -1
- package/package.json +4 -4
- package/src/components/AIAgent/AIAgent.tsx +18 -215
- package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +24 -12
- package/src/compute.ts +20 -10
- package/src/container/AiLandingInput.tsx +8 -4
- package/src/container/InboxAiMessagesLoader.tsx +2 -1
- package/src/module.tsx +4 -4
- package/src/templates/InboxWithAi.tsx +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { format, differenceInMinutes } from 'date-fns';
|
|
3
|
-
import { IAuthUser, IPost, ISandboxError } from 'common';
|
|
3
|
+
import { AiAgentMessageRole, IAuthUser, IPost, ISandboxError, PostTypeEnum } from 'common';
|
|
4
4
|
import { FilesList } from '../../inbox';
|
|
5
5
|
import { ErrorFixCard } from './ErrorFixCard';
|
|
6
6
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -921,7 +921,16 @@ const ModernMessageGroup: React.FC<MessageGroupProps> = ({
|
|
|
921
921
|
// Inject CSS styles for HTML content
|
|
922
922
|
useInjectStyles();
|
|
923
923
|
|
|
924
|
-
const isOwnMessage = author?.id === currentUser?.id;
|
|
924
|
+
//const isOwnMessage = author?.id === currentUser?.id;
|
|
925
|
+
//const isOwnMessage = messages.some((message: any) => (message as any)?.propsConfiguration?.contents?.role === AiAgentMessageRole.User);
|
|
926
|
+
const isOwnMessage =
|
|
927
|
+
messages.some(
|
|
928
|
+
(message: any) => (message as any)?.propsConfiguration?.contents?.role === AiAgentMessageRole.User,
|
|
929
|
+
) ||
|
|
930
|
+
(Array.isArray(author?.alias) &&
|
|
931
|
+
typeof currentUser?.authUserId === 'string' &&
|
|
932
|
+
author.alias.some((alias: string) => alias?.toLowerCase() === currentUser.authUserId.toLowerCase()));
|
|
933
|
+
|
|
925
934
|
const authorName =
|
|
926
935
|
author?.givenName && author?.familyName
|
|
927
936
|
? `${author.givenName} ${author.familyName}`
|
|
@@ -934,10 +943,13 @@ const ModernMessageGroup: React.FC<MessageGroupProps> = ({
|
|
|
934
943
|
};
|
|
935
944
|
|
|
936
945
|
// Determine if this is an AI/system message for special styling
|
|
937
|
-
const isSystemMessage =
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
946
|
+
// const isSystemMessage =
|
|
947
|
+
// author?.username?.toLowerCase().includes('ai') ||
|
|
948
|
+
// author?.username?.toLowerCase().includes('assistant') ||
|
|
949
|
+
// author?.username?.toLowerCase().includes('system');
|
|
950
|
+
const isSystemMessage = messages.some(
|
|
951
|
+
(message: any) => (message as any)?.propsConfiguration?.contents?.role === AiAgentMessageRole.Assistant,
|
|
952
|
+
);
|
|
941
953
|
|
|
942
954
|
// For user messages, don't show group header, just individual messages with avatars
|
|
943
955
|
if (isOwnMessage) {
|
|
@@ -1046,8 +1058,7 @@ const ModernMessageBubble: React.FC<ModernMessageBubbleProps> = ({
|
|
|
1046
1058
|
onMessageClick?.(message);
|
|
1047
1059
|
};
|
|
1048
1060
|
|
|
1049
|
-
const isAssistantRole = (message as any)?.propsConfiguration?.contents?.role ===
|
|
1050
|
-
|
|
1061
|
+
const isAssistantRole = (message as any)?.propsConfiguration?.contents?.role === AiAgentMessageRole.Assistant;
|
|
1051
1062
|
// For user messages, create a right-aligned layout with avatar and name
|
|
1052
1063
|
if (isOwnMessage) {
|
|
1053
1064
|
const authorName =
|
|
@@ -1131,7 +1142,8 @@ const ModernMessageBubble: React.FC<ModernMessageBubbleProps> = ({
|
|
|
1131
1142
|
} transition-opacity object-cover`}
|
|
1132
1143
|
src={message.author?.picture || '/default-avatar.svg'}
|
|
1133
1144
|
alt={authorName}
|
|
1134
|
-
onClick={isAssistantRole ? undefined : handleClick}
|
|
1145
|
+
//onClick={isAssistantRole ? undefined : handleClick}
|
|
1146
|
+
onClick={isAssistantRole ? handleClick : undefined}
|
|
1135
1147
|
onError={(e) => {
|
|
1136
1148
|
e.currentTarget.src = '/default-avatar.svg';
|
|
1137
1149
|
}}
|
|
@@ -1147,9 +1159,10 @@ const ModernMessageBubble: React.FC<ModernMessageBubbleProps> = ({
|
|
|
1147
1159
|
return (
|
|
1148
1160
|
<div
|
|
1149
1161
|
className={`group/message transition-all duration-200 hover:bg-gray-50 rounded-lg px-3 py-1 -mx-3 ${
|
|
1150
|
-
isSystemMessage || isAssistantRole ? '' : '
|
|
1162
|
+
isSystemMessage || isAssistantRole ? 'cursor-pointer' : ''
|
|
1151
1163
|
}`}
|
|
1152
|
-
onClick={isSystemMessage || isAssistantRole ? undefined : handleClick}
|
|
1164
|
+
// onClick={isSystemMessage || isAssistantRole ? undefined : handleClick}
|
|
1165
|
+
onClick={isSystemMessage || isAssistantRole ? handleClick : undefined}
|
|
1153
1166
|
>
|
|
1154
1167
|
<div className="flex items-start justify-between gap-3">
|
|
1155
1168
|
<div className="flex-1 min-w-0">
|
|
@@ -1251,7 +1264,6 @@ export const ModernMessageGroupComponent: React.FC<ModernMessageGroupProps> = ({
|
|
|
1251
1264
|
sandboxErrors = [],
|
|
1252
1265
|
currentFiles = {},
|
|
1253
1266
|
onFixError,
|
|
1254
|
-
onRecreateSandbox,
|
|
1255
1267
|
}) => {
|
|
1256
1268
|
// Inject CSS styles for HTML content
|
|
1257
1269
|
useInjectStyles();
|
package/src/compute.ts
CHANGED
|
@@ -63,27 +63,37 @@ export const messengerPageStore: IRouteModule[] | { [key: string]: any } = [
|
|
|
63
63
|
name: 'AiMessenger',
|
|
64
64
|
path: '/ai-messenger',
|
|
65
65
|
},
|
|
66
|
-
|
|
67
66
|
{
|
|
68
67
|
exact: false,
|
|
69
68
|
icon: 'AiOutlineInbox',
|
|
70
|
-
key: 'ai-messenger-with-
|
|
69
|
+
key: 'ai-messenger-with-org-name',
|
|
70
|
+
component: () => import('./container/InboxWithAiLoader'),
|
|
71
|
+
tab: 'Ai Messenger',
|
|
72
|
+
position: IMenuPosition.Middle,
|
|
73
|
+
name: 'AiMessengerWithOrgName',
|
|
74
|
+
path: '//o/:orgName/ai-messenger',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
exact: false,
|
|
78
|
+
icon: 'AiOutlineInbox',
|
|
79
|
+
key: 'ai-messenger-app-with-channel-id',
|
|
71
80
|
component: () => import('./container/InboxAiMessagesLoader'),
|
|
72
81
|
tab: 'Ai Messenger',
|
|
73
82
|
position: IMenuPosition.Middle,
|
|
74
|
-
name: '
|
|
75
|
-
path: '/ai-messenger/app',
|
|
83
|
+
name: 'AiMessengerAppWithChannelId',
|
|
84
|
+
path: '/ai-messenger/app/:id',
|
|
76
85
|
},
|
|
77
86
|
{
|
|
78
87
|
exact: false,
|
|
79
88
|
icon: 'AiOutlineInbox',
|
|
80
|
-
key: 'ai-messenger-with-org-
|
|
81
|
-
component: () => import('./container/
|
|
89
|
+
key: 'ai-messenger-app-with-org-and-channel-id',
|
|
90
|
+
component: () => import('./container/InboxAiMessagesLoader'),
|
|
82
91
|
tab: 'Ai Messenger',
|
|
83
92
|
position: IMenuPosition.Middle,
|
|
84
|
-
name: '
|
|
85
|
-
path: '//o/:orgName/ai-messenger',
|
|
93
|
+
name: 'AiMessengerAppWithOrgAndChannelId',
|
|
94
|
+
path: '//o/:orgName/ai-messenger/app/:id',
|
|
86
95
|
},
|
|
96
|
+
|
|
87
97
|
// {
|
|
88
98
|
// exact: false,
|
|
89
99
|
// icon: 'AiOutlineInbox',
|
|
@@ -124,8 +134,8 @@ const selectedRoutes = [
|
|
|
124
134
|
'direct-message',
|
|
125
135
|
'ai-messenger',
|
|
126
136
|
'ai-messenger-with-org-name',
|
|
127
|
-
'ai-messenger-with-channel-id',
|
|
128
|
-
'ai-messenger-with-
|
|
137
|
+
'ai-messenger-app-with-channel-id',
|
|
138
|
+
'ai-messenger-app-with-org-and-channel-id',
|
|
129
139
|
'ai-messenger-with-preview',
|
|
130
140
|
];
|
|
131
141
|
|
|
@@ -121,12 +121,16 @@ const AiLandingInput: React.FC = () => {
|
|
|
121
121
|
setIsCreatingChannel(false);
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
const
|
|
124
|
+
|
|
125
|
+
const basePath = orgName
|
|
126
126
|
? config.AI_MESSENGER_PATH.replace(':orgName', orgName)
|
|
127
127
|
: config.AI_MESSENGER_PATH;
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
|
|
129
|
+
const targetPath = basePath.includes(':id')
|
|
130
|
+
? basePath.replace(':id', channelId)
|
|
131
|
+
: `${basePath.replace(/\/+$/, '')}/${channelId}`;
|
|
132
|
+
|
|
133
|
+
navigate(targetPath, { replace: true });
|
|
130
134
|
setIsCreatingChannel(false);
|
|
131
135
|
},
|
|
132
136
|
onError: (error: any) => {
|
|
@@ -18,7 +18,8 @@ const InboxWithAiLoaderOutlet = (props: InboxWithAiLoaderOutletProps) => {
|
|
|
18
18
|
const location = useLocation();
|
|
19
19
|
const { messages, setMessages, selectedPost, setSelectedPost, setIsLoading, isLoading } = useOutletContext() as any;
|
|
20
20
|
const urlParams = location?.search ? new URLSearchParams(location.search) : null;
|
|
21
|
-
const
|
|
21
|
+
const { id: pathChannelId } = useParams();
|
|
22
|
+
const channelId = urlParams?.get('id') || pathChannelId;
|
|
22
23
|
const user: any = useSelector<Store.Auth, IUserState>(userSelector, shallowEqual);
|
|
23
24
|
|
|
24
25
|
return (
|
package/src/module.tsx
CHANGED
|
@@ -20,10 +20,10 @@ export default new Feature({
|
|
|
20
20
|
// name: `${MESSAGE_SLOT_FILL_NAME}2`,
|
|
21
21
|
// render: ChatMessageFill2,
|
|
22
22
|
// },
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
23
|
+
// {
|
|
24
|
+
// name: 'inbox-with-ai-right-sidebar-1',
|
|
25
|
+
// render: RightSidebarFill,
|
|
26
|
+
// },
|
|
27
27
|
// {
|
|
28
28
|
// name: 'inbox-with-ai-right-sidebar-2',
|
|
29
29
|
// render: RightSidebarFill2,
|