@bytexbyte/nxtlinq-ai-agent-sdk 1.4.7 → 1.5.0
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 +74 -531
- package/dist/components/ChatBot.d.ts.map +1 -1
- package/dist/components/ChatBot.js +29 -2
- package/dist/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +16 -3
- package/dist/components/types/ChatBotTypes.d.ts +1 -0
- package/dist/components/types/ChatBotTypes.d.ts.map +1 -1
- package/dist/components/ui/BerifyMeModal.d.ts +20 -0
- package/dist/components/ui/BerifyMeModal.d.ts.map +1 -0
- package/dist/components/ui/BerifyMeModal.js +107 -0
- package/dist/components/ui/ChatBotUI.d.ts.map +1 -1
- package/dist/components/ui/ChatBotUI.js +157 -3
- package/dist/components/ui/PermissionForm.d.ts.map +1 -1
- package/dist/components/ui/PermissionForm.js +5 -2
- package/dist/core/utils/__tests__/urlUtils.test.d.ts +5 -0
- package/dist/core/utils/__tests__/urlUtils.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/urlUtils.test.js +57 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/setupTests.d.ts +2 -0
- package/dist/setupTests.d.ts.map +1 -0
- package/dist/setupTests.js +16 -0
- package/dist/types/ait-api.d.ts +1 -0
- package/dist/types/ait-api.d.ts.map +1 -1
- package/package.json +2 -2
- package/umd/nxtlinq-ai-agent.umd.js +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBot.d.ts","sourceRoot":"","sources":["../../src/components/ChatBot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatBot.d.ts","sourceRoot":"","sources":["../../src/components/ChatBot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA6C1C,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { ChatBotProvider } from './context/ChatBotContext';
|
|
3
4
|
import { ChatBotUI } from './ui/ChatBotUI';
|
|
5
|
+
import { BerifyMeModal } from './ui/BerifyMeModal';
|
|
4
6
|
export const ChatBot = (props) => {
|
|
5
|
-
|
|
7
|
+
const [isBerifyMeModalOpen, setIsBerifyMeModalOpen] = React.useState(false);
|
|
8
|
+
// Handle wallet verification
|
|
9
|
+
const handleVerifyWallet = async () => {
|
|
10
|
+
// Built-in BerifyMe support is always available
|
|
11
|
+
// Check if token already exists in URL
|
|
12
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
13
|
+
const token = urlParams.get('token');
|
|
14
|
+
if (token) {
|
|
15
|
+
console.log('Token found in URL, returning it');
|
|
16
|
+
return Promise.resolve({ token });
|
|
17
|
+
}
|
|
18
|
+
// Open built-in BerifyMe modal
|
|
19
|
+
setIsBerifyMeModalOpen(true);
|
|
20
|
+
return;
|
|
21
|
+
};
|
|
22
|
+
// Handle BerifyMe verification completion
|
|
23
|
+
const handleBerifyMeComplete = (token) => {
|
|
24
|
+
setIsBerifyMeModalOpen(false);
|
|
25
|
+
// Token is handled by the system automatically
|
|
26
|
+
};
|
|
27
|
+
// Merge props, add processed onVerifyWallet
|
|
28
|
+
const enhancedProps = {
|
|
29
|
+
...props,
|
|
30
|
+
onVerifyWallet: handleVerifyWallet
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx(ChatBotProvider, { ...enhancedProps, children: _jsx(ChatBotUI, {}) }), _jsx(BerifyMeModal, { isOpen: isBerifyMeModalOpen, onClose: () => setIsBerifyMeModalOpen(false), onVerificationComplete: handleBerifyMeComplete })] }));
|
|
6
33
|
};
|
|
@@ -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,CAovDlD,CAAC"}
|
|
@@ -22,7 +22,9 @@ export const ChatBotProvider = ({ onMessage, onError, onToolUse, presetMessages
|
|
|
22
22
|
// AI Model related attributes
|
|
23
23
|
availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector = true, onModelChange,
|
|
24
24
|
// Storage mode configuration
|
|
25
|
-
useSessionStorage: useSessionStorageMode = false
|
|
25
|
+
useSessionStorage: useSessionStorageMode = false,
|
|
26
|
+
// Wallet verification configuration
|
|
27
|
+
requireWalletIDVVerification = true }) => {
|
|
26
28
|
const nxtlinqApi = React.useMemo(() => createNxtlinqApi(apiKey, apiSecret), [apiKey, apiSecret]);
|
|
27
29
|
// Custom hook
|
|
28
30
|
const { isRecording, transcript, start: startRecording, stop: stopRecording } = useSpeechToTextFromMic({
|
|
@@ -919,6 +921,8 @@ useSessionStorage: useSessionStorageMode = false }) => {
|
|
|
919
921
|
}
|
|
920
922
|
}
|
|
921
923
|
let botResponse;
|
|
924
|
+
// Store redirectUrl for later use (don't redirect yet)
|
|
925
|
+
const redirectUrl = response?.redirectUrl;
|
|
922
926
|
if (response.toolCall?.toolUse) {
|
|
923
927
|
// Handle tool calls
|
|
924
928
|
const toolUse = response.toolCall.toolUse;
|
|
@@ -1063,6 +1067,13 @@ useSessionStorage: useSessionStorageMode = false }) => {
|
|
|
1063
1067
|
};
|
|
1064
1068
|
setMessages(prev => [...prev, botResponse]);
|
|
1065
1069
|
}
|
|
1070
|
+
// Execute redirect after all message processing is complete
|
|
1071
|
+
if (redirectUrl) {
|
|
1072
|
+
// Use setTimeout to ensure the message is displayed before redirect
|
|
1073
|
+
setTimeout(() => {
|
|
1074
|
+
window.location.href = redirectUrl;
|
|
1075
|
+
}, 100);
|
|
1076
|
+
}
|
|
1066
1077
|
}
|
|
1067
1078
|
catch (error) {
|
|
1068
1079
|
console.error('Failed to send message:', error);
|
|
@@ -1230,7 +1241,7 @@ useSessionStorage: useSessionStorageMode = false }) => {
|
|
|
1230
1241
|
metadataCid,
|
|
1231
1242
|
};
|
|
1232
1243
|
setAit(aitInfo);
|
|
1233
|
-
setPermissions(permissions);
|
|
1244
|
+
setPermissions(newPermissions || permissions);
|
|
1234
1245
|
};
|
|
1235
1246
|
// Auto enable AIT permission
|
|
1236
1247
|
const enableAIT = async (toolName) => {
|
|
@@ -1619,7 +1630,9 @@ useSessionStorage: useSessionStorageMode = false }) => {
|
|
|
1619
1630
|
availableModels,
|
|
1620
1631
|
defaultModelIndex,
|
|
1621
1632
|
showModelSelector,
|
|
1622
|
-
onModelChange
|
|
1633
|
+
onModelChange,
|
|
1634
|
+
useSessionStorage: useSessionStorageMode,
|
|
1635
|
+
requireWalletIDVVerification
|
|
1623
1636
|
},
|
|
1624
1637
|
nxtlinqApi
|
|
1625
1638
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotTypes.d.ts","sourceRoot":"","sources":["../../../src/components/types/ChatBotTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,OAAO,EAKtC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,OAAO,EAwBzC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwB/C,CAAC;AAEF,MAAM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D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BerifyMeModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onVerificationComplete?: (token?: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const BerifyMeModal: React.FC<BerifyMeModalProps>;
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
BerifyMeSDK?: {
|
|
11
|
+
modal: any;
|
|
12
|
+
environment: {
|
|
13
|
+
Staging: any;
|
|
14
|
+
Production: any;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=BerifyMeModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,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;CACnD;AASD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoHtD,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"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
// Built-in BerifyMe configuration
|
|
4
|
+
const BUILT_IN_BERIFYME_CONFIG = {
|
|
5
|
+
apiKeyId: 'staging_83dc824cb50b4e76747e352b4228f2ee',
|
|
6
|
+
secretKey: 'ee96158a-9ae2-42ad-8c30-f7b23edbf258',
|
|
7
|
+
environment: 'staging'
|
|
8
|
+
};
|
|
9
|
+
export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete }) => {
|
|
10
|
+
const modalRef = useRef(null);
|
|
11
|
+
const berifyMeModalRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!isOpen)
|
|
14
|
+
return;
|
|
15
|
+
// Dynamically load BerifyMe SDK
|
|
16
|
+
const loadBerifyMeSDK = async () => {
|
|
17
|
+
try {
|
|
18
|
+
// Check if already loaded
|
|
19
|
+
if (window.BerifyMeSDK) {
|
|
20
|
+
renderBerifyMeModal();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Dynamically load SDK
|
|
24
|
+
const script = document.createElement('script');
|
|
25
|
+
script.src = 'https://docs.nxtlinq.ai/sdk/umd/berifyme-sdk.umd.js';
|
|
26
|
+
script.onload = () => {
|
|
27
|
+
if (window.BerifyMeSDK) {
|
|
28
|
+
renderBerifyMeModal();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
script.onerror = () => {
|
|
32
|
+
console.error('❌ Failed to load BerifyMe SDK');
|
|
33
|
+
onClose();
|
|
34
|
+
};
|
|
35
|
+
document.head.appendChild(script);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('❌ Error loading BerifyMe SDK:', error);
|
|
39
|
+
onClose();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
loadBerifyMeSDK();
|
|
43
|
+
return () => {
|
|
44
|
+
// Cleanup function
|
|
45
|
+
if (berifyMeModalRef.current) {
|
|
46
|
+
try {
|
|
47
|
+
berifyMeModalRef.current.unmount?.();
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
// Ignore cleanup errors
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}, [isOpen]);
|
|
55
|
+
const renderBerifyMeModal = () => {
|
|
56
|
+
if (!window.BerifyMeSDK || !modalRef.current)
|
|
57
|
+
return;
|
|
58
|
+
try {
|
|
59
|
+
// Build redirect URL - always redirect to current page
|
|
60
|
+
const currentUrl = window.location.href;
|
|
61
|
+
const redirectUrl = `${window.location.origin}${window.location.pathname}?isAutoConnect=true&method=berifyme&returnUrl=${encodeURIComponent(currentUrl)}`;
|
|
62
|
+
// Create BerifyMe modal using built-in config
|
|
63
|
+
const berifyMeModal = window.BerifyMeSDK.modal;
|
|
64
|
+
// Always use staging environment for now
|
|
65
|
+
const environment = window.BerifyMeSDK.environment.Staging;
|
|
66
|
+
// Use React 18's createRoot
|
|
67
|
+
const { createRoot } = require('react-dom/client');
|
|
68
|
+
const root = createRoot(modalRef.current);
|
|
69
|
+
berifyMeModalRef.current = root;
|
|
70
|
+
root.render(React.createElement(berifyMeModal, {
|
|
71
|
+
environment,
|
|
72
|
+
apiKeyId: BUILT_IN_BERIFYME_CONFIG.apiKeyId,
|
|
73
|
+
secretKey: BUILT_IN_BERIFYME_CONFIG.secretKey,
|
|
74
|
+
redirectUrl,
|
|
75
|
+
onUpdate: (event) => {
|
|
76
|
+
if (event.detail.page.pageName === 'All Set') {
|
|
77
|
+
console.log('✅ BerifyMe wallet verification completed successfully!');
|
|
78
|
+
// Get token if available
|
|
79
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
80
|
+
const token = urlParams.get('token');
|
|
81
|
+
// Call completion callback
|
|
82
|
+
if (onVerificationComplete) {
|
|
83
|
+
onVerificationComplete(token || undefined);
|
|
84
|
+
}
|
|
85
|
+
// Close modal
|
|
86
|
+
onClose();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error('❌ Error rendering BerifyMe modal:', error);
|
|
93
|
+
onClose();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
if (!isOpen)
|
|
97
|
+
return null;
|
|
98
|
+
return (_jsx("div", { ref: modalRef, style: {
|
|
99
|
+
position: 'fixed',
|
|
100
|
+
top: 0,
|
|
101
|
+
left: 0,
|
|
102
|
+
width: '100%',
|
|
103
|
+
height: '100%',
|
|
104
|
+
zIndex: 9999,
|
|
105
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)'
|
|
106
|
+
} }));
|
|
107
|
+
};
|
|
@@ -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;AAqG/B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqG/B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EA4c7B,CAAC"}
|
|
@@ -77,7 +77,97 @@ const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
|
77
77
|
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.2)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: "\u00D7" })] }));
|
|
78
78
|
};
|
|
79
79
|
export const ChatBotUI = () => {
|
|
80
|
-
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading,
|
|
80
|
+
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading, hitAddress, walletInfo, onVerifyWallet, props } = useChatBot();
|
|
81
|
+
// IDV suggestion banner state
|
|
82
|
+
const [showIDVSuggestion, setShowIDVSuggestion] = React.useState(true);
|
|
83
|
+
const [dismissUntil, setDismissUntil] = React.useState(null);
|
|
84
|
+
const [timeRemaining, setTimeRemaining] = React.useState('');
|
|
85
|
+
// Check if IDV suggestion should be shown
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
// Add delay to prevent flashing when wallet info is still loading
|
|
88
|
+
// Only show suggestion when verification is not required
|
|
89
|
+
if (hitAddress && !walletInfo?.id && !props.requireWalletIDVVerification) {
|
|
90
|
+
// Wait 1 second to allow wallet info to fully load
|
|
91
|
+
const timer = setTimeout(() => {
|
|
92
|
+
// Re-check conditions after delay
|
|
93
|
+
if (hitAddress && !walletInfo?.id && !props.requireWalletIDVVerification) {
|
|
94
|
+
const dismissed = localStorage.getItem('idv-suggestion-dismissed');
|
|
95
|
+
if (dismissed) {
|
|
96
|
+
const dismissTime = parseInt(dismissed);
|
|
97
|
+
const now = Date.now();
|
|
98
|
+
const timeLeft = dismissTime - now;
|
|
99
|
+
if (timeLeft > 0) {
|
|
100
|
+
// Still within 24 hours, don't show
|
|
101
|
+
setShowIDVSuggestion(false);
|
|
102
|
+
setDismissUntil(dismissTime);
|
|
103
|
+
// Start countdown timer
|
|
104
|
+
const countdownTimer = setInterval(() => {
|
|
105
|
+
const remaining = dismissTime - Date.now();
|
|
106
|
+
if (remaining > 0) {
|
|
107
|
+
const hours = Math.floor(remaining / (1000 * 60 * 60));
|
|
108
|
+
const minutes = Math.floor((remaining % (1000 * 60 * 60)) / (1000 * 60));
|
|
109
|
+
setTimeRemaining(`${hours}h ${minutes}m`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// 24 hours passed, show again
|
|
113
|
+
setShowIDVSuggestion(true);
|
|
114
|
+
setDismissUntil(null);
|
|
115
|
+
setTimeRemaining('');
|
|
116
|
+
localStorage.removeItem('idv-suggestion-dismissed');
|
|
117
|
+
clearInterval(countdownTimer);
|
|
118
|
+
}
|
|
119
|
+
}, 60000); // Update every minute
|
|
120
|
+
return () => clearInterval(countdownTimer);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// 24 hours passed, show again
|
|
124
|
+
localStorage.removeItem('idv-suggestion-dismissed');
|
|
125
|
+
setShowIDVSuggestion(true);
|
|
126
|
+
setDismissUntil(null);
|
|
127
|
+
setTimeRemaining('');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Never dismissed, show
|
|
132
|
+
setShowIDVSuggestion(true);
|
|
133
|
+
setDismissUntil(null);
|
|
134
|
+
setTimeRemaining('');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
console.log('❌ After delay: conditions no longer met, hiding suggestion');
|
|
139
|
+
setShowIDVSuggestion(false);
|
|
140
|
+
setDismissUntil(null);
|
|
141
|
+
setTimeRemaining('');
|
|
142
|
+
}
|
|
143
|
+
}, 1000); // 1 second delay
|
|
144
|
+
// Cleanup timer if component unmounts or dependencies change
|
|
145
|
+
return () => clearTimeout(timer);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Don't show when:
|
|
149
|
+
// - No wallet connected (no hitAddress)
|
|
150
|
+
// - Wallet is already verified (walletInfo?.id exists)
|
|
151
|
+
setShowIDVSuggestion(false);
|
|
152
|
+
setDismissUntil(null);
|
|
153
|
+
setTimeRemaining('');
|
|
154
|
+
}
|
|
155
|
+
}, [hitAddress, walletInfo]);
|
|
156
|
+
// Handle dismiss IDV suggestion
|
|
157
|
+
const handleDismissIDV = () => {
|
|
158
|
+
const dismissTime = Date.now() + (24 * 60 * 60 * 1000); // 24 hours from now
|
|
159
|
+
localStorage.setItem('idv-suggestion-dismissed', dismissTime.toString());
|
|
160
|
+
setShowIDVSuggestion(false);
|
|
161
|
+
setDismissUntil(dismissTime);
|
|
162
|
+
// Show confirmation message
|
|
163
|
+
setNotification({
|
|
164
|
+
show: true,
|
|
165
|
+
type: 'info',
|
|
166
|
+
message: 'IDV suggestion hidden for 24 hours. You can still verify your wallet anytime.',
|
|
167
|
+
autoHide: true,
|
|
168
|
+
duration: 5000
|
|
169
|
+
});
|
|
170
|
+
};
|
|
81
171
|
// Add CSS animation for loading spinner
|
|
82
172
|
React.useEffect(() => {
|
|
83
173
|
const style = document.createElement('style');
|
|
@@ -142,7 +232,7 @@ export const ChatBotUI = () => {
|
|
|
142
232
|
flexDirection: 'column',
|
|
143
233
|
zIndex: 1001,
|
|
144
234
|
overflow: 'hidden'
|
|
145
|
-
},
|
|
235
|
+
}, children: [_jsxs("div", { style: {
|
|
146
236
|
padding: '15px',
|
|
147
237
|
backgroundColor: '#007bff',
|
|
148
238
|
color: 'white',
|
|
@@ -197,7 +287,71 @@ export const ChatBotUI = () => {
|
|
|
197
287
|
display: 'flex',
|
|
198
288
|
alignItems: 'center',
|
|
199
289
|
justifyContent: 'center'
|
|
200
|
-
}, children: "\u00D7" })] })] }),
|
|
290
|
+
}, children: "\u00D7" })] })] }), showIDVSuggestion && hitAddress && !walletInfo?.id && !props.requireWalletIDVVerification && (_jsxs("div", { "data-idv-banner": true, style: {
|
|
291
|
+
backgroundColor: '#fff3cd',
|
|
292
|
+
border: '1px solid #ffeaa7',
|
|
293
|
+
borderLeft: '4px solid #f39c12',
|
|
294
|
+
margin: '16px',
|
|
295
|
+
padding: '16px',
|
|
296
|
+
borderRadius: '8px',
|
|
297
|
+
display: 'flex',
|
|
298
|
+
alignItems: 'center',
|
|
299
|
+
gap: '12px'
|
|
300
|
+
}, children: [_jsx("div", { style: {
|
|
301
|
+
fontSize: '20px',
|
|
302
|
+
color: '#f39c12'
|
|
303
|
+
}, children: "\uD83D\uDCA1" }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("h5", { style: {
|
|
304
|
+
margin: '0 0 8px 0',
|
|
305
|
+
fontSize: '14px',
|
|
306
|
+
fontWeight: '600',
|
|
307
|
+
color: '#856404'
|
|
308
|
+
}, children: "Recommended: Verify Your Wallet" }), _jsx("p", { style: {
|
|
309
|
+
margin: '0 0 12px 0',
|
|
310
|
+
fontSize: '13px',
|
|
311
|
+
color: '#856404',
|
|
312
|
+
lineHeight: '1.4'
|
|
313
|
+
}, children: "While not required, verifying your wallet with Berify.me provides additional security and trust for your AI agent interactions." }), _jsx("button", { onClick: onVerifyWallet, style: {
|
|
314
|
+
padding: '8px 16px',
|
|
315
|
+
backgroundColor: '#f39c12',
|
|
316
|
+
color: 'white',
|
|
317
|
+
border: 'none',
|
|
318
|
+
borderRadius: '6px',
|
|
319
|
+
cursor: 'pointer',
|
|
320
|
+
fontSize: '13px',
|
|
321
|
+
fontWeight: '500',
|
|
322
|
+
transition: 'background-color 0.2s'
|
|
323
|
+
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = '#e67e22', onMouseOut: (e) => e.currentTarget.style.backgroundColor = '#f39c12', children: "Verify Wallet" })] }), _jsx("button", { onClick: handleDismissIDV, style: {
|
|
324
|
+
background: 'none',
|
|
325
|
+
border: 'none',
|
|
326
|
+
color: '#856404',
|
|
327
|
+
fontSize: '18px',
|
|
328
|
+
cursor: 'pointer',
|
|
329
|
+
padding: '4px',
|
|
330
|
+
borderRadius: '4px',
|
|
331
|
+
transition: 'background-color 0.2s'
|
|
332
|
+
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(133, 100, 4, 0.1)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', title: "Hide for 24 hours", children: "\u00D7" })] })), !showIDVSuggestion && dismissUntil && timeRemaining && (_jsxs("div", { style: {
|
|
333
|
+
backgroundColor: '#f8f9fa',
|
|
334
|
+
border: '1px solid #e9ecef',
|
|
335
|
+
margin: '16px',
|
|
336
|
+
padding: '12px',
|
|
337
|
+
borderRadius: '8px',
|
|
338
|
+
textAlign: 'center',
|
|
339
|
+
fontSize: '13px',
|
|
340
|
+
color: '#6c757d'
|
|
341
|
+
}, children: [_jsxs("span", { children: ["\uD83D\uDCA1 IDV suggestion hidden. Will show again in ", timeRemaining] }), _jsx("button", { onClick: () => {
|
|
342
|
+
localStorage.removeItem('idv-suggestion-dismissed');
|
|
343
|
+
setShowIDVSuggestion(true);
|
|
344
|
+
setDismissUntil(null);
|
|
345
|
+
setTimeRemaining('');
|
|
346
|
+
}, style: {
|
|
347
|
+
background: 'none',
|
|
348
|
+
border: 'none',
|
|
349
|
+
color: '#007bff',
|
|
350
|
+
fontSize: '12px',
|
|
351
|
+
cursor: 'pointer',
|
|
352
|
+
marginLeft: '8px',
|
|
353
|
+
textDecoration: 'underline'
|
|
354
|
+
}, title: "Show now", children: "Show now" })] })), _jsx(MessageList, {}), _jsx(PresetMessages, {}), _jsx(MessageInput, {})] }), showPermissionForm && (_jsx("div", { style: {
|
|
201
355
|
position: 'fixed',
|
|
202
356
|
top: 0,
|
|
203
357
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoiBxD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useChatBot } from '../context/ChatBotContext';
|
|
4
4
|
export const PermissionForm = ({ onClose, onOpen }) => {
|
|
5
|
-
const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false, refreshAIT } = useChatBot();
|
|
5
|
+
const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false, refreshAIT, props } = useChatBot();
|
|
6
6
|
const [availablePermissions, setAvailablePermissions] = React.useState([]);
|
|
7
7
|
const [isSaving, setIsSaving] = React.useState(false);
|
|
8
8
|
const [tempPermissions, setTempPermissions] = React.useState(permissions);
|
|
@@ -47,7 +47,10 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
47
47
|
refreshWalletInfo();
|
|
48
48
|
}
|
|
49
49
|
}, [hitAddress]);
|
|
50
|
+
// Check if wallet IDV verification is required based on configuration
|
|
51
|
+
const requireWalletIDVVerification = props.requireWalletIDVVerification ?? true; // Default to true
|
|
50
52
|
const isWalletVerified = Boolean(walletInfo?.id);
|
|
53
|
+
const shouldShowVerificationPrompt = requireWalletIDVVerification && !isWalletVerified;
|
|
51
54
|
const handleSave = async () => {
|
|
52
55
|
setIsSaving(true);
|
|
53
56
|
try {
|
|
@@ -235,7 +238,7 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
235
238
|
if (isNeedSignInWithWallet) {
|
|
236
239
|
e.currentTarget.style.backgroundColor = '#007bff';
|
|
237
240
|
}
|
|
238
|
-
}, children: !isNeedSignInWithWallet ? 'Signed In' : 'Sign In' })] })) :
|
|
241
|
+
}, children: !isNeedSignInWithWallet ? 'Signed In' : 'Sign In' })] })) : shouldShowVerificationPrompt ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
|
|
239
242
|
marginBottom: '12px',
|
|
240
243
|
fontSize: '16px',
|
|
241
244
|
color: '#666'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlUtils.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/urlUtils.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for URL utility functions
|
|
3
|
+
*/
|
|
4
|
+
import { containsUrls, convertUrlsToLinks, convertUrlsToHtml } from '../urlUtils';
|
|
5
|
+
describe('URL Utils', () => {
|
|
6
|
+
describe('containsUrls', () => {
|
|
7
|
+
it('should detect URLs with http protocol', () => {
|
|
8
|
+
expect(containsUrls('Visit https://example.com for more info')).toBe(true);
|
|
9
|
+
expect(containsUrls('Check out http://test.org')).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
it('should detect URLs with www', () => {
|
|
12
|
+
expect(containsUrls('Go to www.google.com')).toBe(true);
|
|
13
|
+
expect(containsUrls('Visit www.example.org')).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('should detect domain names', () => {
|
|
16
|
+
expect(containsUrls('Contact us at support@company.com')).toBe(false);
|
|
17
|
+
expect(containsUrls('Visit company.com for details')).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it('should return false for text without URLs', () => {
|
|
20
|
+
expect(containsUrls('This is just plain text')).toBe(false);
|
|
21
|
+
expect(containsUrls('No URLs here')).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('convertUrlsToHtml', () => {
|
|
25
|
+
it('should convert URLs to HTML anchor tags', () => {
|
|
26
|
+
const text = 'Visit https://example.com for more info';
|
|
27
|
+
const result = convertUrlsToHtml(text);
|
|
28
|
+
expect(result).toContain('<a href="https://example.com"');
|
|
29
|
+
expect(result).toContain('target="_blank"');
|
|
30
|
+
expect(result).toContain('rel="noopener noreferrer"');
|
|
31
|
+
});
|
|
32
|
+
it('should handle www URLs', () => {
|
|
33
|
+
const text = 'Go to www.google.com';
|
|
34
|
+
const result = convertUrlsToHtml(text);
|
|
35
|
+
expect(result).toContain('<a href="https://www.google.com"');
|
|
36
|
+
});
|
|
37
|
+
it('should handle multiple URLs', () => {
|
|
38
|
+
const text = 'Visit https://example.com and www.google.com';
|
|
39
|
+
const result = convertUrlsToHtml(text);
|
|
40
|
+
expect(result).toContain('https://example.com');
|
|
41
|
+
expect(result).toContain('https://www.google.com');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('convertUrlsToLinks', () => {
|
|
45
|
+
it('should return array with mixed content', () => {
|
|
46
|
+
const text = 'Visit https://example.com for more info';
|
|
47
|
+
const result = convertUrlsToLinks(text);
|
|
48
|
+
expect(Array.isArray(result)).toBe(true);
|
|
49
|
+
expect(result.length).toBeGreaterThan(0);
|
|
50
|
+
});
|
|
51
|
+
it('should handle text without URLs', () => {
|
|
52
|
+
const text = 'This is just plain text';
|
|
53
|
+
const result = convertUrlsToLinks(text);
|
|
54
|
+
expect(result).toEqual([text]);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { ModelSelector } from './components/ui/ModelSelector';
|
|
|
7
7
|
export { NotificationModal } from './components/ui/NotificationModal';
|
|
8
8
|
export { PermissionForm } from './components/ui/PermissionForm';
|
|
9
9
|
export { PresetMessages } from './components/ui/PresetMessages';
|
|
10
|
+
export { BerifyMeModal } from './components/ui/BerifyMeModal';
|
|
10
11
|
export type { AIModel, AITMetadata, ChatBotContextType, ChatBotProps, NovaError, NovaResponse, PresetMessage, ToolCall, ToolUse } from './components/types/ChatBotTypes';
|
|
11
12
|
export { AI_MODEL_MAP, ALL_AVAILABLE_MODELS, DEFAULT_AI_MODELS } from './components/types/ChatBotTypes';
|
|
12
13
|
export { connectWallet, disconnectWallet, validateToken } from './core/utils/walletUtils';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,YAAY,EAEV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,OAAO,EACR,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EACV,GAAG,EACH,MAAM,EACN,OAAO,EACP,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { ModelSelector } from './components/ui/ModelSelector';
|
|
|
10
10
|
export { NotificationModal } from './components/ui/NotificationModal';
|
|
11
11
|
export { PermissionForm } from './components/ui/PermissionForm';
|
|
12
12
|
export { PresetMessages } from './components/ui/PresetMessages';
|
|
13
|
+
export { BerifyMeModal } from './components/ui/BerifyMeModal';
|
|
13
14
|
// AI Model constants
|
|
14
15
|
export { AI_MODEL_MAP, ALL_AVAILABLE_MODELS, DEFAULT_AI_MODELS } from './components/types/ChatBotTypes';
|
|
15
16
|
// Utility functions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Test setup file for Jest
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
// Mock window.open for URL tests
|
|
4
|
+
Object.defineProperty(window, 'open', {
|
|
5
|
+
writable: true,
|
|
6
|
+
value: jest.fn(),
|
|
7
|
+
});
|
|
8
|
+
// Mock console methods to avoid noise in tests
|
|
9
|
+
global.console = {
|
|
10
|
+
...console,
|
|
11
|
+
log: jest.fn(),
|
|
12
|
+
debug: jest.fn(),
|
|
13
|
+
info: jest.fn(),
|
|
14
|
+
warn: jest.fn(),
|
|
15
|
+
error: jest.fn(),
|
|
16
|
+
};
|