@bytexbyte/nxtlinq-ai-agent-sdk 1.4.8 → 1.5.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.
@@ -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;AAEpD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAM1C,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,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
- return (_jsx(ChatBotProvider, { ...props, children: _jsx(ChatBotUI, {}) }));
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,CA2vDlD,CAAC"}
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,CAwtDlD,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({
@@ -856,10 +858,17 @@ useSessionStorage: useSessionStorageMode = false }) => {
856
858
  // Try to sign in wallet
857
859
  await signInWallet(false); // Don't show success message yet
858
860
  console.log('Auto sign-in successful, retrying message...');
859
- // Wait a bit for everything to settle
860
- await new Promise(resolve => setTimeout(resolve, 2000));
861
- // Retry the message
862
- sendMessage(content, retryCount + 1, isPresetMessage);
861
+ // // Wait a bit for everything to settle
862
+ // await new Promise(resolve => setTimeout(resolve, 2000));
863
+ // // Retry the message
864
+ // sendMessage(content, retryCount + 1, isPresetMessage);
865
+ setMessages(prev => [...prev, {
866
+ id: Date.now().toString(),
867
+ content: 'Click button to continue tool',
868
+ role: 'assistant',
869
+ timestamp: new Date().toISOString(),
870
+ button: 'continue'
871
+ }]);
863
872
  }
864
873
  catch (signInError) {
865
874
  console.log('Auto sign-in failed, showing error message');
@@ -919,12 +928,6 @@ useSessionStorage: useSessionStorageMode = false }) => {
919
928
  }
920
929
  }
921
930
  let botResponse;
922
- // Debug: Log the entire response structure
923
- console.log('=== RESPONSE DEBUG ===');
924
- console.log('Full response:', response);
925
- console.log('Response has toolCall:', !!response.toolCall);
926
- console.log('Response has redirectUrl:', 'redirectUrl' in response);
927
- console.log('RedirectUrl value:', response.redirectUrl);
928
931
  // Store redirectUrl for later use (don't redirect yet)
929
932
  const redirectUrl = response?.redirectUrl;
930
933
  if (response.toolCall?.toolUse) {
@@ -943,54 +946,18 @@ useSessionStorage: useSessionStorageMode = false }) => {
943
946
  permissionDenied = true;
944
947
  }
945
948
  if (!isToolAllowed) {
946
- // If permission denied due to missing AIT permission return
947
- if (permissionDenied) {
948
- setIsLoading(false);
949
+ setIsLoading(false);
950
+ if (permissionDenied)
949
951
  return;
950
- }
951
- // Only retry for auto-connect/auto-sign-in scenarios
952
- if (wasAutoConnected && retryCount < 1) {
953
- console.log('Auto-connected, retrying message...');
954
- // Clear loading state and retry immediately
955
- setIsLoading(false);
956
- // Check if wallet is already signed in
957
- const currentToken = nxtlinqAITServiceAccessTokenRef.current;
958
- if (!currentToken) {
959
- // If not signed in, directly retry the message without waiting for AIT
960
- console.log('Wallet connected but not signed in, retrying message directly');
961
- setTimeout(() => {
962
- sendMessage(content, retryCount + 1, isPresetMessage);
963
- }, 2000);
964
- }
965
- else {
966
- // If already signed in, wait for AIT to be fully loaded before retrying
967
- setTimeout(async () => {
968
- // Wait for AIT to be loaded if needed
969
- if (!aitRef.current && nxtlinqAITServiceAccessTokenRef.current) {
970
- await refreshAIT();
971
- }
972
- // Wait for AIT to be fully loaded with polling
973
- let attempts = 0;
974
- const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
975
- while (!aitRef.current && attempts < maxAttempts) {
976
- await new Promise(resolve => setTimeout(resolve, 2000));
977
- attempts++;
978
- }
979
- // Only retry if AIT is actually loaded
980
- if (aitRef.current) {
981
- console.log('AIT loaded successfully, retrying message');
982
- // Wait a bit more to ensure permissions are also loaded
983
- await new Promise(resolve => setTimeout(resolve, 3000));
984
- sendMessage(content, retryCount + 1, isPresetMessage);
985
- }
986
- else {
987
- console.log('AIT failed to load, not retrying');
988
- }
989
- }, 2000);
990
- }
991
- }
992
- else {
993
- console.log('Permission denied, not retrying. wasAutoConnected:', wasAutoConnected, 'retryCount:', retryCount);
952
+ if (wasAutoConnected) {
953
+ // 不自動重試,改成丟出一顆 Continue
954
+ setMessages(prev => [...prev, {
955
+ id: Date.now().toString(),
956
+ content: 'Click button to continue tool',
957
+ role: 'assistant',
958
+ timestamp: new Date().toISOString(),
959
+ button: 'continue'
960
+ }]);
994
961
  }
995
962
  return;
996
963
  }
@@ -1073,8 +1040,6 @@ useSessionStorage: useSessionStorageMode = false }) => {
1073
1040
  }
1074
1041
  // Execute redirect after all message processing is complete
1075
1042
  if (redirectUrl) {
1076
- console.log('=== REDIRECT DETECTED ===');
1077
- console.log('Redirecting to:', redirectUrl);
1078
1043
  // Use setTimeout to ensure the message is displayed before redirect
1079
1044
  setTimeout(() => {
1080
1045
  window.location.href = redirectUrl;
@@ -1247,7 +1212,7 @@ useSessionStorage: useSessionStorageMode = false }) => {
1247
1212
  metadataCid,
1248
1213
  };
1249
1214
  setAit(aitInfo);
1250
- setPermissions(permissions);
1215
+ setPermissions(newPermissions || permissions);
1251
1216
  };
