@bytexbyte/nxtlinq-ai-agent-sdk 1.6.5 → 1.6.6

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":"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"}
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,CAg6DlD,CAAC"}
@@ -30,11 +30,12 @@ customUserInfo,
30
30
  // Custom username for wallet verification
31
31
  customUsername,
32
32
  // IDV suggestion banner configuration
33
- idvBannerDismissSeconds = 86400 // 24 hours in seconds
34
- }) => {
33
+ idvBannerDismissSeconds = 86400,
34
+ // 24 hours in seconds
35
+ isStopRecordingOnSend = false, }) => {
35
36
  const nxtlinqApi = React.useMemo(() => createNxtlinqApi(apiKey, apiSecret), [apiKey, apiSecret]);
36
37
  // Custom hook
37
- const { isRecording, transcript, start: startRecording, stop: stopRecording } = useSpeechToTextFromMic({
38
+ const { isRecording, transcript, start: startRecording, stop: stopRecording, clear: clearRecording } = useSpeechToTextFromMic({
38
39
  apiKey,
39
40
  apiSecret
40
41
  });
@@ -103,11 +104,11 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
103
104
  signerRef.current = signer;
104
105
  }, [signer]);
105
106
  React.useEffect(() => {
106
- if (!transcript) {
107
+ if (!transcript || isLoading) {
107
108
  return;
108
109
  }
109
110
  setInputValue(transcript);
110
- }, [transcript]);
111
+ }, [transcript, isLoading]);
111
112
  React.useEffect(() => {
112
113
  isRecordingRef.current = isRecording;
113
114
  }, [isRecording]);
@@ -1190,9 +1191,17 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
1190
1191
  // Handle submit
1191
1192
  const handleSubmit = async (e) => {
1192
1193
  e.preventDefault();
1193
- while (isRecordingRef.current) {
1194
- stopRecording();
1195
- await sleep(1000);
1194
+ if (isStopRecordingOnSend) {
1195
+ while (isRecordingRef.current) {
1196
+ stopRecording();
1197
+ await sleep(1000);
1198
+ }
1199
+ }
1200
+ else {
1201
+ if (isRecordingRef.current) {
1202
+ await sleep(1000);
1203
+ clearRecording();
1204
+ }
1196
1205
  }
1197
1206
  if (!textInputRef.current)
1198
1207
  return;
@@ -1749,6 +1758,7 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
1749
1758
  refreshAIT,
1750
1759
  startRecording,
1751
1760
  stopRecording,
1761
+ clearRecording,
1752
1762
  // AI Model related functions
1753
1763
  handleModelChange,
1754
1764
  getCurrentModel,
@@ -1784,7 +1794,8 @@ idvBannerDismissSeconds = 86400 // 24 hours in seconds
1784
1794
  isSemiAutomaticMode,
1785
1795
  customUserInfo,
1786
1796
  customUsername,
1787
- idvBannerDismissSeconds
1797
+ idvBannerDismissSeconds,
1798
+ isStopRecordingOnSend,
1788
1799
  },
1789
1800
  nxtlinqApi
1790
1801
  };
@@ -60,6 +60,7 @@ export interface ChatBotProps {
60
60
  customUsername?: string;
61
61
  idvBannerDismissSeconds?: number;
62
62
  berifymeMode?: 'built-in' | 'external';
63
+ isStopRecordingOnSend?: boolean;
63
64
  }
