@bytexbyte/nxtlinq-ai-agent-sdk 1.6.0 → 1.6.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/dist/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +8 -4
- package/dist/components/ui/BerifyMeModal.d.ts +1 -0
- package/dist/components/ui/BerifyMeModal.d.ts.map +1 -1
- package/dist/components/ui/BerifyMeModal.js +8 -10
- package/dist/components/ui/ChatBotUI.d.ts +1 -0
- package/dist/components/ui/ChatBotUI.d.ts.map +1 -1
- package/dist/components/ui/ChatBotUI.js +58 -213
- package/dist/components/ui/MessageInput.d.ts.map +1 -1
- package/dist/components/ui/MessageInput.js +41 -38
- package/dist/components/ui/MessageList.d.ts +1 -0
- package/dist/components/ui/MessageList.d.ts.map +1 -1
- package/dist/components/ui/MessageList.js +16 -79
- package/dist/components/ui/ModelSelector.d.ts +1 -0
- package/dist/components/ui/ModelSelector.d.ts.map +1 -1
- package/dist/components/ui/ModelSelector.js +51 -45
- package/dist/components/ui/NotificationModal.d.ts +1 -0
- package/dist/components/ui/NotificationModal.d.ts.map +1 -1
- package/dist/components/ui/NotificationModal.js +48 -74
- package/dist/components/ui/PermissionForm.d.ts +1 -1
- package/dist/components/ui/PermissionForm.d.ts.map +1 -1
- package/dist/components/ui/PermissionForm.js +296 -293
- package/dist/components/ui/PresetMessages.d.ts +1 -0
- package/dist/components/ui/PresetMessages.d.ts.map +1 -1
- package/dist/components/ui/PresetMessages.js +26 -27
- package/dist/components/ui/styles/isolatedStyles.d.ts +34 -0
- package/dist/components/ui/styles/isolatedStyles.d.ts.map +1 -0
- package/dist/components/ui/styles/isolatedStyles.js +449 -0
- package/package.json +1 -1
- package/umd/nxtlinq-ai-agent.umd.js +882 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAGb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA21DlD,CAAC"}
|
|
@@ -62,8 +62,10 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
62
62
|
// Persistent data (always use localStorage)
|
|
63
63
|
const [nxtlinqAITServiceAccessToken, setNxtlinqAITServiceAccessToken] = useLocalStorage('nxtlinqAITServiceAccessToken', '');
|
|
64
64
|
const [pseudoId, setPseudoId] = useLocalStorage('pseudoId', uuidv4());
|
|
65
|
-
// UI state (
|
|
66
|
-
const [suggestions, setSuggestions] =
|
|
65
|
+
// UI state (use session storage when useSessionStorageMode is true)
|
|
66
|
+
const [suggestions, setSuggestions] = useSessionStorageMode
|
|
67
|
+
? useSessionStorage('chatbot-suggestions', presetMessages)
|
|
68
|
+
: React.useState(presetMessages);
|
|
67
69
|
const [isAITEnabling, setIsAITEnabling] = React.useState(false);
|
|
68
70
|
// Use refs to get latest state values in hasPermission function
|
|
69
71
|
const hitAddressRef = React.useRef(hitAddress);
|
|
@@ -1358,8 +1360,10 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
1358
1360
|
setIsAITEnabling(false);
|
|
1359
1361
|
return false;
|
|
1360
1362
|
}
|
|
1361
|
-
//
|
|
1362
|
-
|
|
1363
|
+
// Get current permissions from AIT metadata instead of React state
|
|
1364
|
+
// This ensures we don't lose existing permissions when enabling new ones
|
|
1365
|
+
const currentAITPermissions = aitRef.current?.metadata?.permissions || permissions;
|
|
1366
|
+
const newPermissions = [...currentAITPermissions];
|
|
1363
1367
|
if (!newPermissions.includes(toolName)) {
|
|
1364
1368
|
newPermissions.push(toolName);
|
|
1365
1369
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAChC;AASD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsHtD,CAAC;AAGF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE;YACZ,KAAK,EAAE,GAAG,CAAC;YACX,WAAW,EAAE;gBACX,OAAO,EAAE,GAAG,CAAC;gBACb,UAAU,EAAE,GAAG,CAAC;aACjB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
2
3
|
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import { modalOverlay } from './styles/isolatedStyles';
|
|
3
6
|
// Built-in BerifyMe configuration
|
|
4
7
|
const BUILT_IN_BERIFYME_CONFIG = {
|
|
5
8
|
apiKeyId: 'staging_83dc824cb50b4e76747e352b4228f2ee',
|
|
@@ -102,13 +105,8 @@ export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete, mode =
|
|
|
102
105
|
};
|
|
103
106
|
if (!isOpen)
|
|
104
107
|
return null;
|
|
105
|
-
return (_jsx("div", { ref: modalRef,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
width: '100%',
|
|
110
|
-
height: '100%',
|
|
111
|
-
zIndex: 9999,
|
|
112
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)'
|
|
113
|
-
} }));
|
|
108
|
+
return (_jsx("div", { ref: modalRef, css: css `
|
|
109
|
+
${modalOverlay}
|
|
110
|
+
z-index: 9999 !important;
|
|
111
|
+
` }));
|
|
114
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyF/B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAkU7B,CAAC"}
|
|
@@ -1,53 +1,36 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
2
3
|
import * as React from 'react';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
3
5
|
import { useChatBot } from '../context/ChatBotContext';
|
|
4
6
|
import { PermissionForm } from './PermissionForm';
|
|
5
7
|
import { MessageList } from './MessageList';
|
|
6
8
|
import { MessageInput } from './MessageInput';
|
|
7
9
|
import { PresetMessages } from './PresetMessages';
|
|
8
10
|
import { ModelSelector } from './ModelSelector';
|
|
11
|
+
import { sdkContainer, floatingButton, chatWindow, chatHeader, headerTitle, headerButton, closeButton, modalOverlay, idvBanner, idvBannerTitle, idvBannerText, idvVerifyButton, idvDismissButton, loadingSpinner, successToast, errorToast, warningToast, infoToast, toastCloseButton } from './styles/isolatedStyles';
|
|
9
12
|
// Toast Notification Component
|
|
10
13
|
const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
11
|
-
const
|
|
12
|
-
const baseStyles =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gap: '12px',
|
|
23
|
-
minWidth: '300px',
|
|
24
|
-
maxWidth: '500px'
|
|
25
|
-
};
|
|
26
|
-
// Dynamically adjust position based on chat window state
|
|
27
|
-
if (isChatOpen) {
|
|
28
|
-
// When chat window is open, show notification above the chat window
|
|
29
|
-
Object.assign(baseStyles, {
|
|
30
|
-
top: 20,
|
|
31
|
-
right: 20, // Align with the right edge of chat window
|
|
32
|
-
maxWidth: '480px', // Slightly smaller than chat window width
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// When chat window is closed, show notification in bottom right corner
|
|
37
|
-
Object.assign(baseStyles, {
|
|
38
|
-
bottom: 20,
|
|
39
|
-
right: 20,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
14
|
+
const getToastStyles = () => {
|
|
15
|
+
const baseStyles = css `
|
|
16
|
+
${isChatOpen ? css `
|
|
17
|
+
top: 20px !important;
|
|
18
|
+
right: 20px !important;
|
|
19
|
+
max-width: 480px !important;
|
|
20
|
+
` : css `
|
|
21
|
+
bottom: 20px !important;
|
|
22
|
+
right: 20px !important;
|
|
23
|
+
`}
|
|
24
|
+
`;
|
|
42
25
|
switch (type) {
|
|
43
26
|
case 'success':
|
|
44
|
-
return {
|
|
27
|
+
return css `${successToast} ${baseStyles}`;
|
|
45
28
|
case 'error':
|
|
46
|
-
return {
|
|
29
|
+
return css `${errorToast} ${baseStyles}`;
|
|
47
30
|
case 'warning':
|
|
48
|
-
return {
|
|
31
|
+
return css `${warningToast} ${baseStyles}`;
|
|
49
32
|
default:
|
|
50
|
-
return {
|
|
33
|
+
return css `${infoToast} ${baseStyles}`;
|
|
51
34
|
}
|
|
52
35
|
};
|
|
53
36
|
const getIcon = () => {
|
|
@@ -62,19 +45,7 @@ const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
|
62
45
|
return 'ℹ️';
|
|
63
46
|
}
|
|
64
47
|
};
|
|
65
|
-
return (_jsxs("div", {
|
|
66
|
-
background: 'none',
|
|
67
|
-
border: 'none',
|
|
68
|
-
color: 'white',
|
|
69
|
-
fontSize: '18px',
|
|
70
|
-
cursor: 'pointer',
|
|
71
|
-
padding: '4px',
|
|
72
|
-
display: 'flex',
|
|
73
|
-
alignItems: 'center',
|
|
74
|
-
justifyContent: 'center',
|
|
75
|
-
borderRadius: '4px',
|
|
76
|
-
transition: 'background-color 0.2s'
|
|
77
|
-
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.2)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: "\u00D7" })] }));
|
|
48
|
+
return (_jsxs("div", { css: getToastStyles(), children: [_jsx("span", { css: css `font-size: 18px !important;`, children: getIcon() }), _jsx("span", { css: css `flex: 1 !important;`, children: message }), _jsx("button", { onClick: onClose, css: toastCloseButton, children: "\u00D7" })] }));
|
|
78
49
|
};
|
|
79
50
|
export const ChatBotUI = () => {
|
|
80
51
|
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading, hitAddress, walletInfo, onVerifyWallet, props } = useChatBot();
|
|
@@ -206,177 +177,51 @@ export const ChatBotUI = () => {
|
|
|
206
177
|
};
|
|
207
178
|
// Show floating button when chat is closed
|
|
208
179
|
if (!isOpen) {
|
|
209
|
-
return (_jsxs(
|
|
210
|
-
position: 'fixed',
|
|
211
|
-
bottom: '20px',
|
|
212
|
-
right: '20px',
|
|
213
|
-
backgroundColor: '#007bff',
|
|
214
|
-
color: 'white',
|
|
215
|
-
border: 'none',
|
|
216
|
-
padding: '10px 20px',
|
|
217
|
-
borderRadius: '20px',
|
|
218
|
-
cursor: 'pointer',
|
|
219
|
-
boxShadow: '0 2px 5px rgba(0,0,0,0.2)',
|
|
220
|
-
transition: 'all 0.3s ease',
|
|
221
|
-
zIndex: 1000,
|
|
222
|
-
fontSize: '14px',
|
|
223
|
-
fontWeight: '500'
|
|
224
|
-
}, onMouseOver: (e) => {
|
|
225
|
-
e.currentTarget.style.backgroundColor = '#0056b3';
|
|
226
|
-
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
227
|
-
}, onMouseOut: (e) => {
|
|
228
|
-
e.currentTarget.style.backgroundColor = '#007bff';
|
|
229
|
-
e.currentTarget.style.transform = 'translateY(0)';
|
|
230
|
-
}, title: "Open AI Agent Chat", children: "AI Agent" }), notification.show && (_jsx(ToastNotification, { type: notification.type, message: notification.message, onClose: handleCloseNotification, isChatOpen: isOpen }))] }));
|
|
180
|
+
return (_jsxs("div", { css: sdkContainer, children: [_jsx("button", { onClick: handleOpen, css: floatingButton, title: "Open AI Agent Chat", children: "AI Agent" }), notification.show && (_jsx(ToastNotification, { type: notification.type, message: notification.message, onClose: handleCloseNotification, isChatOpen: isOpen }))] }));
|
|
231
181
|
}
|
|
232
|
-
return (_jsxs(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
fontSize: '16px',
|
|
260
|
-
fontWeight: '600'
|
|
261
|
-
}, children: "AI Agent" }), _jsx("div", { style: { position: 'relative' }, children: _jsx(ModelSelector, {}) }), isAITLoading && (_jsxs("div", { style: {
|
|
262
|
-
display: 'flex',
|
|
263
|
-
alignItems: 'center',
|
|
264
|
-
gap: '5px',
|
|
265
|
-
fontSize: '12px',
|
|
266
|
-
opacity: '0.8'
|
|
267
|
-
}, children: [_jsx("div", { style: {
|
|
268
|
-
width: '12px',
|
|
269
|
-
height: '12px',
|
|
270
|
-
border: '2px solid rgba(255, 255, 255, 0.3)',
|
|
271
|
-
borderTop: '2px solid white',
|
|
272
|
-
borderRadius: '50%',
|
|
273
|
-
animation: 'spin 1s linear infinite'
|
|
274
|
-
} }), "Loading..."] }))] }), _jsxs("div", { style: {
|
|
275
|
-
display: 'flex',
|
|
276
|
-
alignItems: 'center',
|
|
277
|
-
gap: '10px'
|
|
278
|
-
}, children: [_jsx("button", { onClick: handleSettingsClick, style: {
|
|
279
|
-
background: 'none',
|
|
280
|
-
border: 'none',
|
|
281
|
-
color: 'white',
|
|
282
|
-
fontSize: '16px',
|
|
283
|
-
cursor: 'pointer',
|
|
284
|
-
padding: '4px',
|
|
285
|
-
display: 'flex',
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
justifyContent: 'center',
|
|
288
|
-
borderRadius: '4px',
|
|
289
|
-
transition: 'background-color 0.2s'
|
|
290
|
-
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.2)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', title: "AIT Settings", children: "\u2699\uFE0F" }), _jsx("button", { onClick: handleClose, style: {
|
|
291
|
-
background: 'none',
|
|
292
|
-
border: 'none',
|
|
293
|
-
color: 'white',
|
|
294
|
-
fontSize: '24px',
|
|
295
|
-
cursor: 'pointer',
|
|
296
|
-
padding: '0',
|
|
297
|
-
display: 'flex',
|
|
298
|
-
alignItems: 'center',
|
|
299
|
-
justifyContent: 'center'
|
|
300
|
-
}, children: "\u00D7" })] })] }), showIDVSuggestion && hitAddress && !props.requireWalletIDVVerification && !hasBerifymeToken && !isWalletVerifiedWithBerifyme && (_jsxs("div", { "data-idv-banner": true, style: {
|
|
301
|
-
backgroundColor: '#fff3cd',
|
|
302
|
-
border: '1px solid #ffeaa7',
|
|
303
|
-
borderLeft: '4px solid #f39c12',
|
|
304
|
-
margin: '16px',
|
|
305
|
-
padding: '16px',
|
|
306
|
-
borderRadius: '8px',
|
|
307
|
-
display: 'flex',
|
|
308
|
-
alignItems: 'center',
|
|
309
|
-
gap: '12px'
|
|
310
|
-
}, children: [_jsx("div", { style: {
|
|
311
|
-
fontSize: '20px',
|
|
312
|
-
color: '#f39c12'
|
|
313
|
-
}, children: "\uD83D\uDCA1" }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("h5", { style: {
|
|
314
|
-
margin: '0 0 8px 0',
|
|
315
|
-
fontSize: '14px',
|
|
316
|
-
fontWeight: '600',
|
|
317
|
-
color: '#856404'
|
|
318
|
-
}, children: "Recommended: Verify Your Wallet" }), _jsx("p", { style: {
|
|
319
|
-
margin: '0 0 12px 0',
|
|
320
|
-
fontSize: '13px',
|
|
321
|
-
color: '#856404',
|
|
322
|
-
lineHeight: '1.4'
|
|
323
|
-
}, children: "While not required, verifying your wallet with Berify.me provides additional security and trust for your AI agent interactions." }), _jsx("button", { onClick: () => onVerifyWallet('berifyme'), style: {
|
|
324
|
-
padding: '8px 16px',
|
|
325
|
-
backgroundColor: '#f39c12',
|
|
326
|
-
color: 'white',
|
|
327
|
-
border: 'none',
|
|
328
|
-
borderRadius: '6px',
|
|
329
|
-
cursor: 'pointer',
|
|
330
|
-
fontSize: '13px',
|
|
331
|
-
fontWeight: '500',
|
|
332
|
-
transition: 'background-color 0.2s'
|
|
333
|
-
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = '#e67e22', onMouseOut: (e) => e.currentTarget.style.backgroundColor = '#f39c12', children: "Verify Wallet" })] }), _jsx("button", { onClick: handleDismissIDV, style: {
|
|
334
|
-
background: 'none',
|
|
335
|
-
border: 'none',
|
|
336
|
-
color: '#856404',
|
|
337
|
-
fontSize: '18px',
|
|
338
|
-
cursor: 'pointer',
|
|
339
|
-
padding: '4px',
|
|
340
|
-
borderRadius: '4px',
|
|
341
|
-
transition: 'background-color 0.2s'
|
|
342
|
-
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(133, 100, 4, 0.1)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', title: `Hide for ${Math.floor((props.idvBannerDismissSeconds || 86400) / 3600)} hours`, children: "\u00D7" })] })), !showIDVSuggestion && dismissUntil && timeRemaining && (_jsxs("div", { style: {
|
|
343
|
-
backgroundColor: '#f8f9fa',
|
|
344
|
-
border: '1px solid #e9ecef',
|
|
345
|
-
margin: '16px',
|
|
346
|
-
padding: '12px',
|
|
347
|
-
borderRadius: '8px',
|
|
348
|
-
textAlign: 'center',
|
|
349
|
-
fontSize: '13px',
|
|
350
|
-
color: '#6c757d'
|
|
351
|
-
}, children: [_jsxs("span", { children: ["\uD83D\uDCA1 IDV suggestion hidden. Will show again in ", timeRemaining] }), _jsx("button", { onClick: () => {
|
|
182
|
+
return (_jsxs("div", { css: sdkContainer, children: [_jsxs("div", { css: chatWindow, children: [_jsxs("div", { css: chatHeader, children: [_jsxs("div", { css: css `
|
|
183
|
+
display: flex !important;
|
|
184
|
+
align-items: center !important;
|
|
185
|
+
gap: 10px !important;
|
|
186
|
+
`, children: [_jsx("h3", { css: headerTitle, children: "AI Agent" }), _jsx("div", { css: css `position: relative !important;`, children: _jsx(ModelSelector, {}) }), isAITLoading && (_jsxs("div", { css: css `
|
|
187
|
+
display: flex !important;
|
|
188
|
+
align-items: center !important;
|
|
189
|
+
gap: 5px !important;
|
|
190
|
+
font-size: 12px !important;
|
|
191
|
+
opacity: 0.8 !important;
|
|
192
|
+
`, children: [_jsx("div", { css: loadingSpinner }), "Loading..."] }))] }), _jsxs("div", { css: css `
|
|
193
|
+
display: flex !important;
|
|
194
|
+
align-items: center !important;
|
|
195
|
+
gap: 10px !important;
|
|
196
|
+
`, children: [_jsx("button", { onClick: handleSettingsClick, css: headerButton, title: "AIT Settings", children: "\u2699\uFE0F" }), _jsx("button", { onClick: handleClose, css: closeButton, children: "\u00D7" })] })] }), showIDVSuggestion && hitAddress && !props.requireWalletIDVVerification && !hasBerifymeToken && !isWalletVerifiedWithBerifyme && (_jsxs("div", { "data-idv-banner": true, css: idvBanner, children: [_jsx("div", { css: css `
|
|
197
|
+
font-size: 20px !important;
|
|
198
|
+
color: #f39c12 !important;
|
|
199
|
+
`, children: "\uD83D\uDCA1" }), _jsxs("div", { css: css `flex: 1 !important;`, children: [_jsx("h5", { css: idvBannerTitle, children: "Recommended: Verify Your Wallet" }), _jsx("p", { css: idvBannerText, children: "While not required, verifying your wallet with Berify.me provides additional security and trust for your AI agent interactions." }), _jsx("button", { onClick: () => onVerifyWallet('berifyme'), css: idvVerifyButton, children: "Verify Wallet" })] }), _jsx("button", { onClick: handleDismissIDV, css: idvDismissButton, title: `Hide for ${Math.floor((props.idvBannerDismissSeconds || 86400) / 3600)} hours`, children: "\u00D7" })] })), !showIDVSuggestion && dismissUntil && timeRemaining && (_jsxs("div", { css: css `
|
|
200
|
+
background-color: #f8f9fa !important;
|
|
201
|
+
border: 1px solid #e9ecef !important;
|
|
202
|
+
margin: 16px !important;
|
|
203
|
+
padding: 12px !important;
|
|
204
|
+
border-radius: 8px !important;
|
|
205
|
+
text-align: center !important;
|
|
206
|
+
font-size: 13px !important;
|
|
207
|
+
color: #6c757d !important;
|
|
208
|
+
`, children: [_jsxs("span", { children: ["\uD83D\uDCA1 IDV suggestion hidden. Will show again in ", timeRemaining] }), _jsx("button", { onClick: () => {
|
|
352
209
|
localStorage.removeItem('idv-suggestion-dismissed');
|
|
353
210
|
setShowIDVSuggestion(true);
|
|
354
211
|
setDismissUntil(null);
|
|
355
212
|
setTimeRemaining('');
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
position: 'fixed',
|
|
366
|
-
top: 0,
|
|
367
|
-
left: 0,
|
|
368
|
-
right: 0,
|
|
369
|
-
bottom: 0,
|
|
370
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
371
|
-
display: 'flex',
|
|
372
|
-
alignItems: 'center',
|
|
373
|
-
justifyContent: 'center',
|
|
374
|
-
zIndex: 1002,
|
|
375
|
-
padding: '20px'
|
|
376
|
-
}, onClick: (e) => {
|
|
213
|
+
}, css: css `
|
|
214
|
+
background: none !important;
|
|
215
|
+
border: none !important;
|
|
216
|
+
color: #007bff !important;
|
|
217
|
+
font-size: 12px !important;
|
|
218
|
+
cursor: pointer !important;
|
|
219
|
+
margin-left: 8px !important;
|
|
220
|
+
text-decoration: underline !important;
|
|
221
|
+
`, title: "Show now", children: "Show now" })] })), _jsx(MessageList, {}), _jsx(PresetMessages, {}), _jsx(MessageInput, {})] }), showPermissionForm && (_jsx("div", { css: modalOverlay, onClick: (e) => {
|
|
377
222
|
// Close modal when clicking on background
|
|
378
223
|
if (e.target === e.currentTarget) {
|
|
379
224
|
setShowPermissionForm(false);
|
|
380
225
|
}
|
|
381
|
-
}, children: _jsx(PermissionForm, { onClose: () => setShowPermissionForm(false)
|
|
226
|
+
}, children: _jsx(PermissionForm, { onClose: () => setShowPermissionForm(false) }) })), notification.show && (_jsx(ToastNotification, { type: notification.type, message: notification.message, onClose: handleCloseNotification, isChatOpen: isOpen }))] }));
|
|
382
227
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAiGhC,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
2
3
|
import MicIcon from '@mui/icons-material/Mic';
|
|
3
4
|
import MicOffIcon from '@mui/icons-material/MicOff';
|
|
4
5
|
import { IconButton, InputBase } from '@mui/material';
|
|
6
|
+
import { css } from '@emotion/react';
|
|
5
7
|
import { useChatBot } from '../context/ChatBotContext';
|
|
8
|
+
import { actionButton } from './styles/isolatedStyles';
|
|
6
9
|
export const MessageInput = () => {
|
|
7
10
|
const { inputValue, setInputValue, isLoading, isAITLoading, handleSubmit, isRecording, startRecording, stopRecording, textInputRef, props: { placeholder = 'Type a message...' } } = useChatBot();
|
|
8
11
|
const isDisabled = isLoading || isAITLoading;
|
|
@@ -13,42 +16,42 @@ export const MessageInput = () => {
|
|
|
13
16
|
handleSubmit(e);
|
|
14
17
|
}
|
|
15
18
|
};
|
|
16
|
-
return (_jsxs("div", {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return (_jsxs("div", { css: css `
|
|
20
|
+
padding: 15px !important;
|
|
21
|
+
display: flex !important;
|
|
22
|
+
gap: 10px !important;
|
|
23
|
+
border-top: 1px solid #eee !important;
|
|
24
|
+
`, children: [_jsx(InputBase, { value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyPress: handleKeyPress, placeholder: inputPlaceholder, disabled: isDisabled, fullWidth: true, inputProps: {
|
|
22
25
|
ref: textInputRef
|
|
23
|
-
}, endAdornment: _jsx(IconButton, { onClick: () => isRecording ? stopRecording() : startRecording(), disabled: isDisabled, children: isRecording ? _jsx(MicIcon, {}) : _jsx(MicOffIcon, {}) }), onFocus: () => stopRecording(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
26
|
+
}, endAdornment: _jsx(IconButton, { onClick: () => isRecording ? stopRecording() : startRecording(), disabled: isDisabled, children: isRecording ? _jsx(MicIcon, {}) : _jsx(MicOffIcon, {}) }), onFocus: () => stopRecording(), css: css `
|
|
27
|
+
flex: 1 !important;
|
|
28
|
+
padding: 10px !important;
|
|
29
|
+
border: 1px solid #ddd !important;
|
|
30
|
+
border-radius: 20px !important;
|
|
31
|
+
outline: none !important;
|
|
32
|
+
font-size: 14px !important;
|
|
33
|
+
background-color: ${isDisabled ? '#f8f9fa' : '#fff'} !important;
|
|
34
|
+
` }), _jsxs("button", { onClick: (e) => handleSubmit(e), disabled: isDisabled || !inputValue.trim(), css: css `
|
|
35
|
+
${actionButton}
|
|
36
|
+
padding: 10px 20px !important;
|
|
37
|
+
border-radius: 20px !important;
|
|
38
|
+
position: relative !important;
|
|
39
|
+
display: flex !important;
|
|
40
|
+
align-items: center !important;
|
|
41
|
+
justify-content: center !important;
|
|
42
|
+
|
|
43
|
+
&:disabled {
|
|
44
|
+
background-color: #e9ecef !important;
|
|
45
|
+
color: #6c757d !important;
|
|
46
|
+
cursor: not-allowed !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
|
+
background-color: #0056b3 !important;
|
|
51
|
+
}
|
|
52
|
+
`, children: ["Send", (isLoading || isAITLoading) && (_jsx("span", { css: css `
|
|
53
|
+
margin-left: 8px !important;
|
|
54
|
+
display: flex !important;
|
|
55
|
+
align-items: center !important;
|
|
56
|
+
`, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 50 50", children: _jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: "#fff", strokeWidth: "4", strokeDasharray: "31.4 31.4", strokeLinecap: "round", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "1s", repeatCount: "indefinite" }) }) }) }))] })] }));
|
|
54
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAiI/B,CAAC"}
|