@revrag-ai/embed-react-native 1.0.6 → 1.0.7
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 +13 -382
- 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 +84 -13
- 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 +18 -12
- 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 +67 -4
- 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 +3 -3
- 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 +67 -33
- 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
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 RevragAi
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,402 +1,33 @@
|
|
|
1
1
|
# @revrag-ai/embed-react-native
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
voice agent library
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Installation
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- **Real-time Voice Communication**: High-quality voice chat powered by LiveKit
|
|
11
|
-
- **AI Voice Agent Integration**: Seamless integration with AI voice assistants
|
|
12
|
-
- **Cross-platform Support**: Works on both iOS and Android
|
|
13
|
-
- **TypeScript Support**: Full TypeScript definitions included
|
|
14
|
-
- **Event-driven Architecture**: Flexible event system for custom integrations
|
|
15
|
-
- **Secure API Communication**: Protected API calls with automatic initialization
|
|
16
|
-
- **Easy Integration**: Simple hooks and components for quick setup
|
|
17
|
-
|
|
18
|
-
## 📦 Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
7
|
+
```sh
|
|
21
8
|
npm install @revrag-ai/embed-react-native
|
|
22
|
-
# or
|
|
23
|
-
yarn add @revrag-ai/embed-react-native
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Peer Dependencies
|
|
27
|
-
|
|
28
|
-
Make sure you have the following peer dependencies installed:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install @livekit/react-native @livekit/react-native-webrtc @react-native-async-storage/async-storage lottie-react-native react-native-gesture-handler react-native-linear-gradient react-native-reanimated react-native-safe-area-context
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Important: React Native Reanimated Setup
|
|
35
|
-
|
|
36
|
-
**This library requires `react-native-reanimated` to be properly installed and configured.** If you encounter errors like "Cannot read property 'makeMutable' of undefined", follow these steps:
|
|
37
|
-
|
|
38
|
-
1. **Install react-native-reanimated:**
|
|
39
|
-
```bash
|
|
40
|
-
npm install react-native-reanimated
|
|
41
|
-
# or
|
|
42
|
-
yarn add react-native-reanimated
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. **Add Reanimated's babel plugin to your `babel.config.js`:**
|
|
46
|
-
```javascript
|
|
47
|
-
module.exports = {
|
|
48
|
-
presets: ['module:@react-native/babel-preset'],
|
|
49
|
-
plugins: [
|
|
50
|
-
'react-native-reanimated/plugin',
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
3. **For iOS:** Run `cd ios && pod install`
|
|
56
|
-
|
|
57
|
-
4. **For Android:** Add the following to `android/app/src/main/java/.../MainApplication.java`:
|
|
58
|
-
```java
|
|
59
|
-
import com.swmansion.reanimated.ReanimatedPackage;
|
|
60
|
-
|
|
61
|
-
@Override
|
|
62
|
-
protected List<ReactPackage> getPackages() {
|
|
63
|
-
return Arrays.<ReactPackage>asList(
|
|
64
|
-
new MainReactPackage(),
|
|
65
|
-
new ReanimatedPackage() // Add this line
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
5. **Clean and rebuild your project:**
|
|
71
|
-
```bash
|
|
72
|
-
# For React Native CLI
|
|
73
|
-
npx react-native run-android
|
|
74
|
-
npx react-native run-ios
|
|
75
|
-
|
|
76
|
-
# For Expo (if using)
|
|
77
|
-
expo run:android
|
|
78
|
-
expo run:ios
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
For more detailed instructions, visit: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
82
|
-
|
|
83
|
-
### Setup Verification
|
|
84
|
-
|
|
85
|
-
After installation, you can verify your setup by running:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npx @revrag-ai/embed-react-native verify-setup
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
This will check if all dependencies are properly installed and configured.
|
|
92
|
-
|
|
93
|
-
## 🛠️ Setup
|
|
94
|
-
|
|
95
|
-
### iOS Setup
|
|
96
|
-
|
|
97
|
-
Add the following to your `ios/Podfile`:
|
|
98
|
-
|
|
99
|
-
```ruby
|
|
100
|
-
pod 'RNFS', :path => '../node_modules/react-native-fs'
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Android Setup
|
|
104
|
-
|
|
105
|
-
Add the following permissions to your `android/app/src/main/AndroidManifest.xml`:
|
|
106
|
-
|
|
107
|
-
```xml
|
|
108
|
-
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
109
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
110
|
-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
111
9
|
```
|
|
112
10
|
|
|
113
|
-
##
|
|
114
|
-
|
|
115
|
-
### "Cannot read property 'makeMutable' of undefined"
|
|
116
|
-
|
|
117
|
-
This error occurs when `react-native-reanimated` is not properly installed or configured. Follow these steps:
|
|
118
|
-
|
|
119
|
-
1. **Ensure react-native-reanimated is installed:**
|
|
120
|
-
```bash
|
|
121
|
-
npm list react-native-reanimated
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
2. **Check your babel.config.js includes the reanimated plugin:**
|
|
125
|
-
```javascript
|
|
126
|
-
module.exports = {
|
|
127
|
-
presets: ['module:@react-native/babel-preset'],
|
|
128
|
-
plugins: [
|
|
129
|
-
'react-native-reanimated/plugin', // <- This line is crucial
|
|
130
|
-
],
|
|
131
|
-
};
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
3. **Clear Metro cache and rebuild:**
|
|
135
|
-
```bash
|
|
136
|
-
npx react-native start --reset-cache
|
|
137
|
-
npx react-native run-android # or run-ios
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
4. **For iOS, ensure pods are installed:**
|
|
141
|
-
```bash
|
|
142
|
-
cd ios && pod install && cd ..
|
|
143
|
-
```
|
|
11
|
+
## Usage
|
|
144
12
|
|
|
145
|
-
### Component Not Rendering
|
|
146
13
|
|
|
147
|
-
|
|
14
|
+
```js
|
|
15
|
+
import { multiply } from '@revrag-ai/embed-react-native';
|
|
148
16
|
|
|
149
|
-
|
|
150
|
-
- Check that your app has proper permissions for microphone access
|
|
151
|
-
- Verify your API key and server URL are correct
|
|
17
|
+
// ...
|
|
152
18
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
If voice connection fails:
|
|
156
|
-
|
|
157
|
-
- Check your network connection
|
|
158
|
-
- Verify your API key is valid
|
|
159
|
-
- Ensure microphone permissions are granted
|
|
160
|
-
- Check the console for detailed error messages
|
|
161
|
-
|
|
162
|
-
## 🎯 Quick Start
|
|
163
|
-
|
|
164
|
-
### 1. Initialize the SDK
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
import { useInitialize } from '@revrag-ai/embed-react-native';
|
|
168
|
-
|
|
169
|
-
function App() {
|
|
170
|
-
useInitialize({
|
|
171
|
-
apiKey: 'your-api-key',
|
|
172
|
-
onwidUrl: 'https://your-onwid-server.com',
|
|
173
|
-
metadata: {
|
|
174
|
-
config: {
|
|
175
|
-
// Your configuration
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
// Your app content
|
|
182
|
-
);
|
|
183
|
-
}
|
|
19
|
+
const result = multiply(3, 7);
|
|
184
20
|
```
|
|
185
21
|
|
|
186
|
-
### 2. Use the Voice Agent
|
|
187
|
-
|
|
188
|
-
```tsx
|
|
189
|
-
import { useVoiceAgent } from '@revrag-ai/embed-react-native';
|
|
190
|
-
|
|
191
|
-
function VoiceComponent() {
|
|
192
|
-
const {
|
|
193
|
-
initializeVoiceAgent,
|
|
194
|
-
endCall,
|
|
195
|
-
muteMic,
|
|
196
|
-
unmuteMic,
|
|
197
|
-
isMicMuted,
|
|
198
|
-
connectionState,
|
|
199
|
-
isLoading,
|
|
200
|
-
error
|
|
201
|
-
} = useVoiceAgent();
|
|
202
22
|
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
await initializeVoiceAgent();
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error('Failed to start voice call:', error);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<View>
|
|
213
|
-
<Button title="Start Voice Call" onPress={startVoiceCall} />
|
|
214
|
-
<Button title="End Call" onPress={endCall} />
|
|
215
|
-
<Button
|
|
216
|
-
title={isMicMuted ? "Unmute" : "Mute"}
|
|
217
|
-
onPress={isMicMuted ? unmuteMic : muteMic}
|
|
218
|
-
/>
|
|
219
|
-
<Text>Status: {connectionState}</Text>
|
|
220
|
-
{isLoading && <Text>Loading...</Text>}
|
|
221
|
-
{error && <Text>Error: {error}</Text>}
|
|
222
|
-
</View>
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
```
|
|
23
|
+
## Contributing
|
|
226
24
|
|
|
227
|
-
|
|
25
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
228
26
|
|
|
229
|
-
|
|
230
|
-
import { onwid, EventKeys } from '@revrag-ai/embed-react-native';
|
|
27
|
+
## License
|
|
231
28
|
|
|
232
|
-
|
|
233
|
-
await onwid.Event(EventKeys.USER_DATA, {
|
|
234
|
-
app_user_id: 'user123',
|
|
235
|
-
name: 'John Doe',
|
|
236
|
-
preferences: {
|
|
237
|
-
language: 'en'
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// Send screen state
|
|
242
|
-
await onwid.Event(EventKeys.SCREEN_STATE, {
|
|
243
|
-
screen: 'home',
|
|
244
|
-
timestamp: Date.now()
|
|
245
|
-
});
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### 4. TypeScript Usage
|
|
249
|
-
|
|
250
|
-
For TypeScript projects, you can import types for better type safety:
|
|
251
|
-
|
|
252
|
-
```tsx
|
|
253
|
-
import {
|
|
254
|
-
OnwidButton,
|
|
255
|
-
useInitialize,
|
|
256
|
-
useVoiceAgent,
|
|
257
|
-
type UseInitializeProps,
|
|
258
|
-
type UseVoiceAgentReturn,
|
|
259
|
-
type ApiResponse,
|
|
260
|
-
EventKeys
|
|
261
|
-
} from '@revrag-ai/embed-react-native';
|
|
262
|
-
|
|
263
|
-
// Type-safe initialization
|
|
264
|
-
const initProps: UseInitializeProps = {
|
|
265
|
-
apiKey: 'your-api-key',
|
|
266
|
-
onwidUrl: 'https://your-onwid-server.com',
|
|
267
|
-
metadata: {
|
|
268
|
-
config: {
|
|
269
|
-
theme: 'dark'
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
function MyVoiceComponent() {
|
|
275
|
-
useInitialize(initProps);
|
|
276
|
-
|
|
277
|
-
const voiceAgent: UseVoiceAgentReturn = useVoiceAgent();
|
|
278
|
-
|
|
279
|
-
const handleStartCall = async (): Promise<void> => {
|
|
280
|
-
try {
|
|
281
|
-
await voiceAgent.initializeVoiceAgent();
|
|
282
|
-
} catch (error) {
|
|
283
|
-
console.error('Failed to start call:', error);
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
return (
|
|
288
|
-
<View>
|
|
289
|
-
<OnwidButton />
|
|
290
|
-
<Button title="Start Call" onPress={handleStartCall} />
|
|
291
|
-
</View>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### 5. Use the OnWid Button Component
|
|
297
|
-
|
|
298
|
-
```tsx
|
|
299
|
-
import { OnwidButton } from '@revrag-ai/embed-react-native';
|
|
300
|
-
|
|
301
|
-
function MyComponent() {
|
|
302
|
-
return (
|
|
303
|
-
<View>
|
|
304
|
-
<OnwidButton />
|
|
305
|
-
</View>
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## 📚 API Reference
|
|
311
|
-
|
|
312
|
-
### Hooks
|
|
313
|
-
|
|
314
|
-
#### `useInitialize(props: UseInitializeProps)`
|
|
315
|
-
|
|
316
|
-
Initializes the OnWid SDK with your configuration.
|
|
317
|
-
|
|
318
|
-
**Props:**
|
|
319
|
-
- `apiKey: string` - Your OnWid API key
|
|
320
|
-
- `onwidUrl: string` - Your OnWid server URL
|
|
321
|
-
- `metadata?: object` - Optional metadata configuration
|
|
322
|
-
|
|
323
|
-
#### `useVoiceAgent(): UseVoiceAgentReturn`
|
|
324
|
-
|
|
325
|
-
Provides voice agent functionality.
|
|
326
|
-
|
|
327
|
-
**Returns:**
|
|
328
|
-
- `initializeVoiceAgent: () => Promise<void>` - Start voice agent
|
|
329
|
-
- `endCall: () => Promise<void>` - End the voice call
|
|
330
|
-
- `muteMic: () => void` - Mute microphone
|
|
331
|
-
- `unmuteMic: () => void` - Unmute microphone
|
|
332
|
-
- `isMicMuted: boolean` - Microphone mute state
|
|
333
|
-
- `connectionState: ConnectionState` - Current connection state
|
|
334
|
-
- `isLoading: boolean` - Loading state
|
|
335
|
-
- `error: string | null` - Error message if any
|
|
336
|
-
|
|
337
|
-
### Components
|
|
338
|
-
|
|
339
|
-
#### `OnwidButton`
|
|
340
|
-
|
|
341
|
-
A customizable button component with built-in voice agent functionality.
|
|
342
|
-
|
|
343
|
-
### Classes
|
|
344
|
-
|
|
345
|
-
#### `APIService`
|
|
346
|
-
|
|
347
|
-
Singleton service for API communication.
|
|
348
|
-
|
|
349
|
-
```tsx
|
|
350
|
-
import { APIService } from '@revrag-ai/embed-react-native';
|
|
351
|
-
|
|
352
|
-
const apiService = APIService.getInstance();
|
|
353
|
-
await apiService.initialize();
|
|
354
|
-
```
|
|
355
|
-
### Events
|
|
356
|
-
|
|
357
|
-
#### `EventKeys`
|
|
358
|
-
|
|
359
|
-
Available event types:
|
|
360
|
-
- `USER_DATA` - User information events
|
|
361
|
-
- `SCREEN_STATE` - Screen state events
|
|
362
|
-
|
|
363
|
-
## 🔒 Security
|
|
364
|
-
|
|
365
|
-
The OnWid SDK includes built-in security features:
|
|
366
|
-
|
|
367
|
-
- Automatic API key management
|
|
368
|
-
- Secure token handling
|
|
369
|
-
- Protected API endpoints
|
|
370
|
-
- Integrity checks
|
|
371
|
-
|
|
372
|
-
## 🤝 Contributing
|
|
373
|
-
|
|
374
|
-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
375
|
-
|
|
376
|
-
## 📄 License
|
|
377
|
-
|
|
378
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
379
|
-
|
|
380
|
-
## 🆘 Support
|
|
381
|
-
|
|
382
|
-
- 📧 Email: contact@revrag.ai
|
|
383
|
-
- 🐛 Issues: [GitHub Issues](https://github.com/RevRag-ai/embed-react-native/issues)
|
|
384
|
-
- 📖 Documentation: [Integration Guide](INTEGRATION_GUIDE.md)
|
|
385
|
-
|
|
386
|
-
## 🏷️ Version History
|
|
387
|
-
|
|
388
|
-
### 1.0.3
|
|
389
|
-
- Enhanced APIService with singleton pattern
|
|
390
|
-
- Improved error handling and initialization
|
|
391
|
-
- Better TypeScript support
|
|
392
|
-
- Fixed voice component compatibility
|
|
393
|
-
|
|
394
|
-
### 1.0.2
|
|
395
|
-
- Initial stable release
|
|
396
|
-
- Core voice agent functionality
|
|
397
|
-
- Event system implementation
|
|
29
|
+
MIT
|
|
398
30
|
|
|
399
31
|
---
|
|
400
32
|
|
|
401
|
-
Made with
|
|
402
|
-
|
|
33
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.4.1)
|
|
2
|
+
project(EmbedReactNative)
|
|
3
|
+
|
|
4
|
+
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
|
+
set (CMAKE_CXX_STANDARD 14)
|
|
6
|
+
|
|
7
|
+
add_library(revrag-ai-embed-react-native SHARED
|
|
8
|
+
../cpp/revrag-ai-embed-react-native.cpp
|
|
9
|
+
cpp-adapter.cpp
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
# Specifies a path to native header files.
|
|
13
|
+
include_directories(
|
|
14
|
+
../cpp
|
|
15
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,38 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["EmbedReactNative_kotlinVersion"]
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
14
|
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
+
}
|
|
17
21
|
|
|
22
|
+
def isNewArchitectureEnabled() {
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
apply plugin: "com.android.library"
|
|
20
27
|
apply plugin: "kotlin-android"
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
if (isNewArchitectureEnabled()) {
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["EmbedReactNative_" + name]
|
|
35
|
+
}
|
|
23
36
|
|
|
24
37
|
def getExtOrIntegerDefault(name) {
|
|
25
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["EmbedReactNative_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
26
48
|
}
|
|
27
49
|
|
|
28
50
|
android {
|
|
29
|
-
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.revragai.embedreactnative"
|
|
53
|
+
|
|
54
|
+
sourceSets {
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
30
60
|
|
|
61
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
31
62
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
32
63
|
|
|
33
64
|
defaultConfig {
|
|
34
65
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
35
66
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
67
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
68
|
+
|
|
69
|
+
externalNativeBuild {
|
|
70
|
+
cmake {
|
|
71
|
+
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
|
|
72
|
+
abiFilters (*reactNativeArchitectures())
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
externalNativeBuild {
|
|
78
|
+
cmake {
|
|
79
|
+
path "CMakeLists.txt"
|
|
80
|
+
}
|
|
36
81
|
}
|
|
37
82
|
|
|
38
83
|
buildFeatures {
|
|
@@ -56,10 +101,12 @@ android {
|
|
|
56
101
|
|
|
57
102
|
sourceSets {
|
|
58
103
|
main {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
104
|
+
if (isNewArchitectureEnabled()) {
|
|
105
|
+
java.srcDirs += [
|
|
106
|
+
"generated/java",
|
|
107
|
+
"generated/jni"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
63
110
|
}
|
|
64
111
|
}
|
|
65
112
|
}
|
|
@@ -72,12 +119,17 @@ repositories {
|
|
|
72
119
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
73
120
|
|
|
74
121
|
dependencies {
|
|
75
|
-
|
|
122
|
+
// For < 0.71, this will be from the local maven repo
|
|
123
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
124
|
+
//noinspection GradleDynamicVersion
|
|
125
|
+
implementation "com.facebook.react:react-native:+"
|
|
76
126
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
127
|
}
|
|
78
128
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
129
|
+
if (isNewArchitectureEnabled()) {
|
|
130
|
+
react {
|
|
131
|
+
jsRootDir = file("../src/")
|
|
132
|
+
libraryName = "EmbedReactNative"
|
|
133
|
+
codegenJavaPackageName = "com.revragai.embedreactnative"
|
|
134
|
+
}
|
|
83
135
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#include <jni.h>
|
|
2
|
+
#include "revrag-ai-embed-react-native.h"
|
|
3
|
+
|
|
4
|
+
extern "C"
|
|
5
|
+
JNIEXPORT jdouble JNICALL
|
|
6
|
+
Java_com_revragai_embedreactnative_EmbedReactNativeModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
|
|
7
|
+
return revragai_embedreactnative::multiply(a, b);
|
|
8
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.revragai.embedreactnative;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
+
import javax.annotation.Nonnull;
|
|
21
|
+
|
|
22
|
+
public abstract class NativeEmbedReactNativeSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
23
|
+
public static final String NAME = "EmbedReactNative";
|
|
24
|
+
|
|
25
|
+
public NativeEmbedReactNativeSpec(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public @Nonnull String getName() {
|
|
31
|
+
return NAME;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
public abstract double multiply(double a, double b);
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNEmbedReactNativeSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
13
|
+
SHARED
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNEmbedReactNativeSpec PUBLIC . react/renderer/components/RNEmbedReactNativeSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
21
|
+
fbjni
|
|
22
|
+
folly_runtime
|
|
23
|
+
glog
|
|
24
|
+
jsi
|
|
25
|
+
react_codegen_rncore
|
|
26
|
+
react_debug
|
|
27
|
+
react_nativemodule_core
|
|
28
|
+
react_render_componentregistry
|
|
29
|
+
react_render_core
|
|
30
|
+
react_render_debug
|
|
31
|
+
react_render_graphics
|
|
32
|
+
react_render_imagemanager
|
|
33
|
+
react_render_mapbuffer
|
|
34
|
+
react_utils
|
|
35
|
+
rrc_image
|
|
36
|
+
rrc_view
|
|
37
|
+
turbomodulejsijni
|
|
38
|
+
yoga
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
target_compile_options(
|
|
42
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
43
|
+
PRIVATE
|
|
44
|
+
-DLOG_TAG=\"ReactNative\"
|
|
45
|
+
-fexceptions
|
|
46
|
+
-frtti
|
|
47
|
+
-std=c++20
|
|
48
|
+
-Wall
|
|
49
|
+
)
|