1252
1217
  // Auto enable AIT permission
1253
1218
  const enableAIT = async (toolName) => {
@@ -1636,7 +1601,9 @@ useSessionStorage: useSessionStorageMode = false }) => {
1636
1601
  availableModels,
1637
1602
  defaultModelIndex,
1638
1603
  showModelSelector,
1639
- onModelChange
1604
+ onModelChange,
1605
+ useSessionStorage: useSessionStorageMode,
1606
+ requireWalletIDVVerification
1640
1607
  },
1641
1608
  nxtlinqApi
1642
1609
  };
@@ -54,6 +54,7 @@ export interface ChatBotProps {
54
54
  showModelSelector?: boolean;
55
55
  onModelChange?: (model: AIModel) => void;
56
56
  useSessionStorage?: boolean;
57
+ requireWalletIDVVerification?: boolean;
57
58
  }
58
59
  export interface ChatBotContextType {
59
60
  messages: Message[];
@@ -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;IAC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C;IACrC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,sBAAsB,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,aAAa,EAAE,MAAM,IAAI,CAAC;IAE1B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,MAAM,OAAO,CAAC;IAG/B,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC;IAC3D,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,EA4P7B,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, props: { className = '' } } = useChatBot();
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
- }, className: className, children: [_jsxs("div", { style: {
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" })] })] }), _jsx(MessageList, {}), _jsx(PresetMessages, {}), _jsx(MessageInput, {})] }), showPermissionForm && (_jsx("div", { style: {
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":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA+L/B,CAAC"}
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAyM/B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
+ import { convertUrlsToLinks } from '../../core/utils/urlUtils';
3
4
  import { useChatBot } from '../context/ChatBotContext';
4
5
  import { AI_MODEL_MAP } from '../types/ChatBotTypes';
5
- import { convertUrlsToLinks } from '../../core/utils/urlUtils';
6
6
  export const MessageList = () => {
7
7
  const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading, isAutoConnecting, isNeedSignInWithWallet, enableAIT, isAITLoading, isAITEnabling, sendMessage, permissions } = useChatBot();
8
8
  const messagesEndRef = React.useRef(null);
@@ -33,6 +33,13 @@ export const MessageList = () => {
33
33
  }
34
34
  }
35
35
  }
36
+ else if (buttonType === 'continue') {
37
+ const lastUserMsg = [...messages].reverse().find(m => m.role === 'user');
38
+ if (lastUserMsg && lastUserMsg.content) {
39
+ // Re-execute the previous user message
40
+ await sendMessage(lastUserMsg.content);
41
+ }
42
+ }
36
43
  };
37
44
  const getModelDisplayName = (modelValue) => {
38
45
  if (!modelValue)
@@ -74,30 +81,34 @@ export const MessageList = () => {
74
81
  isAutoConnecting ? '#6c757d' :
75
82
  (message.button === 'connectWallet' && Boolean(hitAddress)) ? '#28a745' :
76
83
  (message.button === 'signIn' && !isNeedSignInWithWallet) ? '#28a745' :
77
- (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
78
- (message.metadata?.toolName && permissions.includes(message.metadata.toolName)))) ?
79
- ((message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? '#28a745' : '#6c757d') : '#007bff',
84
+ (message.button === 'continue') ? '#28a745' :
85
+ (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
86
+ (message.metadata?.toolName && permissions.includes(message.metadata.toolName)))) ?
87
+ ((message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? '#28a745' : '#6c757d') : '#007bff',
80
88
  color: message.role === 'user' ? 'white' : 'white',
81
89
  border: 'none',
82
90
  borderRadius: '5px',
83
91
  cursor: (isAutoConnecting ||
84
92
  (message.button === 'connectWallet' && Boolean(hitAddress)) ||
85
93
  (message.button === 'signIn' && !isNeedSignInWithWallet) ||
94
+ (message.button === 'continue') ||
86
95
  (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
87
96
  (message.metadata?.toolName && permissions.includes(message.metadata.toolName))))) ? 'not-allowed' : 'pointer',
88
97
  fontSize: '14px',
89
98
  opacity: (isAutoConnecting ||
90
99
  (message.button === 'connectWallet' && Boolean(hitAddress)) ||
91
100
  (message.button === 'signIn' && !isNeedSignInWithWallet) ||
101
+ (message.button === 'continue') ||
92
102
  (message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
93
103
  (message.metadata?.toolName && permissions.includes(message.metadata.toolName))))) ? 0.8 : 1
94
104
  }, children: isAutoConnecting ? 'Connecting...' :
95
105
  message.button === 'connectWallet' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
96
106
  message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') :
97
- message.button === 'enableAIT' ?
98
- ((isAITLoading || isAITEnabling) ? 'Enabling...' :
99
- (message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? 'AIT Enabled' : 'Enable AIT Permissions') :
100
- message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
107
+ message.button === 'continue' ? 'Continue' :
108
+ message.button === 'enableAIT' ?
109
+ ((isAITLoading || isAITEnabling) ? 'Enabling...' :
110
+ (message.metadata?.toolName && permissions.includes(message.metadata.toolName)) ? 'AIT Enabled' : 'Enable AIT Permissions') :
111
+ message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
101
112
  display: 'flex',
102
113
  alignItems: 'center',
103
114
  marginTop: '4px',
@@ -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,CAgiBxD,CAAC"}
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"}