@bytexbyte/nxtlinq-ai-agent-sdk 1.6.10 → 1.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,16 +1,20 @@
1
1
  # nxtlinq AI Agent SDK
2
2
 
3
- A comprehensive SDK for integrating AI agents with wallet verification capabilities.
3
+ A comprehensive SDK for integrating AI agents with wallet verification capabilities, speech-to-text functionality, and responsive mobile design.
4
4
 
5
5
  ## Features
6
6
 
7
- - 🤖 AI-powered chat interface
7
+ - 🤖 AI-powered chat interface with multiple model support
8
8
  - 🔐 Built-in BerifyMe wallet verification
9
- - 🎨 Customizable UI components
9
+ - 🎤 Speech-to-text voice input with Microsoft Cognitive Services
10
+ - 🎨 Customizable UI components with responsive design
10
11
  - 🔧 Tool integration support
11
- - 📱 Responsive design
12
+ - 📱 Mobile-optimized responsive design (65-70% viewport on mobile)
12
13
  - 👤 Custom user identity support
13
14
  - ⏰ Configurable banner dismiss duration
15
+ - 🎯 Multiple AI model support
16
+ - 💾 Flexible storage options (localStorage/sessionStorage)
17
+ - 🔄 Semi-automatic mode for user activation
14
18
 
15
19
  ## Installation
16
20
 
