@revrag-ai/embed-react-native 1.0.6 → 1.0.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/LICENSE +1 -1
- package/README.md +253 -274
- package/android/CMakeLists.txt +15 -0
- package/android/build.gradle +77 -25
- package/android/cpp-adapter.cpp +8 -0
- package/android/generated/java/com/revragai/embedreactnative/NativeEmbedReactNativeSpec.java +37 -0
- package/android/generated/jni/CMakeLists.txt +49 -0
- package/android/generated/jni/RNEmbedReactNativeSpec-generated.cpp +32 -0
- package/android/generated/jni/RNEmbedReactNativeSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI.h +67 -0
- package/android/gradle.properties +5 -5
- package/cpp/revrag-ai-embed-react-native.cpp +7 -0
- package/cpp/revrag-ai-embed-react-native.h +8 -0
- package/ios/EmbedReactNative.h +9 -0
- package/ios/{Onwid.mm → EmbedReactNative.mm} +4 -4
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec-generated.mm +29 -0
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec.h +50 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI.h +67 -0
- package/lib/commonjs/NativeEmbedReactNative.js +9 -0
- package/{dist/commonjs/onwidApi → lib/commonjs/api}/api.js +86 -15
- package/lib/commonjs/api/types/embed.api.types.js +2 -0
- package/{dist/module/component/audiowave.js → lib/commonjs/components/Embed/EmbedAudioWave.js} +21 -17
- package/{dist/module/component/OnwidButton.js → lib/commonjs/components/Embed/EmbedButton.js} +65 -61
- package/{dist/module/component/voice.js → lib/commonjs/components/Embed/EmbedVoice.js} +18 -14
- package/{dist/commonjs/style/onwidButton.style.js → lib/commonjs/components/styles/EmbedButton.style.js} +14 -9
- package/{dist/module/Event/onwid.js → lib/commonjs/events/embed.event.js} +14 -10
- package/{dist → lib}/commonjs/hooks/initialize.js +22 -22
- package/{dist/commonjs/hooks/initializelivekit.js → lib/commonjs/hooks/initialize.livekit.js} +8 -5
- package/lib/commonjs/hooks/types/voiceAgent.types.js +6 -0
- package/{dist/module/hooks/voiceAgent.js → lib/commonjs/hooks/voiceagent.js} +36 -31
- package/lib/commonjs/index.js +34 -0
- package/{dist/module/index.d.js → lib/commonjs/index.types.js} +7 -7
- package/lib/commonjs/store/store.key.js +46 -0
- package/{dist/module/utils/reanimatedHelpers.js → lib/commonjs/utils/reanimated.helper.js} +23 -17
- package/lib/module/NativeEmbedReactNative.js +5 -0
- package/{dist/module/onwidApi → lib/module/api}/api.js +69 -6
- package/lib/module/api/types/embed.api.types.js +2 -0
- package/{dist/commonjs/component/audiowave.js → lib/module/components/Embed/EmbedAudioWave.js} +2 -3
- package/{dist/commonjs/component/OnwidButton.js → lib/module/components/Embed/EmbedButton.js} +10 -11
- package/{dist/commonjs/component/voice.js → lib/module/components/Embed/EmbedVoice.js} +1 -1
- package/{dist/module/style/onwidButton.style.js → lib/module/components/styles/EmbedButton.style.js} +3 -3
- package/{dist/commonjs/Event/onwid.js → lib/module/events/embed.event.js} +6 -6
- package/{dist → lib}/module/hooks/initialize.js +7 -13
- package/{dist/module/hooks/initializelivekit.js → lib/module/hooks/initialize.livekit.js} +1 -1
- package/{dist/commonjs/hooks/voiceAgent.js → lib/module/hooks/voiceagent.js} +4 -4
- package/lib/module/index.js +7 -0
- package/{dist/commonjs/index.d.js → lib/module/index.types.js} +2 -1
- package/{dist/commonjs/utils/reanimatedHelpers.js → lib/module/utils/reanimated.helper.js} +14 -14
- package/lib/typescript/module/package.json +1 -0
- package/package.json +71 -35
- package/react-native.config.js +8 -14
- package/revrag-ai-embed-react-native.podspec +41 -0
- package/Onwid.podspec +0 -20
- package/dist/commonjs/NativeOnwid.js +0 -5
- package/dist/commonjs/button.json +0 -1
- package/dist/commonjs/index.js +0 -34
- package/dist/commonjs/onwidApi/api.types.js +0 -2
- package/dist/commonjs/utils/utils.js +0 -2
- package/dist/module/NativeOnwid.js +0 -5
- package/dist/module/button.json +0 -1
- package/dist/module/hooks/voiceAgent.types.js +0 -4
- package/dist/module/index.js +0 -34
- package/dist/module/onwidApi/api.types.js +0 -2
- package/dist/module/store.key.js +0 -38
- package/dist/module/utils/utils.js +0 -2
- package/dist/typescript/Event/onwid.d.ts +0 -14
- package/dist/typescript/NativeOnwid.d.ts +0 -7
- package/dist/typescript/component/OnwidButton.d.ts +0 -29
- package/dist/typescript/component/audiowave.d.ts +0 -7
- package/dist/typescript/component/voice.d.ts +0 -16
- package/dist/typescript/hooks/initialize.d.ts +0 -3
- package/dist/typescript/hooks/initialize.types.d.ts +0 -6
- package/dist/typescript/hooks/initializelivekit.d.ts +0 -4
- package/dist/typescript/hooks/voiceAgent.d.ts +0 -3
- package/dist/typescript/hooks/voiceAgent.types.d.ts +0 -17
- package/dist/typescript/index.d.ts +0 -27
- package/dist/typescript/onwidApi/api.d.ts +0 -54
- package/dist/typescript/onwidApi/api.types.d.ts +0 -22
- package/dist/typescript/store.key.d.ts +0 -4
- package/dist/typescript/style/onwidButton.style.d.ts +0 -99
- package/dist/typescript/utils/reanimatedHelpers.d.ts +0 -30
- package/dist/typescript/utils/utils.d.ts +0 -1
- package/ios/Onwid.h +0 -5
- package/scripts/verify-setup.js +0 -90
- /package/{dist/commonjs/hooks → lib/commonjs/hooks/types}/initialize.types.js +0 -0
- /package/{dist/module/hooks → lib/module/hooks/types}/initialize.types.js +0 -0
- /package/{dist/commonjs/hooks → lib/module/hooks/types}/voiceAgent.types.js +0 -0
- /package/{dist/commonjs → lib/module/store}/store.key.js +0 -0
- /package/{dist → lib/typescript}/commonjs/package.json +0 -0
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkReanimatedSetup = checkReanimatedSetup;
|
|
7
|
+
exports.getReanimatedAPI = getReanimatedAPI;
|
|
8
|
+
exports.showReanimatedSetupError = showReanimatedSetupError;
|
|
3
9
|
/**
|
|
4
10
|
* @file reanimatedHelpers.ts
|
|
5
11
|
* @description Utility functions to handle react-native-reanimated configuration and provide fallbacks
|
|
@@ -10,7 +16,7 @@ let reanimatedAPI;
|
|
|
10
16
|
/**
|
|
11
17
|
* Safely loads react-native-reanimated and provides fallbacks if not available
|
|
12
18
|
*/
|
|
13
|
-
|
|
19
|
+
function getReanimatedAPI() {
|
|
14
20
|
if (reanimatedAPI) {
|
|
15
21
|
return reanimatedAPI;
|
|
16
22
|
}
|
|
@@ -67,7 +73,7 @@ export function getReanimatedAPI() {
|
|
|
67
73
|
/**
|
|
68
74
|
* Check if react-native-reanimated is properly configured
|
|
69
75
|
*/
|
|
70
|
-
|
|
76
|
+
function checkReanimatedSetup() {
|
|
71
77
|
const api = getReanimatedAPI();
|
|
72
78
|
return api.isAvailable;
|
|
73
79
|
}
|
|
@@ -75,20 +81,20 @@ export function checkReanimatedSetup() {
|
|
|
75
81
|
/**
|
|
76
82
|
* Display a helpful error message if reanimated is not configured
|
|
77
83
|
*/
|
|
78
|
-
|
|
84
|
+
function showReanimatedSetupError() {
|
|
79
85
|
console.error(`
|
|
80
|
-
🚨 React Native Reanimated Setup Required
|
|
81
|
-
|
|
82
|
-
The OnwidButton component requires react-native-reanimated to be properly installed and configured.
|
|
83
|
-
|
|
84
|
-
Quick Fix:
|
|
85
|
-
1. Install: npm install react-native-reanimated
|
|
86
|
-
2. Add to babel.config.js:
|
|
87
|
-
|
|
88
|
-
3. Rebuild your app
|
|
89
|
-
|
|
90
|
-
For detailed setup instructions, visit:
|
|
91
|
-
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
92
|
-
|
|
86
|
+
🚨 React Native Reanimated Setup Required
|
|
87
|
+
|
|
88
|
+
The OnwidButton component requires react-native-reanimated to be properly installed and configured.
|
|
89
|
+
|
|
90
|
+
Quick Fix:
|
|
91
|
+
1. Install: npm install react-native-reanimated
|
|
92
|
+
2. Add to babel.config.js:
|
|
93
|
+
plugins: ['react-native-reanimated/plugin']
|
|
94
|
+
3. Rebuild your app
|
|
95
|
+
|
|
96
|
+
For detailed setup instructions, visit:
|
|
97
|
+
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
98
|
+
`);
|
|
93
99
|
}
|
|
94
|
-
//# sourceMappingURL=
|
|
100
|
+
//# sourceMappingURL=reanimated.helper.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { getAgentData, setAgentData } from
|
|
3
|
+
import { getAgentData, setAgentData } from "../store/store.key.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* APIService class that ensures proper initialization before API calls
|
|
@@ -30,8 +30,8 @@ export class APIService {
|
|
|
30
30
|
}
|
|
31
31
|
const AgentData = await getAgentData();
|
|
32
32
|
console.log('AgentData', AgentData);
|
|
33
|
-
if (AgentData?.
|
|
34
|
-
this.apiBaseUrl = AgentData.
|
|
33
|
+
if (AgentData?.embedUrl) {
|
|
34
|
+
this.apiBaseUrl = AgentData.embedUrl;
|
|
35
35
|
this.isInitialized = true;
|
|
36
36
|
console.log('API_BASE_URL initialized:', this.apiBaseUrl);
|
|
37
37
|
} else {
|
|
@@ -89,9 +89,30 @@ export class APIService {
|
|
|
89
89
|
};
|
|
90
90
|
} catch (error) {
|
|
91
91
|
console.log('registerOnInitialize error', error);
|
|
92
|
+
|
|
93
|
+
// Enhanced error handling for common iOS network issues
|
|
94
|
+
let errorMessage = 'Unknown error occurred';
|
|
95
|
+
if (error instanceof Error) {
|
|
96
|
+
errorMessage = error.message;
|
|
97
|
+
|
|
98
|
+
// iOS ATS related errors
|
|
99
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
100
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Network connectivity errors
|
|
104
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
105
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Timeout errors
|
|
109
|
+
if (error.message.includes('timeout')) {
|
|
110
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
return {
|
|
93
114
|
success: false,
|
|
94
|
-
error:
|
|
115
|
+
error: errorMessage
|
|
95
116
|
};
|
|
96
117
|
}
|
|
97
118
|
}
|
|
@@ -124,9 +145,30 @@ export class APIService {
|
|
|
124
145
|
};
|
|
125
146
|
} catch (error) {
|
|
126
147
|
console.log('updateUserData error', error);
|
|
148
|
+
|
|
149
|
+
// Enhanced error handling for common iOS network issues
|
|
150
|
+
let errorMessage = 'Unknown error occurred';
|
|
151
|
+
if (error instanceof Error) {
|
|
152
|
+
errorMessage = error.message;
|
|
153
|
+
|
|
154
|
+
// iOS ATS related errors
|
|
155
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
156
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Network connectivity errors
|
|
160
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
161
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Timeout errors
|
|
165
|
+
if (error.message.includes('timeout')) {
|
|
166
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
127
169
|
return {
|
|
128
170
|
success: false,
|
|
129
|
-
error:
|
|
171
|
+
error: errorMessage
|
|
130
172
|
};
|
|
131
173
|
}
|
|
132
174
|
}
|
|
@@ -157,9 +199,30 @@ export class APIService {
|
|
|
157
199
|
};
|
|
158
200
|
} catch (error) {
|
|
159
201
|
console.log('getTokenDetails error', error);
|
|
202
|
+
|
|
203
|
+
// Enhanced error handling for common iOS network issues
|
|
204
|
+
let errorMessage = 'Unknown error occurred';
|
|
205
|
+
if (error instanceof Error) {
|
|
206
|
+
errorMessage = error.message;
|
|
207
|
+
|
|
208
|
+
// iOS ATS related errors
|
|
209
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
210
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Network connectivity errors
|
|
214
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
215
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Timeout errors
|
|
219
|
+
if (error.message.includes('timeout')) {
|
|
220
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
160
223
|
return {
|
|
161
224
|
success: false,
|
|
162
|
-
error:
|
|
225
|
+
error: errorMessage
|
|
163
226
|
};
|
|
164
227
|
}
|
|
165
228
|
}
|
package/{dist/commonjs/component/audiowave.js → lib/module/components/Embed/EmbedAudioWave.js}
RENAMED
|
@@ -102,8 +102,7 @@ export const WaveformVisualizer = ({
|
|
|
102
102
|
}) => {
|
|
103
103
|
const {
|
|
104
104
|
animatedBars,
|
|
105
|
-
currentHeights
|
|
106
|
-
isActive
|
|
105
|
+
currentHeights
|
|
107
106
|
} = useReactNativeAudioWaveform(roomRef);
|
|
108
107
|
console.log('animatedBars', animatedBars);
|
|
109
108
|
return /*#__PURE__*/_jsx(View, {
|
|
@@ -150,4 +149,4 @@ export const WaveformVisualizer = ({
|
|
|
150
149
|
})
|
|
151
150
|
});
|
|
152
151
|
};
|
|
153
|
-
//# sourceMappingURL=
|
|
152
|
+
//# sourceMappingURL=EmbedAudioWave.js.map
|
package/{dist/commonjs/component/OnwidButton.js → lib/module/components/Embed/EmbedButton.js}
RENAMED
|
@@ -11,12 +11,12 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
11
11
|
import { Dimensions, Image, Text, TouchableOpacity, View } from 'react-native';
|
|
12
12
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
13
13
|
import LinearGradient from 'react-native-linear-gradient';
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import { WaveformVisualizer } from
|
|
14
|
+
import { useVoiceAgent } from "../../hooks/voiceagent.js";
|
|
15
|
+
import { getAgentData } from "../../store/store.key.js";
|
|
16
|
+
import { createEmbedButtonStyles } from "../styles/EmbedButton.style.js";
|
|
17
|
+
import { getReanimatedAPI, showReanimatedSetupError } from "../../utils/reanimated.helper.js";
|
|
18
|
+
import Voice from "./EmbedVoice.js";
|
|
19
|
+
import { WaveformVisualizer } from "./EmbedAudioWave.js";
|
|
20
20
|
|
|
21
21
|
// Get reanimated API with fallbacks
|
|
22
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -90,7 +90,7 @@ const defaultStyles = {
|
|
|
90
90
|
* />
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export function
|
|
93
|
+
export function EmbedButton() {
|
|
94
94
|
const {
|
|
95
95
|
initializeVoiceAgent,
|
|
96
96
|
tokenDetails,
|
|
@@ -108,7 +108,6 @@ export function OnwidButton() {
|
|
|
108
108
|
const [callDuration, setCallDuration] = useState(0);
|
|
109
109
|
const timerRef = useRef(null);
|
|
110
110
|
const lottieRef = useRef(null);
|
|
111
|
-
console.log('roomRef', roomRef.current?.localParticipant);
|
|
112
111
|
|
|
113
112
|
// Animation values
|
|
114
113
|
const isPressed = useSharedValue(false);
|
|
@@ -124,7 +123,7 @@ export function OnwidButton() {
|
|
|
124
123
|
const buttonWidth = useSharedValue(BUTTON_WIDTH);
|
|
125
124
|
const buttonScale = useSharedValue(1);
|
|
126
125
|
// Styles
|
|
127
|
-
const styles =
|
|
126
|
+
const styles = createEmbedButtonStyles(defaultStyles);
|
|
128
127
|
const [isAutoOpen, setIsAutoOpen] = useState(false);
|
|
129
128
|
useEffect(() => {
|
|
130
129
|
const autoOpenTimer = setTimeout(() => {
|
|
@@ -503,5 +502,5 @@ export function OnwidButton() {
|
|
|
503
502
|
}
|
|
504
503
|
|
|
505
504
|
// Export default for easier imports
|
|
506
|
-
export default
|
|
507
|
-
//# sourceMappingURL=
|
|
505
|
+
export default EmbedButton;
|
|
506
|
+
//# sourceMappingURL=EmbedButton.js.map
|
package/{dist/module/style/onwidButton.style.js → lib/module/components/styles/EmbedButton.style.js}
RENAMED
|
@@ -29,7 +29,7 @@ const dimensions = calculateDimensions();
|
|
|
29
29
|
export const BUTTON_WIDTH = dimensions.BUTTON_WIDTH;
|
|
30
30
|
export const EXPANDED_WIDTH = dimensions.EXPANDED_WIDTH;
|
|
31
31
|
export const BUTTON_HEIGHT = dimensions.BUTTON_HEIGHT;
|
|
32
|
-
export const
|
|
32
|
+
export const createEmbedButtonStyles = customStyles => {
|
|
33
33
|
const {
|
|
34
34
|
buttonWidth = BUTTON_WIDTH,
|
|
35
35
|
buttonHeight = BUTTON_HEIGHT,
|
|
@@ -239,5 +239,5 @@ export const createOnwidButtonStyles = customStyles => {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
// Default styles export with dynamic dimensions
|
|
242
|
-
export const onwidButtonStyles =
|
|
243
|
-
//# sourceMappingURL=
|
|
242
|
+
export const onwidButtonStyles = createEmbedButtonStyles();
|
|
243
|
+
//# sourceMappingURL=EmbedButton.style.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { getAgentData, setAgentData } from
|
|
4
|
-
import { APIService } from
|
|
3
|
+
import { getAgentData, setAgentData } from "../store/store.key.js";
|
|
4
|
+
import { APIService } from "../api/api.js";
|
|
5
5
|
// Predefined event keys
|
|
6
6
|
export let EventKeys = /*#__PURE__*/function (EventKeys) {
|
|
7
7
|
EventKeys["USER_DATA"] = "user_data";
|
|
8
8
|
EventKeys["SCREEN_STATE"] = "state_data";
|
|
9
9
|
return EventKeys;
|
|
10
10
|
}({});
|
|
11
|
-
class
|
|
11
|
+
class Embed {
|
|
12
12
|
events = {};
|
|
13
13
|
|
|
14
14
|
// Automatically adds a default listener if none exists
|
|
@@ -65,6 +65,6 @@ class OnWid {
|
|
|
65
65
|
this.events[eventKey]?.push(callback);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
export default
|
|
70
|
-
//# sourceMappingURL=
|
|
68
|
+
const embed = new Embed();
|
|
69
|
+
export default embed;
|
|
70
|
+
//# sourceMappingURL=embed.event.js.map
|
|
@@ -5,22 +5,19 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Required Parameters:
|
|
7
7
|
* - apiKey: string - Unique identifier for the user
|
|
8
|
-
* - deviceId: string - Unique identifier for the device
|
|
9
|
-
* - metadata: object - Additional device/user information
|
|
10
8
|
*
|
|
11
9
|
* The initialization process:
|
|
12
10
|
* 1. Validates required input parameters
|
|
13
11
|
* 2. Stores API key securely in keychain
|
|
14
12
|
* 3. Registers the device with provided details
|
|
15
13
|
*/
|
|
16
|
-
import { setAgentData } from
|
|
17
|
-
import { APIService } from
|
|
18
|
-
import registerAgent from
|
|
14
|
+
import { setAgentData } from "../store/store.key.js";
|
|
15
|
+
import { APIService } from "../api/api.js";
|
|
16
|
+
import registerAgent from "./initialize.livekit.js";
|
|
19
17
|
import { PermissionsAndroid, Platform } from 'react-native';
|
|
20
18
|
export function useInitialize({
|
|
21
19
|
apiKey,
|
|
22
|
-
|
|
23
|
-
metadata
|
|
20
|
+
embedUrl
|
|
24
21
|
}) {
|
|
25
22
|
const checkPermissions = async () => {
|
|
26
23
|
try {
|
|
@@ -51,11 +48,8 @@ export function useInitialize({
|
|
|
51
48
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
52
49
|
throw new Error('apiKey is required and must be a string');
|
|
53
50
|
}
|
|
54
|
-
if (!
|
|
55
|
-
throw new Error('
|
|
56
|
-
}
|
|
57
|
-
if (metadata && typeof metadata === 'object' && !metadata.config) {
|
|
58
|
-
throw new Error('metadata must contain a config object');
|
|
51
|
+
if (!embedUrl || typeof embedUrl !== 'string') {
|
|
52
|
+
throw new Error('embedUrl is required and must be a string');
|
|
59
53
|
}
|
|
60
54
|
};
|
|
61
55
|
const initialize = async () => {
|
|
@@ -69,7 +63,7 @@ export function useInitialize({
|
|
|
69
63
|
// Store API key in keychain
|
|
70
64
|
await setAgentData({
|
|
71
65
|
apiKey,
|
|
72
|
-
|
|
66
|
+
embedUrl
|
|
73
67
|
});
|
|
74
68
|
|
|
75
69
|
// Get the APIService instance and initialize it
|
|
@@ -14,4 +14,4 @@ import { registerGlobals } from '@livekit/react-native';
|
|
|
14
14
|
// which is used to set up global configurations for the LiveKit service.
|
|
15
15
|
const registerAgent = registerGlobals;
|
|
16
16
|
export default registerAgent;
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=initialize.livekit.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { ConnectionState, Room } from 'livekit-client';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
|
-
import { EventKeys } from
|
|
6
|
-
import { APIService } from
|
|
7
|
-
import { getAgentData } from
|
|
5
|
+
import { EventKeys } from "../events/embed.event.js";
|
|
6
|
+
import { APIService } from "../api/api.js";
|
|
7
|
+
import { getAgentData } from "../store/store.key.js";
|
|
8
8
|
// Create a singleton instance of Room that persists across hook instances
|
|
9
9
|
// This ensures we don't create multiple Room instances that could conflict
|
|
10
10
|
let roomInstance = null;
|
|
@@ -350,4 +350,4 @@ export const useVoiceAgent = () => {
|
|
|
350
350
|
cleanup
|
|
351
351
|
};
|
|
352
352
|
};
|
|
353
|
-
//# sourceMappingURL=
|
|
353
|
+
//# sourceMappingURL=voiceagent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { EmbedButton } from "./components/Embed/EmbedButton.js";
|
|
4
|
+
import { useInitialize } from "./hooks/initialize.js";
|
|
5
|
+
import Embed, { EventKeys } from "./events/embed.event.js";
|
|
6
|
+
export { EmbedButton, useInitialize, Embed, EventKeys as EmbedEventKeys };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable */
|
|
3
4
|
/**
|
|
4
5
|
* @file index.d.ts
|
|
5
6
|
* @description TypeScript declarations for the Onwid React Native library.
|
|
@@ -19,4 +20,4 @@ export let EventKeys = /*#__PURE__*/function (EventKeys) {
|
|
|
19
20
|
EventKeys["SCREEN_STATE"] = "state_data";
|
|
20
21
|
return EventKeys;
|
|
21
22
|
}({});
|
|
22
|
-
//# sourceMappingURL=index.
|
|
23
|
+
//# sourceMappingURL=index.types.js.map
|
|
@@ -77,18 +77,18 @@ export function checkReanimatedSetup() {
|
|
|
77
77
|
*/
|
|
78
78
|
export function showReanimatedSetupError() {
|
|
79
79
|
console.error(`
|
|
80
|
-
🚨 React Native Reanimated Setup Required
|
|
81
|
-
|
|
82
|
-
The OnwidButton component requires react-native-reanimated to be properly installed and configured.
|
|
83
|
-
|
|
84
|
-
Quick Fix:
|
|
85
|
-
1. Install: npm install react-native-reanimated
|
|
86
|
-
2. Add to babel.config.js:
|
|
87
|
-
|
|
88
|
-
3. Rebuild your app
|
|
89
|
-
|
|
90
|
-
For detailed setup instructions, visit:
|
|
91
|
-
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
92
|
-
|
|
80
|
+
🚨 React Native Reanimated Setup Required
|
|
81
|
+
|
|
82
|
+
The OnwidButton component requires react-native-reanimated to be properly installed and configured.
|
|
83
|
+
|
|
84
|
+
Quick Fix:
|
|
85
|
+
1. Install: npm install react-native-reanimated
|
|
86
|
+
2. Add to babel.config.js:
|
|
87
|
+
plugins: ['react-native-reanimated/plugin']
|
|
88
|
+
3. Rebuild your app
|
|
89
|
+
|
|
90
|
+
For detailed setup instructions, visit:
|
|
91
|
+
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
92
|
+
`);
|
|
93
93
|
}
|
|
94
|
-
//# sourceMappingURL=
|
|
94
|
+
//# sourceMappingURL=reanimated.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revrag-ai/embed-react-native",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"source": "./src/index.tsx",
|
|
5
|
+
"description": "A powerful React Native library for integrating AI-powered voice agents into mobile applications. Features real-time voice communication, intelligent speech processing, customizable UI components, and comprehensive event handling for building conversational AI experiences.",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
8
9
|
"typesVersions": {
|
|
9
10
|
"*": {
|
|
10
|
-
"*": [
|
|
11
|
+
"*": [
|
|
12
|
+
"./lib/typescript/commonjs/src/*"
|
|
13
|
+
]
|
|
11
14
|
}
|
|
12
15
|
},
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
15
|
-
"types": "./
|
|
16
|
-
"import": "./
|
|
17
|
-
"require": "./
|
|
18
|
-
"default": "./
|
|
18
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
19
|
+
"import": "./lib/module/index.js",
|
|
20
|
+
"require": "./lib/commonjs/index.js",
|
|
21
|
+
"default": "./lib/module/index.js"
|
|
19
22
|
},
|
|
20
23
|
"./package.json": "./package.json"
|
|
21
24
|
},
|
|
22
25
|
"files": [
|
|
23
|
-
"
|
|
26
|
+
"lib",
|
|
24
27
|
"android",
|
|
25
28
|
"ios",
|
|
26
29
|
"cpp",
|
|
@@ -28,9 +31,9 @@
|
|
|
28
31
|
"scripts",
|
|
29
32
|
"*.podspec",
|
|
30
33
|
"react-native.config.js",
|
|
31
|
-
"!
|
|
32
|
-
"!
|
|
33
|
-
"!
|
|
34
|
+
"!lib/**/*.map",
|
|
35
|
+
"!lib/**/*.test.*",
|
|
36
|
+
"!lib/**/*.spec.*",
|
|
34
37
|
"!ios/build",
|
|
35
38
|
"!android/build",
|
|
36
39
|
"!android/gradle",
|
|
@@ -48,17 +51,20 @@
|
|
|
48
51
|
"test": "jest",
|
|
49
52
|
"typecheck": "tsc",
|
|
50
53
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
51
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build
|
|
54
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
52
55
|
"prepare": "bob build",
|
|
53
56
|
"build": "bob build",
|
|
54
57
|
"fix-js": "node fix-js-files.js",
|
|
55
58
|
"verify-setup": "node scripts/verify-setup.js",
|
|
59
|
+
"debug-network": "node scripts/debug-network.js",
|
|
56
60
|
"prepublishOnly": "bob build && yarn fix-js",
|
|
57
61
|
"release": "release-it --only-version",
|
|
58
62
|
"protect": "node -e \"const crypto = require('crypto'); const fs = require('fs'); const config = { hash: crypto.randomBytes(32).toString('hex'), createdAt: new Date().toISOString(), note: 'Protected build', version: require('./package.json').version }; fs.writeFileSync('.onwid-security.json', JSON.stringify(config, null, 2)); console.log('✅ Code protected');\"",
|
|
59
63
|
"publish:safe": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public",
|
|
60
64
|
"publish:beta": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public --tag beta",
|
|
61
|
-
"publish:alpha": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public --tag alpha"
|
|
65
|
+
"publish:alpha": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public --tag alpha",
|
|
66
|
+
"docs:check": "echo '📚 Documentation files:' && ls -la *.md && echo '✅ Documentation is up to date'",
|
|
67
|
+
"docs:validate": "echo '🔍 Validating documentation...' && node -e \"const fs = require('fs'); const files = ['README.md', 'API.md', 'EXAMPLES.md']; files.forEach(f => { if (!fs.existsSync(f)) throw new Error('Missing: ' + f); }); console.log('✅ All documentation files present');\""
|
|
62
68
|
},
|
|
63
69
|
"keywords": [
|
|
64
70
|
"react-native",
|
|
@@ -75,17 +81,16 @@
|
|
|
75
81
|
],
|
|
76
82
|
"repository": {
|
|
77
83
|
"type": "git",
|
|
78
|
-
"url": "git+https://github.com/RevRag-ai/
|
|
84
|
+
"url": "git+https://github.com/orgs/RevRag-ai/dashboard.git"
|
|
79
85
|
},
|
|
80
|
-
"author": "
|
|
86
|
+
"author": "RevragAi <contact@revrag.ai> (https://www.revrag.ai)",
|
|
81
87
|
"license": "MIT",
|
|
82
88
|
"bugs": {
|
|
83
|
-
"url": "https://github.com/RevRag-ai/
|
|
89
|
+
"url": "https://github.com/orgs/RevRag-ai/dashboard/issues"
|
|
84
90
|
},
|
|
85
|
-
"homepage": "https://github.com/RevRag-ai/
|
|
91
|
+
"homepage": "https://github.com/orgs/RevRag-ai/dashboard#readme",
|
|
86
92
|
"publishConfig": {
|
|
87
|
-
"registry": "https://registry.npmjs.org/"
|
|
88
|
-
"access": "public"
|
|
93
|
+
"registry": "https://registry.npmjs.org/"
|
|
89
94
|
},
|
|
90
95
|
"devDependencies": {
|
|
91
96
|
"@babel/core": "^7.20.0",
|
|
@@ -118,6 +123,9 @@
|
|
|
118
123
|
"release-it": "^15.0.0",
|
|
119
124
|
"typescript": "^5.2.2"
|
|
120
125
|
},
|
|
126
|
+
"resolutions": {
|
|
127
|
+
"@types/react": "^18.2.44"
|
|
128
|
+
},
|
|
121
129
|
"peerDependencies": {
|
|
122
130
|
"@livekit/react-native": "*",
|
|
123
131
|
"@livekit/react-native-webrtc": "*",
|
|
@@ -138,7 +146,7 @@
|
|
|
138
146
|
"preset": "react-native",
|
|
139
147
|
"modulePathIgnorePatterns": [
|
|
140
148
|
"<rootDir>/example/node_modules",
|
|
141
|
-
"<rootDir>/
|
|
149
|
+
"<rootDir>/lib/"
|
|
142
150
|
]
|
|
143
151
|
},
|
|
144
152
|
"commitlint": {
|
|
@@ -159,12 +167,34 @@
|
|
|
159
167
|
},
|
|
160
168
|
"plugins": {
|
|
161
169
|
"@release-it/conventional-changelog": {
|
|
162
|
-
"preset":
|
|
163
|
-
"name": "angular"
|
|
164
|
-
}
|
|
170
|
+
"preset": "angular"
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
},
|
|
174
|
+
"eslintConfig": {
|
|
175
|
+
"root": true,
|
|
176
|
+
"extends": [
|
|
177
|
+
"@react-native",
|
|
178
|
+
"prettier"
|
|
179
|
+
],
|
|
180
|
+
"rules": {
|
|
181
|
+
"react/react-in-jsx-scope": "off",
|
|
182
|
+
"prettier/prettier": [
|
|
183
|
+
"error",
|
|
184
|
+
{
|
|
185
|
+
"quoteProps": "consistent",
|
|
186
|
+
"singleQuote": true,
|
|
187
|
+
"tabWidth": 2,
|
|
188
|
+
"trailingComma": "es5",
|
|
189
|
+
"useTabs": false
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"eslintIgnore": [
|
|
195
|
+
"node_modules/",
|
|
196
|
+
"lib/"
|
|
197
|
+
],
|
|
168
198
|
"prettier": {
|
|
169
199
|
"quoteProps": "consistent",
|
|
170
200
|
"singleQuote": true,
|
|
@@ -174,41 +204,47 @@
|
|
|
174
204
|
},
|
|
175
205
|
"react-native-builder-bob": {
|
|
176
206
|
"source": "src",
|
|
177
|
-
"output": "
|
|
207
|
+
"output": "lib",
|
|
178
208
|
"targets": [
|
|
209
|
+
"codegen",
|
|
179
210
|
[
|
|
180
211
|
"commonjs",
|
|
181
212
|
{
|
|
182
|
-
"
|
|
213
|
+
"esm": true
|
|
183
214
|
}
|
|
184
215
|
],
|
|
185
216
|
[
|
|
186
217
|
"module",
|
|
187
218
|
{
|
|
188
|
-
"configFile": true,
|
|
189
219
|
"esm": true
|
|
190
220
|
}
|
|
191
221
|
],
|
|
192
222
|
[
|
|
193
223
|
"typescript",
|
|
194
224
|
{
|
|
195
|
-
"project": "tsconfig.build.json"
|
|
225
|
+
"project": "tsconfig.build.json",
|
|
226
|
+
"esm": true
|
|
196
227
|
}
|
|
197
228
|
]
|
|
198
229
|
]
|
|
199
230
|
},
|
|
200
231
|
"codegenConfig": {
|
|
201
|
-
"name": "
|
|
232
|
+
"name": "RNEmbedReactNativeSpec",
|
|
202
233
|
"type": "modules",
|
|
203
234
|
"jsSrcsDir": "src",
|
|
235
|
+
"outputDir": {
|
|
236
|
+
"ios": "ios/generated",
|
|
237
|
+
"android": "android/generated"
|
|
238
|
+
},
|
|
204
239
|
"android": {
|
|
205
|
-
"javaPackageName": "com.
|
|
206
|
-
}
|
|
240
|
+
"javaPackageName": "com.revragai.embedreactnative"
|
|
241
|
+
},
|
|
242
|
+
"includesGeneratedCode": true
|
|
207
243
|
},
|
|
208
244
|
"create-react-native-library": {
|
|
209
|
-
"languages": "kotlin-objc",
|
|
210
245
|
"type": "turbo-module",
|
|
211
|
-
"
|
|
246
|
+
"languages": "cpp",
|
|
247
|
+
"version": "0.46.0"
|
|
212
248
|
},
|
|
213
249
|
"dependencies": {
|
|
214
250
|
"livekit-client": "^2.13.1"
|