64
65
  export interface ChatBotContextType {
65
66
  messages: Message[];
@@ -118,6 +119,7 @@ export interface ChatBotContextType {
118
119
  refreshAIT: (forceUpdatePermissions?: boolean) => Promise<void>;
119
120
  startRecording: () => Promise<void>;
120
121
  stopRecording: () => void;
122
+ clearRecording: () => void;
121
123
  handleModelChange: (modelIndex: number) => void;
122
124
  getCurrentModel: () => AIModel;
123
125
  onSave: (newPermissions?: string[]) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBotTypes.d.ts","sourceRoot":"","sources":["../../../src/components/types/ChatBotTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,OAAO,EAKtC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,OAAO,EAwB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AAI,CAAC;IACpC,UAAU,EAAE,CAAC,sBAAsB,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAE3B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,MAAM,OAAO,CAAC;IAG/B,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC;IAC3D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAsGhC,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,EAsGhC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
3
4
  import MicIcon from '@mui/icons-material/Mic';
4
5
  import MicOffIcon from '@mui/icons-material/MicOff';
5
6
  import { IconButton, InputBase } from '@mui/material';
6
- import { css } from '@emotion/react';
7
7
  import { useChatBot } from '../context/ChatBotContext';
8
8
  import { actionButton } from './styles/isolatedStyles';
9
9
  export const MessageInput = () => {
@@ -6,7 +6,7 @@ import { Dispatch, SetStateAction } from 'react';
6
6
  export declare const startSpeechToTextFromMic: (setSpeechToTextArray: Dispatch<SetStateAction<string[]>>, config: {
7
7
  apiKey: string;
8
8
  apiSecret: string;
9
- }) => Promise<SpeechRecognizer | undefined>;
9
+ }, historyRef: React.MutableRefObject<string[]>, indexRef: React.MutableRefObject<number>) => Promise<SpeechRecognizer | undefined>;
10
10
  /**
11
11
  * Stop speech recognition
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAML,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMjD;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,sBAAsB,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,EACxD,QAAQ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,KAC5C,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAsCtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,gBAAgB,GAAG,SAAS,SAIvE,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;GAwBxE"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAML,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMjD;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,sBAAsB,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,EACxD,QAAQ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC7C,YAAY,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAC5C,UAAU,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,KACvC,OAAO,CAAC,gBAAgB,GAAG,SAAS,CA4CtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,gBAAgB,GAAG,SAAS,SAIvE,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;GAwBxE"}
@@ -5,35 +5,39 @@ let recognizer;
5
5
  /**
6
6
  * Start speech recognition, continuously updates speechToTextArray (each sentence as an array element)
7
7
  */
8
- export const startSpeechToTextFromMic = async (setSpeechToTextArray, config) => {
8
+ export const startSpeechToTextFromMic = async (setSpeechToTextArray, config, historyRef, indexRef) => {
9
9
  const tokenRes = await getTokenOrRefresh(config.apiKey, config.apiSecret);
10
+ if (!tokenRes.authToken || !tokenRes.region) {
11
+ console.error('Speech token retrieval failed:', tokenRes.error);
12
+ return;
13
+ }
10
14
  const speechConfig = SpeechConfig.fromAuthorizationToken(tokenRes.authToken, tokenRes.region);
11
15
  speechConfig.speechRecognitionLanguage = 'en-US';
12
16
  speechConfig.setProperty(PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, '10000');
13
17
  speechConfig.setProperty(PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, '86400000');
14
- speechConfig.setProperty(PropertyId.Speech_SegmentationSilenceTimeoutMs, '2500');
18
+ speechConfig.setProperty(PropertyId.Speech_SegmentationSilenceTimeoutMs, '1000');
15
19
  const audioConfig = AudioConfig.fromDefaultMicrophoneInput();
16
- recognizer = new SpeechRecognizer(speechConfig, audioConfig);
17
- const conversationHistory = [];
18
- let index = 0;
20
+ const recognizer = new SpeechRecognizer(speechConfig, audioConfig);
19
21
  recognizer.recognizing = (_s, e) => {
20
- conversationHistory[index] = e.result.text;
21
- setSpeechToTextArray([...conversationHistory]);
22
+ historyRef.current[indexRef.current] = e.result.text;
23
+ setSpeechToTextArray([...historyRef.current]);
22
24
  };
23
25
  recognizer.recognized = (_s, e) => {
24
26
  if (e.result.reason === ResultReason.RecognizedSpeech) {
25
- conversationHistory[index] = e.result.text;
26
- setSpeechToTextArray([...conversationHistory]);
27
- index += 1;
27
+ historyRef.current[indexRef.current] = e.result.text;
28
+ setSpeechToTextArray([...historyRef.current]);
29
+ indexRef.current += 1;
28
30
  }
29
31
  };
30
32
  recognizer.canceled = (_s, e) => {
33
+ console.warn('Speech recognition canceled:', e.reason);
31
34
  if (e.reason === CancellationReason.Error) {
32
- console.error(`CANCELED: ErrorCode=${e.errorCode}`);
33
- console.error(`CANCELED: ErrorDetails=${e.errorDetails}`);
34
- console.error('CANCELED: Did you set the speech resource key and region values?');
35
+ console.error(`Error code: ${e.errorCode}`);
36
+ console.error(`Error details: ${e.errorDetails}`);
35
37
  }
36
- stopRecognition(recognizer);
38
+ };
39
+ recognizer.sessionStopped = () => {
40
+ console.log('Speech recognition session stopped');
37
41
  };
38
42
  recognizer.startContinuousRecognitionAsync();
39
43
  return recognizer;
@@ -5,6 +5,7 @@ interface Props {
5
5
  type UseSpeechToTextFromMicResult = {
6
6
  start: () => Promise<void>;
7
7
  stop: () => void;
8
+ clear: () => void;
8
9
  isRecording: boolean;
9
10
  transcript: string;
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/index.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,4BAA4B,CA0CjG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/lib/useSpeechToTextFromMic/index.ts"],"names":[],"mappings":"AAIA,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,4BAA4B,CAqDjG"}
@@ -5,6 +5,8 @@ export function useSpeechToTextFromMic({ apiKey, apiSecret }) {
5
5
  const [transcriptArray, setTranscriptArray] = useState([]);
6
6
  const [recognizer, setRecognizer] = useState();
7
7
  const wakelock = useRef();
8
+ const historyRef = useRef([]);
9
+ const indexRef = useRef(0);
8
10
  const canWakeLock = () => 'wakeLock' in navigator;
9
11
  async function lockWakeState() {
10
12
  if (!canWakeLock())
@@ -20,9 +22,10 @@ export function useSpeechToTextFromMic({ apiKey, apiSecret }) {
20
22
  }
21
23
  }
22
24
  const start = async () => {
25
+ clear();
23
26
  await lockWakeState();
24
27
  setIsRecording(true);
25
- const recognizerInstance = await startSpeechToTextFromMic(setTranscriptArray, { apiKey, apiSecret });
28
+ const recognizerInstance = await startSpeechToTextFromMic(setTranscriptArray, { apiKey, apiSecret }, historyRef, indexRef);
26
29
  setRecognizer(recognizerInstance);
27
30
  };
28
31
  const stop = () => {
@@ -31,10 +34,16 @@ export function useSpeechToTextFromMic({ apiKey, apiSecret }) {
31
34
  setIsRecording(false);
32
35
  setRecognizer(undefined);
33
36
  };
37
+ const clear = () => {
38
+ historyRef.current = [];
39
+ indexRef.current = 0;
40
+ setTranscriptArray([]);
41
+ };
34
42
  const transcript = transcriptArray.join(' ');
35
43
  return {
36
44
  start,
37
45
  stop,
46
+ clear,
38
47
  isRecording,
39
48
  transcript,
40
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
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
+ }
@@ -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
- };