@@ -40,7 +44,7 @@ function App() {
40
44
 
41
45
  ### With Built-in BerifyMe Support
42
46
 
43
- The SDK now includes built-in BerifyMe wallet verification, making integration extremely simple:
47
+ The SDK includes built-in BerifyMe wallet verification for seamless integration:
44
48
 
45
49
  ```tsx
46
50
  import { ChatBot } from '@bytexbyte/nxtlinq-ai-agent-sdk';
@@ -57,35 +61,22 @@ function App() {
57
61
  }
58
62
  ```
59
63
 
60
- ### Built-in Wallet Verification (Recommended)
64
+ ### With Speech-to-Text Support
61
65
 
62
- The SDK automatically handles wallet verification. No need to implement `onVerifyWallet` manually:
66
+ Enable voice input with Microsoft Cognitive Services:
63
67
 
64
68
  ```tsx
65
- import { ChatBot } from '@bytexbyte/nxtlinq-ai-agent-sdk';
66
-
67
- function App() {
68
- return (
69
- <ChatBot
70
- serviceId="your-service-id"
71
- apiKey="your-api-key"
72
- apiSecret="your-api-secret"
73
- // Built-in wallet verification - no onVerifyWallet needed!
74
- />
75
- );
76
- }
69
+ <ChatBot
70
+ serviceId="your-service-id"
71
+ apiKey="your-api-key"
72
+ apiSecret="your-api-secret"
73
+ isStopRecordingOnSend={true} // Stop recording automatically when sending message
74
+ />
77
75
  ```
78
76
 
79
- **What happens automatically:**
80
- 1. ✅ Check for existing token in URL parameters
81
- 2. ✅ Open BerifyMe modal when verification is needed
82
- 3. ✅ Handle verification completion and token extraction
83
- 4. ✅ Clean up modal and state management
84
- 5. ✅ Return token to the system for wallet verification
85
-
86
77
  ### Skip Wallet Verification Check
87
78
 
88
- If you want to allow users to set AIT permissions without wallet verification, you can disable the verification check:
79
+ Allow users to set AIT permissions without wallet verification:
89
80
 
90
81
  ```tsx
91
82
  <ChatBot
@@ -96,110 +87,163 @@ If you want to allow users to set AIT permissions without wallet verification, y
96
87
  />
97
88
  ```
98
89
 
99
- **Note**: When `requireWalletIDVVerification: false`, users can connect and sign in with their wallet, then directly set AIT permissions without going through the wallet IDV verification process.
100
-
101
- **Default Behavior**: `requireWalletIDVVerification` defaults to `true`, meaning wallet verification is required by default for security.
102
-
103
- ## Benefits of Built-in BerifyMe Support
104
-
105
- ✅ **Always Available**: Built-in BerifyMe support is always enabled - no configuration needed!
90
+ ## Mobile Responsive Design
106
91
 
107
- **No onVerifyWallet Needed**: SDK automatically handles wallet verification - no callback implementation required
92
+ The SDK is optimized for mobile devices with responsive breakpoints:
108
93
 
109
- **Simplified Integration**: No need to manually handle DOM manipulation, React roots, or modal lifecycle
94
+ - **Tablet (≤768px)**: Chat window sized to 70% viewport width/height
95
+ - **Mobile (≤480px)**: Chat window sized to 65% viewport width/height
96
+ - **PermissionForm**: Responsive sizing with 75% width on tablet, 70% on mobile
97
+ - **Floating Button**: Optimized positioning and sizing for touch interfaces
98
+ - **Browser Compatibility**: Accounts for mobile browser address bars and UI elements
110
99
 
111
- **Automatic SDK Loading**: SDK automatically loads BerifyMe dependencies when needed
100
+ ## Configuration Options
112
101
 
113
- **Built-in Error Handling**: Comprehensive error handling and fallback mechanisms
102
+ ### Core Configuration
114
103
 
115
- **Consistent UI**: Unified modal experience across all implementations
104
+ | Property | Type | Default | Description |
105
+ |----------|------|---------|-------------|
106
+ | `serviceId` | `string` | - | **Required** - Your service ID |
107
+ | `apiKey` | `string` | - | **Required** - Your API key |
108
+ | `apiSecret` | `string` | - | **Required** - Your API secret |
116
109
 
117
- **Easy Configuration**: Simple configuration object with sensible defaults
110
+ ### Wallet Verification Options
118
111
 
119
- **Automatic Cleanup**: Modal cleanup and memory management handled automatically
112
+ | Property | Type | Default | Description |
113
+ |----------|------|---------|-------------|
114
+ | `requireWalletIDVVerification` | `boolean` | `true` | Whether to check wallet IDV verification status before AIT operations |
115
+ | `customUsername` | `string` | - | Custom username for wallet verification when using custom method |
116
+ | `idvBannerDismissSeconds` | `number` | `86400` | Seconds to hide IDV suggestion banner after user dismisses it (default: 24 hours) |
117
+ | `berifymeMode` | `'built-in' \| 'external'` | `'built-in'` | BerifyMe integration mode |
120
118
 
121
- **Flexible IDV Verification**: Control whether to require wallet IDV verification before AIT operations
119
+ ### AI Model Configuration
122
120
 
123
- **Smart Suggestion Banner**: When verification is optional, shows helpful suggestion banner with 1-second delay to prevent flashing
121
+ | Property | Type | Default | Description |
122
+ |----------|------|---------|-------------|
123
+ | `availableModels` | `AIModel[]` | `DEFAULT_AI_MODELS` | Available AI models for selection |
124
+ | `defaultModelIndex` | `number` | `0` | Default selected model index |
125
+ | `showModelSelector` | `boolean` | `true` | Whether to show model selector in UI |
126
+ | `onModelChange` | `(model: AIModel) => void` | - | Callback when model is changed |
124
127
 
125
- **Custom User Identity**: Support for custom usernames and flexible user information objects
128
+ ### Storage Configuration
126
129
 
127
- **Configurable Banner Duration**: Customize how long the IDV suggestion banner stays hidden after dismissal
130
+ | Property | Type | Default | Description |
131
+ |----------|------|---------|-------------|
132
+ | `useSessionStorage` | `boolean` | `false` | Use sessionStorage instead of localStorage for chat state |
128
133
 
129
- ## Configuration Options
134
+ ### User Identity Options
130
135
 
131
- ### Built-in BerifyMe Support
136
+ | Property | Type | Default | Description |
137
+ |----------|------|---------|-------------|
138
+ | `customUserInfo` | `Record<string, any>` | - | Custom user identity information object for backend processing |
132
139
 
133
- The built-in BerifyMe support requires no configuration - it automatically redirects to the current page after verification.
140
+ ### Speech-to-Text Options
134
141
 
135
- **Wallet Verification Options:**
136
142
  | Property | Type | Default | Description |
137
143
  |----------|------|---------|-------------|
138
- | `requireWalletIDVVerification` | `boolean` | `true` | Whether to check wallet IDV verification status before AIT operations |
139
- | `customUsername` | `string` | - | Custom username for wallet verification when using custom method |
140
- | `idvBannerDismissSeconds` | `number` | `86400` | Seconds to hide IDV suggestion banner after user dismisses it (default: 24 hours) |
144
+ | `isStopRecordingOnSend` | `boolean` | `false` | Stop recording automatically when sending message |
145
+
146
+ ### Advanced Options
141
147
 
142
- **User Identity Options:**
143
148
  | Property | Type | Default | Description |
144
149
  |----------|------|---------|-------------|
145
- | `customUserInfo` | `Record<string, any>` | - | Custom user identity information object for backend processing |
150
+ | `isSemiAutomaticMode` | `boolean` | `false` | Enable semi-automatic mode for user activation |
151
+ | `maxRetries` | `number` | `3` | Maximum retry attempts for failed requests |
152
+ | `retryDelay` | `number` | `1000` | Delay between retry attempts (ms) |
146
153
 
147
- ### Configuration Examples
154
+ ## Available AI Models
148
155
 
149
- #### Require Wallet Verification (Default)
150
- ```tsx
151
- <ChatBot
152
- serviceId="your-service-id"
153
- apiKey="your-api-key"
154
- apiSecret="your-api-secret"
155
- // requireWalletIDVVerification defaults to true
156
- // Users must complete wallet verification before using AIT
157
- />
158
- ```
156
+ The SDK supports multiple AI models:
159
157
 
160
- #### Make Wallet Verification Optional
161
- ```tsx
162
- <ChatBot
163
- serviceId="your-service-id"
164
- apiKey="your-api-key"
165
- apiSecret="your-api-secret"
166
- requireWalletIDVVerification={false}
167
- // Users can use AIT without wallet verification
168
- // Helpful suggestion banner will appear for unverified wallets
169
- />
170
- ```
158
+ - **Claude** (`claude`)
159
+ - **ChatGPT** (`open-ai`)
160
+ - **Llama** (`llama`)
161
+ - **Gemini** (`gemini`)
162
+ - **Nova** (`nova`)
163
+
164
+ ## Configuration Examples
165
+
166
+ ### Complete Configuration Example
171
167
 
172
- #### Custom User Identity
173
168
  ```tsx
174
169
  <ChatBot
175
170
  serviceId="your-service-id"
176
171
  apiKey="your-api-key"
177
172
  apiSecret="your-api-secret"
173
+
174
+ // Wallet verification
178
175
  requireWalletIDVVerification={false}
179
176
  customUsername="john.doe"
177
+ idvBannerDismissSeconds={3600}
178
+ berifymeMode="built-in"
179
+
180
+ // AI models
181
+ availableModels={DEFAULT_AI_MODELS}
182
+ defaultModelIndex={0}
183
+ showModelSelector={true}
184
+ onModelChange={(model) => console.log('Model changed:', model)}
185
+
186
+ // Storage
187
+ useSessionStorage={true}
188
+
189
+ // User identity
180
190
  customUserInfo={{
181
191
  corpId: "CORP-001",
182
192
  department: "Engineering",
183
193
  role: "Developer"
184
194
  }}
185
- // Custom user identity information for backend processing
195
+
196
+ // Speech-to-text
197
+ isStopRecordingOnSend={true}
198
+
199
+ // Advanced
200
+ isSemiAutomaticMode={false}
201
+ maxRetries={3}
202
+ retryDelay={1000}
203
+
204
+ // Callbacks
205
+ onMessage={(message) => console.log('New message:', message)}
206
+ onError={(error) => console.error('Error:', error)}
207
+ onToolUse={async (toolUse) => {
208
+ // Handle tool use
209
+ return { text: 'Tool executed successfully' };
210
+ }}
186
211
  />
187
212
  ```
188
213
 
189
- #### Custom Banner Dismiss Duration
214
+ ### Custom AI Models
215
+
190
216
  ```tsx
217
+ import { ChatBot, AIModel } from '@bytexbyte/nxtlinq-ai-agent-sdk';
218
+
219
+ const customModels: AIModel[] = [
220
+ { label: 'Claude', value: 'claude' },
221
+ { label: 'ChatGPT', value: 'open-ai' },
222
+ { label: 'Llama', value: 'llama' },
223
+ { label: 'Gemini', value: 'gemini' }
224
+ ];
225
+
191
226
  <ChatBot
192
227
  serviceId="your-service-id"
193
228
  apiKey="your-api-key"
194
229
  apiSecret="your-api-secret"
195
- requireWalletIDVVerification={false}
196
- idvBannerDismissSeconds={3600} // Hide banner for 1 hour (3600 seconds)
197
- // Customize how long the IDV suggestion banner stays hidden
230
+ availableModels={customModels}
231
+ defaultModelIndex={0}
198
232
  />
199
233
  ```
200
234
 
201
235
  ## Advanced Features
202
236
 
237
+ ### Speech-to-Text Integration
238
+
239
+ The SDK includes built-in speech-to-text functionality using Microsoft Cognitive Services:
240
+
241
+ - **Real-time transcription**: Live voice-to-text conversion
242
+ - **Partial transcripts**: Shows real-time partial results while speaking
243
+ - **Wake lock support**: Prevents screen from sleeping during recording
244
+ - **Automatic cleanup**: Handles microphone permissions and cleanup
245
+ - **Configurable behavior**: Control when recording stops
246
+
203
247
  ### IDV Suggestion Banner
204
248
 
205
249
  When `requireWalletIDVVerification: false`, the SDK shows a helpful suggestion banner for unverified wallets:
@@ -209,7 +253,6 @@ When `requireWalletIDVVerification: false`, the SDK shows a helpful suggestion b
209
253
  - **Persistent State**: Dismissal preference is saved in localStorage
210
254
  - **Responsive Design**: Banner adapts to different screen sizes
211
255
  - **User-Friendly Display**: Shows time in hours/minutes format (e.g., "24h" or "1h 30m")
212
- - **Flexible Configuration**: Set custom dismiss duration in seconds via `idvBannerDismissSeconds`
213
256
 
214
257
  ### Custom User Identity
215
258
 
@@ -220,32 +263,115 @@ The SDK supports flexible user identity information for enhanced backend process
220
263
  - **Backend Integration**: Custom identity information is sent to the AIT Service for processing
221
264
  - **Optional Parameters**: Both `customUsername` and `customUserInfo` are optional
222
265
 
223
- **Example Usage:**
266
+ ### Storage Modes
267
+
268
+ Choose between different storage strategies:
269
+
270
+ - **localStorage** (default): Persistent across browser sessions
271
+ - **sessionStorage**: Data cleared when browser tab is closed
272
+
273
+ ### BerifyMe Integration Modes
274
+
275
+ - **built-in** (default): SDK automatically loads and manages BerifyMe
276
+ - **external**: Use your own BerifyMe integration with `onVerifyWallet` callback
277
+
278
+ ## Exported Components and Utilities
279
+
280
+ ### Components
224
281
  ```tsx
225
- <ChatBot
226
- serviceId="your-service-id"
227
- apiKey="your-api-key"
228
- apiSecret="your-api-secret"
229
- requireWalletIDVVerification={false}
230
- customUsername="employee-123"
231
- customUserInfo={{
232
- corpId: "COMPANY-001",
233
- department: "Sales",
234
- region: "Asia-Pacific",
235
- accessLevel: "premium"
236
- }}
237
- // Custom user identity information sent to backend for processing
238
- />
282
+ import {
283
+ ChatBot,
284
+ ChatBotUI,
285
+ MessageInput,
286
+ MessageList,
287
+ ModelSelector,
288
+ NotificationModal,
289
+ PermissionForm,
290
+ PresetMessages,
291
+ BerifyMeModal
292
+ } from '@bytexbyte/nxtlinq-ai-agent-sdk';
293
+ ```
294
+
295
+ ### Hooks and Context
296
+ ```tsx
297
+ import {
298
+ ChatBotProvider,
299
+ useChatBot,
300
+ useLocalStorage,
301
+ useSessionStorage
302
+ } from '@bytexbyte/nxtlinq-ai-agent-sdk';
303
+ ```
304
+
305
+ ### Utilities
306
+ ```tsx
307
+ import {
308
+ connectWallet,
309
+ disconnectWallet,
310
+ validateToken,
311
+ createAITMetadata,
312
+ generateAITId,
313
+ prepareAITCreation,
314
+ createNotification,
315
+ getNotificationIcon,
316
+ containsUrls,
317
+ convertUrlsToLinks,
318
+ convertUrlsToHtml,
319
+ createNxtlinqApi
320
+ } from '@bytexbyte/nxtlinq-ai-agent-sdk';
321
+ ```
322
+
323
+ ### Types
324
+ ```tsx
325
+ import type {
326
+ ChatBotProps,
327
+ ChatBotContextType,
328
+ AIModel,
329
+ AITMetadata,
330
+ NovaResponse,
331
+ NovaError,
332
+ PresetMessage,
333
+ ToolCall,
334
+ ToolUse,
335
+ AIT,
336
+ AITApi,
337
+ Message,
338
+ ServicePermission
339
+ } from '@bytexbyte/nxtlinq-ai-agent-sdk';
239
340
  ```
240
341
 
241
- ### Wallet Connection Flow
342
+ ## Benefits
343
+
344
+ ✅ **Always Available**: Built-in BerifyMe support is always enabled - no configuration needed!
345
+
346
+ ✅ **No onVerifyWallet Needed**: SDK automatically handles wallet verification - no callback implementation required
347
+
348
+ ✅ **Simplified Integration**: No need to manually handle DOM manipulation, React roots, or modal lifecycle
349
+
350
+ ✅ **Automatic SDK Loading**: SDK automatically loads BerifyMe dependencies when needed
351
+
352
+ ✅ **Built-in Error Handling**: Comprehensive error handling and fallback mechanisms
353
+
354
+ ✅ **Consistent UI**: Unified modal experience across all implementations
355
+
356
+ ✅ **Easy Configuration**: Simple configuration object with sensible defaults
357
+
358
+ ✅ **Automatic Cleanup**: Modal cleanup and memory management handled automatically
359
+
360
+ ✅ **Flexible IDV Verification**: Control whether to require wallet IDV verification before AIT operations
361
+
362
+ ✅ **Smart Suggestion Banner**: When verification is optional, shows helpful suggestion banner with 1-second delay to prevent flashing
363
+
364
+ ✅ **Custom User Identity**: Support for custom usernames and flexible user information objects
365
+
366
+ ✅ **Configurable Banner Duration**: Customize how long the IDV suggestion banner stays hidden after dismissal
367
+
368
+ ✅ **Mobile Optimized**: Responsive design that works perfectly on mobile devices with optimized dimensions
369
+
370
+ ✅ **Speech-to-Text**: Built-in voice input with Microsoft Cognitive Services integration
371
+
372
+ ✅ **Multiple AI Models**: Support for various AI models (Claude, ChatGPT, Llama, Gemini, Nova)
242
373
 
243
- 1. **Connect Wallet**: User connects their wallet
244
- 2. **Sign In**: User signs in with wallet (if required)
245
- 3. **Verification Check**: SDK checks if wallet is verified
246
- 4. **Custom Identity**: If `customUsername` is provided and `requireWalletIDVVerification: false`, create wallet with custom method
247
- 5. **Conditional Banner**: If verification is optional and wallet is unverified, show suggestion banner
248
- 6. **User Choice**: User can verify wallet or continue without verification
374
+ **Flexible Storage**: Choose between localStorage and sessionStorage for different use cases
249
375
 
250
376
  ## Support
251
377
 
@@ -1,5 +1,5 @@
1
1
  const AI_AGENT_API_HOST = 'https://ai-agent.nxtlinq.ai';
2
- const AIT_SERVICE_API_HOST = 'https://staging-ait-service.nxtlinq.ai';
2
+ const AIT_SERVICE_API_HOST = 'https://ait-service.nxtlinq.ai';
3
3
  // Helper function to get auth header
4
4
  const getAuthHeader = () => {
5
5
  const token = localStorage.getItem('nxtlinqAITServiceAccessToken');
@@ -1,4 +1,3 @@
1
- /** @jsxImportSource @emotion/react */
2
1
  import React from 'react';
3
2
  interface BerifyMeModalProps {
4
3
  isOpen: boolean;
@@ -11,10 +10,6 @@ declare global {
11
10
  interface Window {
12
11
  BerifyMeSDK?: {
13
12
  modal: any;
14
- environment: {
15
- Staging: any;
16
- Production: any;
17
- };
18
13
  };
19
14
  }
20
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,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;IAClD,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAChC;AASD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsHtD,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"}
1
+ {"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,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;IAClD,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAChC;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;SACZ,CAAC;KACH;CACF"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
- import React, { useEffect, useRef } from 'react';
4
3
  import { css } from '@emotion/react';
4
+ import React, { useEffect, useRef } from 'react';
5
5
  import { modalOverlay } from './styles/isolatedStyles';
6
6
  // Built-in BerifyMe configuration
7
7
  const BUILT_IN_BERIFYME_CONFIG = {
8
- apiKeyId: 'staging_83dc824cb50b4e76747e352b4228f2ee',
9
- secretKey: 'ee96158a-9ae2-42ad-8c30-f7b23edbf258',
10
- environment: 'staging'
8
+ apiKeyId: 'idv_XjN7vvuQVfHnaUkVQAEhdTuxAsQeKoa9',
9
+ secretKey: 'aaa444b1-087c-4b17-821a-9a6974286905',
10
+ environment: 'idv'
11
11
  };
12
12
  export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete, mode = 'built-in' }) => {
13
13
  const modalRef = useRef(null);
@@ -71,14 +71,12 @@ export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete, mode =
71
71
  const redirectUrl = `${window.location.origin}${window.location.pathname}?isAutoConnect=true&method=berifyme&returnUrl=${encodeURIComponent(currentUrl)}`;
72
72
  // Create BerifyMe modal using built-in config
73
73
  const berifyMeModal = window.BerifyMeSDK.modal;
74
- // Always use staging environment for now
75
- const environment = window.BerifyMeSDK.environment.Staging;
76
74
  // Use React 18's createRoot
77
75
  const { createRoot } = require('react-dom/client');
78
76
  const root = createRoot(modalRef.current);
79
77
  berifyMeModalRef.current = root;
80
78
  root.render(React.createElement(berifyMeModal, {
81
- environment,
79
+ environment: BUILT_IN_BERIFYME_CONFIG.environment,
82
80
  apiKeyId: BUILT_IN_BERIFYME_CONFIG.apiKeyId,
83
81
  secretKey: BUILT_IN_BERIFYME_CONFIG.secretKey,
84
82
  redirectUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.6.10",
3
+ "version": "1.6.12",
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",
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for URL utility functions
3
- */
4
- export {};
5
- //# sourceMappingURL=urlUtils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"urlUtils.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/urlUtils.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1,57 +0,0 @@
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
- });
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,81 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,46 +0,0 @@
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,2 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- //# sourceMappingURL=setupTests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAC"}
@@ -1,16 +0,0 @@
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
- };