@bytexbyte/nxtlinq-ai-agent-sdk 1.6.7 → 1.6.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.
- package/dist/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +24 -16
- package/dist/components/ui/MessageInput.d.ts.map +1 -1
- package/dist/components/ui/MessageInput.js +3 -3
- package/dist/components/ui/MessageList.js +6 -6
- 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/core/utils/berifyMeReactFix.d.ts +8 -0
- package/dist/core/utils/berifyMeReactFix.d.ts.map +1 -0
- package/dist/core/utils/berifyMeReactFix.js +81 -0
- package/dist/core/utils/reactInstanceCheck.d.ts +9 -0
- package/dist/core/utils/reactInstanceCheck.d.ts.map +1 -0
- package/dist/core/utils/reactInstanceCheck.js +46 -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 +132 -132
|
@@ -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,CA+6DlD,CAAC"}
|
|
@@ -448,7 +448,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
450
|
// Check permissions
|
|
451
|
-
const hasPermission = async (
|
|
451
|
+
const hasPermission = async (requiredPermission, autoRetry = true, onAutoConnect, onAutoSignIn) => {
|
|
452
452
|
// Use refs to get latest state values
|
|
453
453
|
const currentHitAddress = hitAddressRef.current;
|
|
454
454
|
const currentAit = aitRef.current;
|
|
@@ -490,7 +490,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
// If connection (and sign-in if needed) successful, continue with permission check
|
|
493
|
-
const result = await hasPermission(
|
|
493
|
+
const result = await hasPermission(requiredPermission, false);
|
|
494
494
|
return result;
|
|
495
495
|
}
|
|
496
496
|
catch (error) {
|
|
@@ -533,7 +533,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
533
533
|
// Wait a bit more to ensure permissions are also loaded
|
|
534
534
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
535
535
|
// If sign-in successful, continue with permission check
|
|
536
|
-
const result = await hasPermission(
|
|
536
|
+
const result = await hasPermission(requiredPermission, false);
|
|
537
537
|
return result;
|
|
538
538
|
}
|
|
539
539
|
else {
|
|
@@ -585,7 +585,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
585
585
|
// Wait a bit more to ensure permissions are also loaded
|
|
586
586
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
587
587
|
// If sign-in successful, continue with permission check
|
|
588
|
-
const result = await hasPermission(
|
|
588
|
+
const result = await hasPermission(requiredPermission, false);
|
|
589
589
|
return result;
|
|
590
590
|
}
|
|
591
591
|
else {
|
|
@@ -634,7 +634,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
634
634
|
// Wait a bit more to ensure permissions are also loaded
|
|
635
635
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
636
636
|
// If sign-in successful, continue with permission check
|
|
637
|
-
const result = await hasPermission(
|
|
637
|
+
const result = await hasPermission(requiredPermission, false);
|
|
638
638
|
return result;
|
|
639
639
|
}
|
|
640
640
|
else {
|
|
@@ -684,7 +684,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
684
684
|
// Wait a bit more to ensure permissions are also loaded
|
|
685
685
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
686
686
|
// If sign-in successful, continue with permission check
|
|
687
|
-
const result = await hasPermission(
|
|
687
|
+
const result = await hasPermission(requiredPermission, false);
|
|
688
688
|
return result;
|
|
689
689
|
}
|
|
690
690
|
else {
|
|
@@ -769,17 +769,17 @@ isStopRecordingOnSend = false, }) => {
|
|
|
769
769
|
}]);
|
|
770
770
|
return false;
|
|
771
771
|
}
|
|
772
|
-
if (!availablePermissionLabels.includes(
|
|
772
|
+
if (!availablePermissionLabels.includes(requiredPermission)) {
|
|
773
773
|
setIsLoading(false); // Stop thinking before showing message
|
|
774
774
|
setMessages(prev => [...prev, {
|
|
775
775
|
id: Date.now().toString(),
|
|
776
|
-
content: `This
|
|
776
|
+
content: `This permission (${requiredPermission}) is not available for your current identity provider.`,
|
|
777
777
|
role: 'assistant',
|
|
778
778
|
timestamp: new Date().toISOString()
|
|
779
779
|
}]);
|
|
780
780
|
return false;
|
|
781
781
|
}
|
|
782
|
-
if (!currentPermissions.includes(
|
|
782
|
+
if (!currentPermissions.includes(requiredPermission)) {
|
|
783
783
|
// Check if AIT is still loading or if we just auto-connected
|
|
784
784
|
if (isAITLoading || isAutoConnecting) {
|
|
785
785
|
setIsLoading(false); // Stop thinking before showing message
|
|
@@ -804,7 +804,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
804
804
|
}
|
|
805
805
|
// Only show permission error if AIT is loaded and permissions are not empty
|
|
806
806
|
setIsLoading(false); // Stop thinking before showing message
|
|
807
|
-
const permissionMsg = `You don't have the required AIT permission: ${
|
|
807
|
+
const permissionMsg = `You don't have the required AIT permission: ${requiredPermission}. Would you like to enable AIT permission?`;
|
|
808
808
|
setMessages(prev => [
|
|
809
809
|
...prev,
|
|
810
810
|
{
|
|
@@ -813,7 +813,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
813
813
|
role: 'assistant',
|
|
814
814
|
timestamp: new Date().toISOString(),
|
|
815
815
|
button: 'enableAIT',
|
|
816
|
-
metadata: {
|
|
816
|
+
metadata: { requiredPermission }
|
|
817
817
|
}
|
|
818
818
|
]);
|
|
819
819
|
return false;
|
|
@@ -989,9 +989,11 @@ isStopRecordingOnSend = false, }) => {
|
|
|
989
989
|
let wasAutoSignedIn = false;
|
|
990
990
|
// Added: Mark if permission denied due to missing AIT permission
|
|
991
991
|
let permissionDenied = false;
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
992
|
+
// Use requiredPermission from response if available, otherwise fall back to toolUse.name
|
|
993
|
+
const permissionToCheck = response?.requiredPermission || toolUse.name;
|
|
994
|
+
const isToolAllowed = await hasPermission(permissionToCheck, true, () => { wasAutoConnected = true; }, () => { wasAutoSignedIn = true; });
|
|
995
|
+
// If currentPermissions does not include permissionToCheck and availablePermissionLabels includes permissionToCheck, it means AIT permission is missing
|
|
996
|
+
if (!isToolAllowed && !permissions.includes(permissionToCheck) && availablePermissions.map(p => p.label).includes(permissionToCheck)) {
|
|
995
997
|
permissionDenied = true;
|
|
996
998
|
}
|
|
997
999
|
if (!isToolAllowed) {
|
|
@@ -1417,10 +1419,12 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1417
1419
|
if (!newPermissions.includes(toolName)) {
|
|
1418
1420
|
newPermissions.push(toolName);
|
|
1419
1421
|
}
|
|
1422
|
+
// Filter out deleted permissions before saving
|
|
1423
|
+
const validPermissions = newPermissions.filter(permission => availablePermissionLabels.includes(permission));
|
|
1420
1424
|
// Generate and register AIT with new permissions
|
|
1421
1425
|
// For auto-enable, we should create a regular AIT (not AI Agent AIT) if user doesn't have existing AIT
|
|
1422
1426
|
const shouldCreateAsAIAgent = !!aitRef.current; // Only create as AI Agent if user already has an AIT
|
|
1423
|
-
await generateAndRegisterAITWithSigner(
|
|
1427
|
+
await generateAndRegisterAITWithSigner(validPermissions, shouldCreateAsAIAgent, currentSigner, currentHitAddress);
|
|
1424
1428
|
showSuccess('AIT permission enabled successfully! You can now use the AI agent.');
|
|
1425
1429
|
await refreshAIT(true);
|
|
1426
1430
|
setIsAITEnabling(false);
|
|
@@ -1442,7 +1446,11 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1442
1446
|
const savePermissions = async (newPermissions) => {
|
|
1443
1447
|
setIsDisabled(true);
|
|
1444
1448
|
try {
|
|
1445
|
-
|
|
1449
|
+
// Filter out deleted permissions before saving
|
|
1450
|
+
const permissionsToSave = newPermissions || permissions;
|
|
1451
|
+
const availablePermissionLabels = availablePermissions.map(p => p.label);
|
|
1452
|
+
const validPermissions = permissionsToSave.filter(permission => availablePermissionLabels.includes(permission));
|
|
1453
|
+
await generateAndRegisterAIT(validPermissions, false);
|
|
1446
1454
|
showSuccess('AIT permissions saved successfully! You can now use the AI agent with your configured permissions.');
|
|
1447
1455
|
setShowPermissionForm(false);
|
|
1448
1456
|
setIsPermissionFormOpen(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAqGhC,CAAC"}
|
|
@@ -22,16 +22,16 @@ export const MessageInput = () => {
|
|
|
22
22
|
align-items: center !important;
|
|
23
23
|
gap: 10px !important;
|
|
24
24
|
border-top: 1px solid #eee !important;
|
|
25
|
-
`, children: [_jsx(InputBase, { value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyPress: handleKeyPress, placeholder: inputPlaceholder,
|
|
25
|
+
`, children: [_jsx(InputBase, { value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyPress: handleKeyPress, placeholder: inputPlaceholder, fullWidth: true, inputProps: {
|
|
26
26
|
ref: textInputRef
|
|
27
|
-
}, endAdornment: _jsx(IconButton, { onClick: () => isRecording ? stopRecording() : startRecording(),
|
|
27
|
+
}, endAdornment: _jsx(IconButton, { onClick: () => isRecording ? stopRecording() : startRecording(), children: isRecording ? _jsx(MicIcon, {}) : _jsx(MicOffIcon, {}) }), onFocus: () => stopRecording(), css: css `
|
|
28
28
|
flex: 1 !important;
|
|
29
29
|
padding: 10px !important;
|
|
30
30
|
border: 1px solid #ddd !important;
|
|
31
31
|
border-radius: 20px !important;
|
|
32
32
|
outline: none !important;
|
|
33
33
|
font-size: 14px !important;
|
|
34
|
-
background-color:
|
|
34
|
+
background-color: #fff !important;
|
|
35
35
|
height: 40px !important;
|
|
36
36
|
box-sizing: border-box !important;
|
|
37
37
|
` }), _jsxs("button", { onClick: (e) => handleSubmit(e), disabled: isDisabled || !inputValue.trim(), css: css `
|
|
@@ -23,9 +23,9 @@ export const MessageList = () => {
|
|
|
23
23
|
signInWallet(true);
|
|
24
24
|
}
|
|
25
25
|
else if (buttonType === 'enableAIT') {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const success = await enableAIT(
|
|
26
|
+
const requiredPermission = message.metadata?.requiredPermission;
|
|
27
|
+
if (requiredPermission) {
|
|
28
|
+
const success = await enableAIT(requiredPermission);
|
|
29
29
|
if (success) {
|
|
30
30
|
// Find the last user message
|
|
31
31
|
const lastUserMsg = [...messages].reverse().find(m => m.role === 'user');
|
|
@@ -61,16 +61,16 @@ export const MessageList = () => {
|
|
|
61
61
|
(message.button === 'connectWallet' && Boolean(hitAddress)) ||
|
|
62
62
|
(message.button === 'signIn' && !isNeedSignInWithWallet) ||
|
|
63
63
|
(message.button === 'enableAIT' && (isAITLoading || isAITEnabling ||
|
|
64
|
-
(message.metadata?.
|
|
64
|
+
(message.metadata?.requiredPermission && permissions.includes(message.metadata.requiredPermission)))) || false, css: (message.button === 'connectWallet' && Boolean(hitAddress)) ? connectedButton :
|
|
65
65
|
(message.button === 'signIn' && !isNeedSignInWithWallet) ? connectedButton :
|
|
66
66
|
(message.button === 'continue') ? connectedButton :
|
|
67
|
-
(message.button === 'enableAIT' && (message.metadata?.
|
|
67
|
+
(message.button === 'enableAIT' && (message.metadata?.requiredPermission && permissions.includes(message.metadata.requiredPermission))) ? connectedButton :
|
|
68
68
|
chatbotButton, children: isAutoConnecting ? 'Connecting...' :
|
|
69
69
|
message.button === 'connectWallet' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
|
|
70
70
|
message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') :
|
|
71
71
|
message.button === 'continue' ? 'Continue' :
|
|
72
72
|
message.button === 'enableAIT' ?
|
|
73
73
|
((isAITLoading || isAITEnabling) ? 'Enabling...' :
|
|
74
|
-
(message.metadata?.
|
|
74
|
+
(message.metadata?.requiredPermission && permissions.includes(message.metadata.requiredPermission)) ? 'AIT Enabled' : 'Enable AIT Permissions') :
|
|
75
75
|
message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { css: modelIndicator, children: _jsxs("div", { css: modelBadge, children: [_jsx("span", { css: modelDot }), getModelDisplayName(message.metadata.model)] }) }))] }, message.id))), isLoading && (_jsx("div", { css: loadingIndicator, children: "Thinking..." })), _jsx("div", { ref: messagesEndRef })] }));
|
|
76
76
|
};
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BerifyMe React Instance Fix
|
|
3
|
+
*
|
|
4
|
+
* This utility ensures that BerifyMe SDK uses the same React instance
|
|
5
|
+
* as our SDK, preventing the __SECRET_INTERNALS error.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fixBerifyMeReactInstance(): void;
|
|
8
|
+
//# sourceMappingURL=berifyMeReactFix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"berifyMeReactFix.d.ts","sourceRoot":"","sources":["../../../src/core/utils/berifyMeReactFix.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,wBAAwB,IAAI,IAAI,CA4E/C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BerifyMe React Instance Fix
|
|
3
|
+
*
|
|
4
|
+
* This utility ensures that BerifyMe SDK uses the same React instance
|
|
5
|
+
* as our SDK, preventing the __SECRET_INTERNALS error.
|
|
6
|
+
*/
|
|
7
|
+
export function fixBerifyMeReactInstance() {
|
|
8
|
+
try {
|
|
9
|
+
// Wait for BerifyMe SDK to load
|
|
10
|
+
const checkBerifyMe = () => {
|
|
11
|
+
if (window.BerifyMeSDK) {
|
|
12
|
+
console.log('[BerifyMe React Fix] BerifyMe SDK detected, applying React instance fix...');
|
|
13
|
+
// Method 1: Try to set React instance if the method exists
|
|
14
|
+
if (window.BerifyMeSDK.setReactInstance) {
|
|
15
|
+
try {
|
|
16
|
+
const React = require('react');
|
|
17
|
+
const createRoot = require('react-dom/client').createRoot;
|
|
18
|
+
window.BerifyMeSDK.setReactInstance(React, createRoot);
|
|
19
|
+
console.log('[BerifyMe React Fix] ✅ React instance set successfully');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
console.warn('[BerifyMe React Fix] Failed to set React instance via setReactInstance:', e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Method 2: Monkey patch React globals
|
|
27
|
+
try {
|
|
28
|
+
const React = require('react');
|
|
29
|
+
const ReactDOM = require('react-dom');
|
|
30
|
+
const createRoot = require('react-dom/client').createRoot;
|
|
31
|
+
// Store original globals
|
|
32
|
+
const originalReact = window.React;
|
|
33
|
+
const originalReactDOM = window.ReactDOM;
|
|
34
|
+
// Set our React instance as global
|
|
35
|
+
window.React = React;
|
|
36
|
+
window.ReactDOM = ReactDOM;
|
|
37
|
+
window.ReactDOMClient = { createRoot };
|
|
38
|
+
console.log('[BerifyMe React Fix] ✅ React globals patched successfully');
|
|
39
|
+
// Restore original globals after a delay
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
if (originalReact)
|
|
42
|
+
window.React = originalReact;
|
|
43
|
+
if (originalReactDOM)
|
|
44
|
+
window.ReactDOM = originalReactDOM;
|
|
45
|
+
console.log('[BerifyMe React Fix] Original React globals restored');
|
|
46
|
+
}, 1000);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.warn('[BerifyMe React Fix] Failed to patch React globals:', e);
|
|
50
|
+
}
|
|
51
|
+
// Method 3: Try to patch the BerifyMe modal component
|
|
52
|
+
try {
|
|
53
|
+
if (window.BerifyMeSDK.modal) {
|
|
54
|
+
const originalModal = window.BerifyMeSDK.modal;
|
|
55
|
+
const React = require('react');
|
|
56
|
+
// Create a wrapper that uses our React instance
|
|
57
|
+
window.BerifyMeSDK.modal = (props) => {
|
|
58
|
+
return React.createElement(originalModal, props);
|
|
59
|
+
};
|
|
60
|
+
console.log('[BerifyMe React Fix] ✅ BerifyMe modal component patched');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
console.warn('[BerifyMe React Fix] Failed to patch BerifyMe modal:', e);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Retry after a short delay
|
|
69
|
+
setTimeout(checkBerifyMe, 100);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
checkBerifyMe();
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('[BerifyMe React Fix] Error applying React instance fix:', error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Auto-apply the fix when this module is loaded
|
|
79
|
+
if (typeof window !== 'undefined') {
|
|
80
|
+
fixBerifyMeReactInstance();
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Instance Check Utility
|
|
3
|
+
*
|
|
4
|
+
* This utility helps prevent React version conflicts by ensuring
|
|
5
|
+
* the SDK uses the same React instance as the host application.
|
|
6
|
+
*/
|
|
7
|
+
export declare function checkReactInstance(): void;
|
|
8
|
+
export declare function ensureReactCompatibility(): void;
|
|
9
|
+
//# sourceMappingURL=reactInstanceCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactInstanceCheck.d.ts","sourceRoot":"","sources":["../../../src/core/utils/reactInstanceCheck.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,kBAAkB,IAAI,IAAI,CAoCzC;AAED,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Instance Check Utility
|
|
3
|
+
*
|
|
4
|
+
* This utility helps prevent React version conflicts by ensuring
|
|
5
|
+
* the SDK uses the same React instance as the host application.
|
|
6
|
+
*/
|
|
7
|
+
let reactInstanceCheckPerformed = false;
|
|
8
|
+
export function checkReactInstance() {
|
|
9
|
+
if (reactInstanceCheckPerformed) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
// Check if React is available globally
|
|
14
|
+
const globalReact = window.React;
|
|
15
|
+
const globalReactDOM = window.ReactDOM;
|
|
16
|
+
if (globalReact && globalReactDOM) {
|
|
17
|
+
console.log('[NxtlinqAIAgent] Using global React instance from host application');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Check if we're in a module environment
|
|
21
|
+
if (typeof require !== 'undefined') {
|
|
22
|
+
try {
|
|
23
|
+
const react = require('react');
|
|
24
|
+
const reactDOM = require('react-dom');
|
|
25
|
+
if (react && reactDOM) {
|
|
26
|
+
console.log('[NxtlinqAIAgent] Using React instance from module system');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
// Module system not available or React not found
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
console.warn('[NxtlinqAIAgent] React instance check completed - using bundled React');
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error('[NxtlinqAIAgent] React instance check failed:', error);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
reactInstanceCheckPerformed = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function ensureReactCompatibility() {
|
|
44
|
+
// This function can be extended to perform more compatibility checks
|
|
45
|
+
checkReactInstance();
|
|
46
|
+
}
|
|
@@ -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
|
+
};
|
package/dist/types/ait-api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ait-api.d.ts","sourceRoot":"","sources":["../../src/types/ait-api.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SAC5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,CAAC;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC;IACF,WAAW,EAAE;QACX,qBAAqB,EAAE,CAAC,MAAM,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC;YAAE,WAAW,EAAE,iBAAiB,EAAE,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjJ,CAAC;IACF,SAAS,EAAE;QACT,iBAAiB,EAAE,MAAM,OAAO,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACzF,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytexbyte/nxtlinq-ai-agent-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.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",
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"universal-cookie": "^8.0.1",
|
|
60
60
|
"uuid": "^11.1.0"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|