@bytexbyte/nxtlinq-ai-agent-sdk 1.2.6 → 1.2.8

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":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAOb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqpClD,CAAC"}
1
+ {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,kBAAkB,EAClB,YAAY,EAOb,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA42ClD,CAAC"}
@@ -14,7 +14,7 @@ export const useChatBot = () => {
14
14
  }
15
15
  return context;
16
16
  };
17
- export const ChatBotProvider = ({ onMessage, onError, onToolUse, presetMessages = [], placeholder = 'Type a message...', className = '', maxRetries = 3, retryDelay = 1000, serviceId, apiKey, apiSecret, onVerifyWallet, permissionGroup, children,
17
+ export const ChatBotProvider = ({ onMessage, onError, onToolUse, presetMessages = [], placeholder = 'Type a message...', className = '', maxRetries = 3, retryDelay = 2000, serviceId, apiKey, apiSecret, onVerifyWallet, permissionGroup, children,
18
18
  // AI Model related attributes
19
19
  availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector = true, onModelChange }) => {
20
20
  // State
@@ -41,6 +41,7 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
41
41
  const aitRef = React.useRef(ait);
42
42
  const permissionsRef = React.useRef(permissions);
43
43
  const nxtlinqAITServiceAccessTokenRef = React.useRef(nxtlinqAITServiceAccessToken);
44
+ const signerRef = React.useRef(signer);
44
45
  // Update refs when state changes
45
46
  React.useEffect(() => {
46
47
  hitAddressRef.current = hitAddress;
@@ -54,6 +55,9 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
54
55
  React.useEffect(() => {
55
56
  nxtlinqAITServiceAccessTokenRef.current = nxtlinqAITServiceAccessToken;
56
57
  }, [nxtlinqAITServiceAccessToken]);
58
+ React.useEffect(() => {
59
+ signerRef.current = signer;
60
+ }, [signer]);
57
61
  const [notification, setNotification] = React.useState({
58
62
  show: false,
59
63
  type: 'info',
@@ -84,6 +88,13 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
84
88
  const showError = (message) => showNotification('error', message, 5000);
85
89
  const showWarning = (message) => showNotification('warning', message, 4000);
86
90
  const showInfo = (message) => showNotification('info', message, 3000);
91
+ // Filter out wallet connection messages for API calls
92
+ const getFilteredMessagesForAPI = () => {
93
+ return messages.filter(msg => !msg.content.includes('Please connect your HIT wallet') &&
94
+ !msg.content.includes('Please sign in with your wallet') &&
95
+ !msg.content.includes('connect your wallet') &&
96
+ !msg.content.includes('Wallet verification completed successfully'));
97
+ };
87
98
  // Fetch available permissions
88
99
  const fetchAvailablePermissions = async () => {
89
100
  if (!serviceId)
@@ -113,18 +124,25 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
113
124
  }
114
125
  setIsAITLoading(true);
115
126
  try {
116
- // Get wallet info first
127
+ // Get wallet info first - always try to get wallet info if we have a token
117
128
  if (nxtlinqAITServiceAccessToken) {
118
129
  try {
119
130
  const walletResponse = await nxtlinqApi.wallet.getWallet({ address: hitAddress }, nxtlinqAITServiceAccessToken);
120
131
  if (!('error' in walletResponse)) {
121
132
  setWalletInfo(walletResponse);
133
+ console.log('Wallet info updated:', walletResponse);
134
+ }
135
+ else {
136
+ console.log('Failed to get wallet info:', walletResponse.error);
122
137
  }
123
138
  }
124
139
  catch (error) {
125
140
  console.error('Failed to fetch wallet info:', error);
126
141
  }
127
142
  }
143
+ else {
144
+ console.log('No access token available for wallet info fetch');
145
+ }
128
146
  const response = await nxtlinqApi.ait.getAITByServiceIdAndController({
129
147
  serviceId,
130
148
  controller: hitAddress
@@ -215,42 +233,60 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
215
233
  localStorage.removeItem('walletAddress');
216
234
  setHitAddress(null);
217
235
  setSigner(null);
218
- throw error;
236
+ if (autoShowSignInMessage) {
237
+ throw error;
238
+ }
219
239
  }
220
240
  }, [nxtlinqAITServiceAccessToken, refreshAIT, isNeedSignInWithWallet]);
221
241
  // Sign in wallet
222
242
  const signInWallet = async (autoShowSuccessMessage = true) => {
223
- if (!hitAddress) {
224
- showError('Please connect your wallet first.');
243
+ // Use refs to get latest state values for consistency with hasPermission
244
+ const currentHitAddress = hitAddressRef.current;
245
+ const currentSigner = signerRef.current;
246
+ console.log('signInWallet called: currentHitAddress =', currentHitAddress, 'currentSigner =', !!currentSigner);
247
+ if (!currentHitAddress) {
248
+ console.log('No currentHitAddress, returning early');
249
+ if (autoShowSuccessMessage) {
250
+ showError('Please connect your wallet first.');
251
+ }
225
252
  return;
226
253
  }
227
- if (!signer) {
228
- showError('Please connect your wallet first.');
254
+ if (!currentSigner) {
255
+ console.log('No currentSigner, returning early');
256
+ if (autoShowSuccessMessage) {
257
+ showError('Please connect your wallet first.');
258
+ }
229
259
  return;
230
260
  }
231
261
  try {
232
- const nonceResponse = await nxtlinqApi.auth.getNonce({ address: hitAddress });
262
+ const nonceResponse = await nxtlinqApi.auth.getNonce({ address: currentHitAddress });
233
263
  if ('error' in nonceResponse) {
234
- showError(nonceResponse.error);
264
+ if (autoShowSuccessMessage) {
265
+ showError(nonceResponse.error);
266
+ }
235
267
  return;
236
268
  }
237
269
  const payload = {
238
- address: hitAddress,
270
+ address: currentHitAddress,
239
271
  code: nonceResponse.code,
240
272
  timestamp: nonceResponse.timestamp
241
273
  };
242
274
  const stringToSign = stringify(payload);
243
- const signature = await signer.signMessage(stringToSign || '');
275
+ const signature = await currentSigner.signMessage(stringToSign || '');
244
276
  const response = await nxtlinqApi.auth.signIn({
245
277
  ...payload,
246
278
  signature
247
279
  });
248
280
  if ('error' in response) {
249
- showError(response.error);
281
+ if (autoShowSuccessMessage) {
282
+ showError(response.error);
283
+ }
250
284
  return;
251
285
  }
252
286
  const { accessToken } = response;
253
287
  setNxtlinqAITServiceAccessToken(accessToken);
288
+ // Wait for state to update before refreshing AIT
289
+ await new Promise(resolve => setTimeout(resolve, 100));
254
290
  // Wait for AIT to be loaded before showing success message
255
291
  await refreshAIT();
256
292
  if (autoShowSuccessMessage) {
@@ -259,7 +295,9 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
259
295
  }
260
296
  catch (error) {
261
297
  console.error('Failed to sign in:', error);
262
- showError('Failed to sign in. Please try again.');
298
+ if (autoShowSuccessMessage) {
299
+ showError('Failed to sign in. Please try again.');
300
+ }
263
301
  }
264
302
  };
265
303
  // Check permissions
@@ -285,8 +323,16 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
285
323
  setIsAutoConnecting(false); // Clear auto-connecting state
286
324
  setJustAutoConnected(true); // Mark that we just auto-connected
287
325
  console.log('Set justAutoConnected to true after auto-connect');
326
+ // Show brief success message for auto-connect
327
+ showSuccess('Auto wallet connection successful');
328
+ // Clear the flag after a longer delay to allow for AIT loading
329
+ setTimeout(() => {
330
+ setJustAutoConnected(false);
331
+ }, 15000); // 15 seconds to allow for full AIT loading process
288
332
  onAutoConnect?.(); // Call callback if provided
289
333
  // If connection successful, continue with permission check
334
+ // Wait a bit for state to update
335
+ await new Promise(resolve => setTimeout(resolve, 2000));
290
336
  const result = await hasPermission(toolName, false);
291
337
  return result;
292
338
  }
@@ -301,6 +347,7 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
301
347
  }
302
348
  if (!currentToken) {
303
349
  if (autoRetry) {
350
+ console.log('Auto sign-in triggered: currentHitAddress =', currentHitAddress, 'currentToken =', currentToken);
304
351
  setIsLoading(false); // Stop thinking before showing message
305
352
  setMessages(prev => [...prev, {
306
353
  id: Date.now().toString(),
@@ -311,11 +358,34 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
311
358
  }]);
312
359
  try {
313
360
  setIsAutoConnecting(true); // Mark as auto-signing
361
+ console.log('Starting auto sign-in...');
314
362
  await signInWallet(false); // Don't show success message yet
363
+ console.log('Auto sign-in completed');
315
364
  setIsAutoConnecting(false); // Clear auto-signing state
316
- // If sign-in successful, continue with permission check
317
- const result = await hasPermission(toolName, false);
318
- return result;
365
+ // Show brief success message for auto-sign-in
366
+ showSuccess('Auto sign-in successful');
367
+ // Ensure AIT is refreshed after sign-in
368
+ await refreshAIT();
369
+ // Wait for AIT to be fully loaded with polling
370
+ let attempts = 0;
371
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
372
+ while (!aitRef.current && attempts < maxAttempts) {
373
+ await new Promise(resolve => setTimeout(resolve, 2000));
374
+ attempts++;
375
+ }
376
+ // Only continue if AIT is actually loaded
377
+ if (aitRef.current) {
378
+ console.log('AIT loaded successfully after sign-in, continuing permission check');
379
+ // Wait a bit more to ensure permissions are also loaded
380
+ await new Promise(resolve => setTimeout(resolve, 2000));
381
+ // If sign-in successful, continue with permission check
382
+ const result = await hasPermission(toolName, false);
383
+ return result;
384
+ }
385
+ else {
386
+ console.log('AIT failed to load after sign-in, returning false');
387
+ return false;
388
+ }
319
389
  }
320
390
  catch (error) {
321
391
  console.error('Failed to auto-sign-in wallet:', error);
@@ -345,9 +415,30 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
345
415
  setIsAutoConnecting(true); // Mark as auto-signing
346
416
  await signInWallet(false); // Don't show success message yet
347
417
  setIsAutoConnecting(false); // Clear auto-signing state
348
- // If sign-in successful, continue with permission check
349
- const result = await hasPermission(toolName, false);
350
- return result;
418
+ // Show brief success message for auto-sign-in after session expiry
419
+ showSuccess('Auto sign-in successful after session expiry');
420
+ // Ensure AIT is refreshed after sign-in
421
+ await refreshAIT();
422
+ // Wait for AIT to be fully loaded with polling
423
+ let attempts = 0;
424
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
425
+ while (!aitRef.current && attempts < maxAttempts) {
426
+ await new Promise(resolve => setTimeout(resolve, 2000));
427
+ attempts++;
428
+ }
429
+ // Only continue if AIT is actually loaded
430
+ if (aitRef.current) {
431
+ console.log('AIT loaded successfully after session expiry, continuing permission check');
432
+ // Wait a bit more to ensure permissions are also loaded
433
+ await new Promise(resolve => setTimeout(resolve, 2000));
434
+ // If sign-in successful, continue with permission check
435
+ const result = await hasPermission(toolName, false);
436
+ return result;
437
+ }
438
+ else {
439
+ console.log('AIT failed to load after session expiry, returning false');
440
+ return false;
441
+ }
351
442
  }
352
443
  catch (error) {
353
444
  console.error('Failed to auto-sign-in after session expiry:', error);
@@ -374,9 +465,30 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
374
465
  setIsAutoConnecting(true); // Mark as auto-signing
375
466
  await signInWallet(false); // Don't show success message yet
376
467
  setIsAutoConnecting(false); // Clear auto-signing state
377
- // If sign-in successful, continue with permission check
378
- const result = await hasPermission(toolName, false);
379
- return result;
468
+ // Show brief success message for auto-sign-in after address mismatch
469
+ showSuccess('Auto sign-in successful after address mismatch');
470
+ // Ensure AIT is refreshed after sign-in
471
+ await refreshAIT();
472
+ // Wait for AIT to be fully loaded with polling
473
+ let attempts = 0;
474
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
475
+ while (!aitRef.current && attempts < maxAttempts) {
476
+ await new Promise(resolve => setTimeout(resolve, 2000));
477
+ attempts++;
478
+ }
479
+ // Only continue if AIT is actually loaded
480
+ if (aitRef.current) {
481
+ console.log('AIT loaded successfully after address mismatch, continuing permission check');
482
+ // Wait a bit more to ensure permissions are also loaded
483
+ await new Promise(resolve => setTimeout(resolve, 2000));
484
+ // If sign-in successful, continue with permission check
485
+ const result = await hasPermission(toolName, false);
486
+ return result;
487
+ }
488
+ else {
489
+ console.log('AIT failed to load after address mismatch, returning false');
490
+ return false;
491
+ }
380
492
  }
381
493
  catch (error) {
382
494
  console.error('Failed to auto-sign-in after address mismatch:', error);
@@ -404,9 +516,30 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
404
516
  setIsAutoConnecting(true); // Mark as auto-signing
405
517
  await signInWallet(false); // Don't show success message yet
406
518
  setIsAutoConnecting(false); // Clear auto-signing state
407
- // If sign-in successful, continue with permission check
408
- const result = await hasPermission(toolName, false);
409
- return result;
519
+ // Show brief success message for auto-sign-in after token parse error
520
+ showSuccess('Auto sign-in successful after token error');
521
+ // Ensure AIT is refreshed after sign-in
522
+ await refreshAIT();
523
+ // Wait for AIT to be fully loaded with polling
524
+ let attempts = 0;
525
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
526
+ while (!aitRef.current && attempts < maxAttempts) {
527
+ await new Promise(resolve => setTimeout(resolve, 2000));
528
+ attempts++;
529
+ }
530
+ // Only continue if AIT is actually loaded
531
+ if (aitRef.current) {
532
+ console.log('AIT loaded successfully after token error, continuing permission check');
533
+ // Wait a bit more to ensure permissions are also loaded
534
+ await new Promise(resolve => setTimeout(resolve, 2000));
535
+ // If sign-in successful, continue with permission check
536
+ const result = await hasPermission(toolName, false);
537
+ return result;
538
+ }
539
+ else {
540
+ console.log('AIT failed to load after token error, returning false');
541
+ return false;
542
+ }
410
543
  }
411
544
  catch (signInError) {
412
545
  console.error('Failed to auto-sign-in after token parse error:', signInError);
@@ -435,9 +568,9 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
435
568
  await refreshAIT();
436
569
  // Wait for AIT to be loaded with polling
437
570
  let attempts = 0;
438
- const maxAttempts = 10; // Wait up to 5 seconds
571
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
439
572
  while (!aitRef.current && attempts < maxAttempts) {
440
- await new Promise(resolve => setTimeout(resolve, 500));
573
+ await new Promise(resolve => setTimeout(resolve, 2000));
441
574
  attempts++;
442
575
  }
443
576
  // Check again after refresh
@@ -497,6 +630,29 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
497
630
  return false;
498
631
  }
499
632
  if (!currentPermissions.includes(toolName)) {
633
+ // Check if AIT is still loading or if we just auto-connected
634
+ if (isAITLoading || isAutoConnecting) {
635
+ setIsLoading(false); // Stop thinking before showing message
636
+ setMessages(prev => [...prev, {
637
+ id: Date.now().toString(),
638
+ content: 'Loading your wallet configuration... Please wait a moment.',
639
+ role: 'assistant',
640
+ timestamp: new Date().toISOString()
641
+ }]);
642
+ return false;
643
+ }
644
+ // If AIT is loaded but permissions are empty, it means no AIT was found
645
+ if (currentAit && currentPermissions.length === 0) {
646
+ setIsLoading(false); // Stop thinking before showing message
647
+ setMessages(prev => [...prev, {
648
+ id: Date.now().toString(),
649
+ content: 'No AIT found for your wallet. Please click the settings button (⚙️) to configure your AIT permissions.',
650
+ role: 'assistant',
651
+ timestamp: new Date().toISOString()
652
+ }]);
653
+ return false;
654
+ }
655
+ // Only show permission error if AIT is loaded and permissions are not empty
500
656
  setIsLoading(false); // Stop thinking before showing message
501
657
  setMessages(prev => [...prev, {
502
658
  id: Date.now().toString(),
@@ -548,8 +704,9 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
548
704
  }
549
705
  setIsLoading(true);
550
706
  try {
551
- // Build context messages
552
- const contextMessages = messages.map(msg => ({
707
+ // Build context messages (filter out wallet connection messages)
708
+ const filteredMessages = getFilteredMessagesForAPI();
709
+ const contextMessages = filteredMessages.map(msg => ({
553
710
  role: msg.role,
554
711
  text: msg.content
555
712
  }));
@@ -576,9 +733,43 @@ availableModels = DEFAULT_AI_MODELS, defaultModelIndex = 0, showModelSelector =
576
733
  // If we just auto-connected, retry the message once
577
734
  if (wasAutoConnected && retryCount < 1) {
578
735
  console.log('Auto-connected, retrying message...');
579
- setTimeout(() => {
580
- sendMessage(content, retryCount + 1, isPresetMessage);
581
- }, 2000);
736
+ // Clear loading state and retry immediately
737
+ setIsLoading(false);
738
+ // Check if wallet is already signed in
739
+ const currentToken = nxtlinqAITServiceAccessTokenRef.current;
740
+ if (!currentToken) {
741
+ // If not signed in, directly retry the message without waiting for AIT
742
+ console.log('Wallet connected but not signed in, retrying message directly');
743
+ setTimeout(() => {
744
+ sendMessage(content, retryCount + 1, isPresetMessage);
745
+ }, 2000);
746
+ }
747
+ else {
748
+ // If already signed in, wait for AIT to be fully loaded before retrying
749
+ setTimeout(async () => {
750
+ // Wait for AIT to be loaded if needed
751
+ if (!aitRef.current && nxtlinqAITServiceAccessTokenRef.current) {
752
+ await refreshAIT();
753
+ }
754
+ // Wait for AIT to be fully loaded with polling
755
+ let attempts = 0;
756
+ const maxAttempts = 5; // Wait up to 10 seconds (5 * 2000ms)
757
+ while (!aitRef.current && attempts < maxAttempts) {
758
+ await new Promise(resolve => setTimeout(resolve, 2000));
759
+ attempts++;
760
+ }
761
+ // Only retry if AIT is actually loaded
762
+ if (aitRef.current) {
763
+ console.log('AIT loaded successfully, retrying message');
764
+ // Wait a bit more to ensure permissions are also loaded
765
+ await new Promise(resolve => setTimeout(resolve, 2000));
766
+ sendMessage(content, retryCount + 1, isPresetMessage);
767
+ }
768
+ else {
769
+ console.log('AIT failed to load, not retrying');
770
+ }
771
+ }, 2000);
772
+ }
582
773
  }
583
774
  else {
584
775
  console.log('Permission denied, not retrying. wasAutoConnected:', wasAutoConnected, 'retryCount:', retryCount);
@@ -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,CAifxD,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,CAkgBxD,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 } = useChatBot();
5
+ const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false, refreshAIT } = useChatBot();
6
6
  const [availablePermissions, setAvailablePermissions] = React.useState([]);
7
7
  const [isSaving, setIsSaving] = React.useState(false);
8
8
  const [tempPermissions, setTempPermissions] = React.useState(permissions);
@@ -31,6 +31,22 @@ export const PermissionForm = ({ onClose, onOpen }) => {
31
31
  React.useEffect(() => {
32
32
  fetchAvailablePermissions();
33
33
  }, [serviceId, nxtlinqApi, permissionGroup]);
34
+ // Refresh wallet info when component mounts or when hitAddress changes
35
+ React.useEffect(() => {
36
+ if (hitAddress) {
37
+ // Trigger a refresh of AIT and wallet info when the form opens
38
+ const refreshWalletInfo = async () => {
39
+ try {
40
+ // This will trigger refreshAIT which includes wallet info fetch
41
+ await refreshAIT();
42
+ }
43
+ catch (error) {
44
+ console.error('Failed to refresh wallet info:', error);
45
+ }
46
+ };
47
+ refreshWalletInfo();
48
+ }
49
+ }, [hitAddress]);
34
50
  const isWalletVerified = Boolean(walletInfo?.id);
35
51
  const handleSave = async () => {
36
52
  setIsSaving(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Nxtlinq AI Agent SDK - Proprietary Software with enhanced async operation handling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",