@bytexbyte/nxtlinq-ai-agent-sdk 1.6.3 → 1.6.5
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 +59 -4
- package/dist/components/ui/PermissionForm.d.ts.map +1 -1
- package/dist/components/ui/PermissionForm.js +9 -3
- package/dist/components/ui/styles/isolatedStyles.d.ts.map +1 -1
- package/dist/components/ui/styles/isolatedStyles.js +14 -0
- 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/core/utils/urlUtils.d.ts.map +1 -1
- package/dist/core/utils/urlUtils.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/package.json +2 -2
- package/umd/nxtlinq-ai-agent.umd.js +143 -76
|
@@ -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,CAq5DlD,CAAC"}
|
|
@@ -190,6 +190,7 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
190
190
|
setAit(null);
|
|
191
191
|
setPermissions([]);
|
|
192
192
|
setWalletInfo(null);
|
|
193
|
+
setIsAITLoading(false);
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
195
196
|
setIsAITLoading(true);
|
|
@@ -369,8 +370,27 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
369
370
|
const currentHitAddress = hitAddressRef.current;
|
|
370
371
|
const currentSigner = signerRef.current;
|
|
371
372
|
// If refs don't have the values, try using current state values
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
let addressToUse = currentHitAddress || hitAddress;
|
|
374
|
+
let signerToUse = currentSigner || signer;
|
|
375
|
+
// If we have an address but no signer, try to auto-connect wallet
|
|
376
|
+
if (addressToUse && !signerToUse) {
|
|
377
|
+
const storedWalletAddress = localStorage.getItem('walletAddress');
|
|
378
|
+
if (storedWalletAddress === addressToUse) {
|
|
379
|
+
try {
|
|
380
|
+
const autoConnectResult = await connectWallet(false); // Don't show sign-in message yet
|
|
381
|
+
if (autoConnectResult) {
|
|
382
|
+
// Wait for state to update
|
|
383
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
384
|
+
// Get the updated signer
|
|
385
|
+
signerToUse = signerRef.current || signer;
|
|
386
|
+
addressToUse = hitAddressRef.current || hitAddress;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
console.error('Auto-connect failed during sign in:', error);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
374
394
|
if (!addressToUse) {
|
|
375
395
|
console.log('No address available, returning early');
|
|
376
396
|
if (autoShowSuccessMessage) {
|
|
@@ -1239,10 +1259,31 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
1239
1259
|
};
|
|
1240
1260
|
// Generate and register AIT
|
|
1241
1261
|
const generateAndRegisterAIT = async (newPermissions, isFromAIAgent = false) => {
|
|
1242
|
-
|
|
1262
|
+
let currentSigner = signer;
|
|
1263
|
+
let currentAddress = hitAddress;
|
|
1264
|
+
// If we have an address but no signer, try to auto-connect wallet
|
|
1265
|
+
if (currentAddress && !currentSigner) {
|
|
1266
|
+
const storedWalletAddress = localStorage.getItem('walletAddress');
|
|
1267
|
+
if (storedWalletAddress === currentAddress) {
|
|
1268
|
+
try {
|
|
1269
|
+
const autoConnectResult = await connectWallet(false); // Don't show sign-in message yet
|
|
1270
|
+
if (autoConnectResult) {
|
|
1271
|
+
// Wait for state to update
|
|
1272
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1273
|
+
// Get the updated signer and address
|
|
1274
|
+
currentSigner = signerRef.current || signer;
|
|
1275
|
+
currentAddress = hitAddressRef.current || hitAddress;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
catch (error) {
|
|
1279
|
+
console.error('Auto-connect failed during AIT generation:', error);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (!currentSigner || !currentAddress) {
|
|
1243
1284
|
throw new Error('Missing signer or wallet address');
|
|
1244
1285
|
}
|
|
1245
|
-
return generateAndRegisterAITWithSigner(newPermissions, isFromAIAgent,
|
|
1286
|
+
return generateAndRegisterAITWithSigner(newPermissions, isFromAIAgent, currentSigner, currentAddress);
|
|
1246
1287
|
};
|
|
1247
1288
|
// Generate and register AIT with explicit signer and address
|
|
1248
1289
|
const generateAndRegisterAITWithSigner = async (newPermissions, isFromAIAgent = false, explicitSigner, explicitAddress) => {
|
|
@@ -1583,11 +1624,25 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
|
|
|
1583
1624
|
throw error;
|
|
1584
1625
|
}
|
|
1585
1626
|
};
|
|
1627
|
+
// Initialize wallet address from localStorage on component mount
|
|
1628
|
+
React.useEffect(() => {
|
|
1629
|
+
const storedWalletAddress = localStorage.getItem('walletAddress');
|
|
1630
|
+
if (storedWalletAddress && !hitAddress) {
|
|
1631
|
+
setHitAddress(storedWalletAddress);
|
|
1632
|
+
hitAddressRef.current = storedWalletAddress;
|
|
1633
|
+
}
|
|
1634
|
+
}, []);
|
|
1586
1635
|
React.useEffect(() => {
|
|
1587
1636
|
if (hitAddress && nxtlinqAITServiceAccessToken) {
|
|
1588
1637
|
refreshAIT();
|
|
1589
1638
|
}
|
|
1590
1639
|
}, [hitAddress, nxtlinqAITServiceAccessToken]);
|
|
1640
|
+
// Set loading state when permission form opens
|
|
1641
|
+
React.useEffect(() => {
|
|
1642
|
+
if (isPermissionFormOpen && hitAddress) {
|
|
1643
|
+
setIsAITLoading(true);
|
|
1644
|
+
}
|
|
1645
|
+
}, [isPermissionFormOpen, hitAddress]);
|
|
1591
1646
|
React.useEffect(() => {
|
|
1592
1647
|
fetchAvailablePermissions();
|
|
1593
1648
|
}, [serviceId, permissionGroup]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;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,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2iBxD,CAAC"}
|
|
@@ -9,10 +9,13 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
9
9
|
const [availablePermissions, setAvailablePermissions] = React.useState([]);
|
|
10
10
|
const [isSaving, setIsSaving] = React.useState(false);
|
|
11
11
|
const [tempPermissions, setTempPermissions] = React.useState(permissions);
|
|
12
|
-
|
|
12
|
+
const [hasUserInteracted, setHasUserInteracted] = React.useState(false);
|
|
13
|
+
// Update temp permissions when permissions change, but only if user hasn't interacted
|
|
13
14
|
React.useEffect(() => {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
if (!hasUserInteracted) {
|
|
16
|
+
setTempPermissions(permissions);
|
|
17
|
+
}
|
|
18
|
+
}, [permissions, hasUserInteracted]);
|
|
16
19
|
const fetchAvailablePermissions = async () => {
|
|
17
20
|
if (!serviceId)
|
|
18
21
|
return;
|
|
@@ -64,6 +67,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
64
67
|
// Update the actual permissions with temp permissions
|
|
65
68
|
setPermissions(tempPermissions);
|
|
66
69
|
await onSave(tempPermissions);
|
|
70
|
+
setHasUserInteracted(false);
|
|
67
71
|
}
|
|
68
72
|
finally {
|
|
69
73
|
setIsSaving(false);
|
|
@@ -72,6 +76,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
72
76
|
const handleCancel = () => {
|
|
73
77
|
// Reset temp permissions to original permissions
|
|
74
78
|
setTempPermissions(permissions);
|
|
79
|
+
setHasUserInteracted(false);
|
|
75
80
|
onClose();
|
|
76
81
|
};
|
|
77
82
|
// Check if permissions have changed
|
|
@@ -339,6 +344,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
339
344
|
? tempPermissions.filter(p => p !== permission.label)
|
|
340
345
|
: [...tempPermissions, permission.label].sort();
|
|
341
346
|
setTempPermissions(newPermissions);
|
|
347
|
+
setHasUserInteracted(true);
|
|
342
348
|
setIsDisabled(false);
|
|
343
349
|
}
|
|
344
350
|
}, disabled: isAITLoading, css: css `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolatedStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/styles/isolatedStyles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,2CAwBpB,CAAC;AAGF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"isolatedStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/styles/isolatedStyles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,2CAwBpB,CAAC;AAGF,eAAO,MAAM,YAAY,2CAmExB,CAAC;AAGF,eAAO,MAAM,cAAc,2CA0B1B,CAAC;AAGF,eAAO,MAAM,UAAU,2CActB,CAAC;AAGF,eAAO,MAAM,UAAU,2CAStB,CAAC;AAGF,eAAO,MAAM,WAAW,2CAMvB,CAAC;AAGF,eAAO,MAAM,YAAY,2CA0BxB,CAAC;AAGF,eAAO,MAAM,WAAW,2CAoBvB,CAAC;AAGF,eAAO,MAAM,oBAAoB,2CAQhC,CAAC;AAGF,eAAO,MAAM,aAAa,2CAKzB,CAAC;AAGF,eAAO,MAAM,WAAW,2CAKvB,CAAC;AAGF,eAAO,MAAM,cAAc,2CAQ1B,CAAC;AAGF,eAAO,MAAM,kBAAkB,2CAQ9B,CAAC;AAGF,eAAO,MAAM,mBAAmB,2CAS/B,CAAC;AAGF,eAAO,MAAM,aAAa,2CAezB,CAAC;AAGF,eAAO,MAAM,YAAY,2CAexB,CAAC;AAGF,eAAO,MAAM,eAAe,2CAc3B,CAAC;AAGF,eAAO,MAAM,gBAAgB,2CAQ5B,CAAC;AAGF,eAAO,MAAM,cAAc,2CAM1B,CAAC;AAGF,eAAO,MAAM,UAAU,2CAYtB,CAAC;AAGF,eAAO,MAAM,QAAQ,2CAMpB,CAAC;AAGF,eAAO,MAAM,iBAAiB,2CAc7B,CAAC;AAGF,eAAO,MAAM,YAAY,2CAIxB,CAAC;AAGF,eAAO,MAAM,UAAU,2CAItB,CAAC;AAGF,eAAO,MAAM,YAAY,2CAIxB,CAAC;AAGF,eAAO,MAAM,SAAS,2CAIrB,CAAC;AAGF,eAAO,MAAM,gBAAgB,2CAiB5B,CAAC;AAGF,eAAO,MAAM,YAAY,2CAYxB,CAAC;AAGF,eAAO,MAAM,SAAS,2CAWrB,CAAC;AAGF,eAAO,MAAM,cAAc,2CAM1B,CAAC;AAGF,eAAO,MAAM,aAAa,2CAMzB,CAAC;AAGF,eAAO,MAAM,eAAe,2CAoB3B,CAAC;AAGF,eAAO,MAAM,gBAAgB,2CAmB5B,CAAC;AAGF,eAAO,MAAM,cAAc,2CAO1B,CAAC"}
|
|
@@ -73,6 +73,20 @@ export const sdkContainer = css `
|
|
|
73
73
|
text-decoration: none !important;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/* Special styling for AI Agent URL links */
|
|
77
|
+
& a[href^="http"], & a[href^="https"] {
|
|
78
|
+
color: #007bff !important;
|
|
79
|
+
text-decoration: underline !important;
|
|
80
|
+
cursor: pointer !important;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Specific class for AI Agent URL links */
|
|
84
|
+
& .ai-agent-url-link {
|
|
85
|
+
color: #007bff !important;
|
|
86
|
+
text-decoration: underline !important;
|
|
87
|
+
cursor: pointer !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
76
90
|
/* Light reset for images */
|
|
77
91
|
& img {
|
|
78
92
|
box-sizing: border-box !important;
|
|
@@ -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
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/urlUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/urlUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,CAAC,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,EAgD9E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAKhD,CAAC"}
|
|
@@ -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/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.5",
|
|
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
|
+
}
|