@revrag-ai/embed-react-native 1.0.5 → 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/lib/commonjs/api/api.js +256 -0
- package/lib/commonjs/api/types/embed.api.types.js +2 -0
- package/lib/commonjs/components/Embed/EmbedAudioWave.js +157 -0
- package/lib/commonjs/components/Embed/EmbedButton.js +511 -0
- package/lib/commonjs/components/Embed/EmbedVoice.js +131 -0
- package/lib/commonjs/components/styles/EmbedButton.style.js +248 -0
- package/lib/commonjs/events/embed.event.js +74 -0
- package/lib/commonjs/hooks/initialize.js +102 -0
- package/lib/commonjs/hooks/initialize.livekit.js +20 -0
- package/lib/commonjs/hooks/types/initialize.types.js +2 -0
- package/lib/commonjs/hooks/types/voiceAgent.types.js +6 -0
- package/lib/commonjs/hooks/voiceagent.js +358 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/index.types.js +22 -0
- package/lib/commonjs/store/store.key.js +46 -0
- package/lib/commonjs/utils/reanimated.helper.js +100 -0
- package/lib/module/NativeEmbedReactNative.js +5 -0
- package/lib/module/api/api.js +248 -0
- package/lib/module/api/types/embed.api.types.js +2 -0
- package/lib/module/components/Embed/EmbedAudioWave.js +152 -0
- package/lib/module/components/Embed/EmbedButton.js +506 -0
- package/lib/module/components/Embed/EmbedVoice.js +127 -0
- package/lib/module/components/styles/EmbedButton.style.js +243 -0
- package/lib/module/events/embed.event.js +70 -0
- package/lib/module/hooks/initialize.js +79 -75
- package/lib/module/hooks/{initializelivekit.js → initialize.livekit.js} +7 -4
- package/lib/module/hooks/types/initialize.types.js +2 -0
- package/lib/module/hooks/types/voiceAgent.types.js +4 -0
- package/lib/module/hooks/voiceagent.js +353 -0
- package/lib/module/index.js +6 -60
- package/lib/module/index.types.js +23 -0
- package/lib/module/store/store.key.js +38 -0
- package/lib/module/utils/reanimated.helper.js +94 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/package.json +69 -27
- package/react-native.config.js +8 -14
- package/revrag-ai-embed-react-native.podspec +41 -0
- package/Onwid.podspec +0 -20
- package/ios/Onwid.h +0 -5
- package/lib/index.d.ts +0 -77
- package/lib/module/Event/onwid.js +0 -74
- package/lib/module/NativeOnwid.js +0 -4
- package/lib/module/component/OnwidButton.js +0 -366
- package/lib/module/component/audiowave.js +0 -137
- package/lib/module/component/voice.js +0 -103
- package/lib/module/hooks/initialize.types.js +0 -2
- package/lib/module/hooks/voiceAgent.js +0 -334
- package/lib/module/hooks/voiceAgent.types.js +0 -2
- package/lib/module/onwidApi/api.js +0 -184
- package/lib/module/onwidApi/api.types.js +0 -2
- package/lib/module/store.key.js +0 -47
- package/lib/module/style/onwidButton.style.js +0 -230
- package/lib/module/utils/reanimatedHelpers.js +0 -87
- package/lib/module/utils/utils.js +0 -1
- package/lib/typescript/Event/onwid.d.ts +0 -13
- package/lib/typescript/NativeOnwid.d.ts +0 -6
- package/lib/typescript/component/OnwidButton.d.ts +0 -28
- package/lib/typescript/component/audiowave.d.ts +0 -6
- package/lib/typescript/component/voice.d.ts +0 -15
- package/lib/typescript/hooks/initialize.d.ts +0 -2
- package/lib/typescript/hooks/initialize.types.d.ts +0 -5
- package/lib/typescript/hooks/initializelivekit.d.ts +0 -3
- package/lib/typescript/hooks/voiceAgent.d.ts +0 -2
- package/lib/typescript/hooks/voiceAgent.types.d.ts +0 -16
- package/lib/typescript/index.d.ts +0 -27
- package/lib/typescript/onwidApi/api.d.ts +0 -53
- package/lib/typescript/onwidApi/api.types.d.ts +0 -21
- package/lib/typescript/store.key.d.ts +0 -3
- package/lib/typescript/style/onwidButton.style.d.ts +0 -98
- package/lib/typescript/utils/reanimatedHelpers.d.ts +0 -29
- package/lib/typescript/utils/utils.d.ts +0 -0
- package/scripts/verify-setup.js +0 -90
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.onwidButtonStyles = exports.createOnwidButtonStyles = exports.BUTTON_HEIGHT = exports.EXPANDED_WIDTH = exports.BUTTON_WIDTH = void 0;
|
|
4
|
-
const react_native_1 = require("react-native");
|
|
5
|
-
const { width: SCREEN_WIDTH } = react_native_1.Dimensions.get('window');
|
|
6
|
-
// Calculate dynamic dimensions based on screen size
|
|
7
|
-
const calculateDimensions = () => {
|
|
8
|
-
const isSmallScreen = SCREEN_WIDTH < 375;
|
|
9
|
-
const isLargeScreen = SCREEN_WIDTH > 768;
|
|
10
|
-
return {
|
|
11
|
-
BUTTON_WIDTH: isSmallScreen ? 60 : isLargeScreen ? 60 : 60,
|
|
12
|
-
EXPANDED_WIDTH: SCREEN_WIDTH * (isSmallScreen ? 0.9 : isLargeScreen ? 0.7 : 0.8),
|
|
13
|
-
BUTTON_HEIGHT: isSmallScreen ? 60 : isLargeScreen ? 60 : 60,
|
|
14
|
-
SPACING: {
|
|
15
|
-
SMALL: isSmallScreen ? 8 : isLargeScreen ? 16 : 12,
|
|
16
|
-
MEDIUM: isSmallScreen ? 12 : isLargeScreen ? 20 : 16,
|
|
17
|
-
LARGE: isSmallScreen ? 16 : isLargeScreen ? 24 : 20,
|
|
18
|
-
},
|
|
19
|
-
BORDER_RADIUS: {
|
|
20
|
-
SMALL: isSmallScreen ? 20 : isLargeScreen ? 30 : 25,
|
|
21
|
-
MEDIUM: isSmallScreen ? 25 : isLargeScreen ? 35 : 30,
|
|
22
|
-
LARGE: isSmallScreen ? 30 : isLargeScreen ? 40 : 35,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
const dimensions = calculateDimensions();
|
|
27
|
-
exports.BUTTON_WIDTH = dimensions.BUTTON_WIDTH;
|
|
28
|
-
exports.EXPANDED_WIDTH = dimensions.EXPANDED_WIDTH;
|
|
29
|
-
exports.BUTTON_HEIGHT = dimensions.BUTTON_HEIGHT;
|
|
30
|
-
const createOnwidButtonStyles = (customStyles) => {
|
|
31
|
-
const { buttonWidth = exports.BUTTON_WIDTH, buttonHeight = exports.BUTTON_HEIGHT, backgroundColor = 'transparent', borderRadius = dimensions.BORDER_RADIUS.MEDIUM, marginBottom = dimensions.SPACING.LARGE, spacing = dimensions.SPACING, } = customStyles || {};
|
|
32
|
-
return react_native_1.StyleSheet.create({
|
|
33
|
-
container: {
|
|
34
|
-
position: 'absolute',
|
|
35
|
-
bottom: 0,
|
|
36
|
-
right: 0,
|
|
37
|
-
height: '100%',
|
|
38
|
-
width: '100%',
|
|
39
|
-
flexDirection: 'row',
|
|
40
|
-
justifyContent: 'flex-end',
|
|
41
|
-
alignItems: 'flex-end',
|
|
42
|
-
padding: spacing.MEDIUM,
|
|
43
|
-
backgroundColor: 'transparent',
|
|
44
|
-
pointerEvents: 'box-none',
|
|
45
|
-
},
|
|
46
|
-
button: {
|
|
47
|
-
width: buttonWidth,
|
|
48
|
-
height: buttonHeight,
|
|
49
|
-
borderRadius: borderRadius,
|
|
50
|
-
marginBottom: marginBottom,
|
|
51
|
-
backgroundColor: backgroundColor,
|
|
52
|
-
},
|
|
53
|
-
pressable: {
|
|
54
|
-
borderRadius: 100,
|
|
55
|
-
padding: 5,
|
|
56
|
-
margin: 0,
|
|
57
|
-
justifyContent: 'center',
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
height: '100%',
|
|
60
|
-
width: '100%',
|
|
61
|
-
},
|
|
62
|
-
menu: {
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
top: 0,
|
|
65
|
-
backgroundColor: 'white',
|
|
66
|
-
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
67
|
-
padding: spacing.MEDIUM,
|
|
68
|
-
},
|
|
69
|
-
menuLeft: {
|
|
70
|
-
right: '100%',
|
|
71
|
-
marginRight: spacing.SMALL,
|
|
72
|
-
},
|
|
73
|
-
menuRight: {
|
|
74
|
-
left: '100%',
|
|
75
|
-
marginLeft: spacing.SMALL,
|
|
76
|
-
},
|
|
77
|
-
iconText: {
|
|
78
|
-
color: 'white',
|
|
79
|
-
fontSize: 20,
|
|
80
|
-
},
|
|
81
|
-
buttonContent: {
|
|
82
|
-
flexDirection: 'row',
|
|
83
|
-
alignItems: 'center',
|
|
84
|
-
// height: '100%',
|
|
85
|
-
},
|
|
86
|
-
iconImage: {
|
|
87
|
-
width: buttonWidth - 10,
|
|
88
|
-
height: buttonHeight - 10,
|
|
89
|
-
resizeMode: 'contain',
|
|
90
|
-
justifyContent: 'center',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
alignSelf: 'center',
|
|
93
|
-
margin: 0,
|
|
94
|
-
padding: 0,
|
|
95
|
-
},
|
|
96
|
-
startCallButton: {
|
|
97
|
-
height: 36,
|
|
98
|
-
borderRadius: dimensions.BORDER_RADIUS.MEDIUM,
|
|
99
|
-
backgroundColor: '#000',
|
|
100
|
-
justifyContent: 'center',
|
|
101
|
-
alignItems: 'center',
|
|
102
|
-
paddingHorizontal: spacing.SMALL + 5,
|
|
103
|
-
minWidth: 70,
|
|
104
|
-
maxWidth: '90%',
|
|
105
|
-
},
|
|
106
|
-
startCallText: {
|
|
107
|
-
color: 'white',
|
|
108
|
-
fontSize: 12,
|
|
109
|
-
fontWeight: '500',
|
|
110
|
-
},
|
|
111
|
-
rowContainer: {
|
|
112
|
-
flexDirection: 'row',
|
|
113
|
-
alignItems: 'center',
|
|
114
|
-
justifyContent: 'center',
|
|
115
|
-
height: '100%',
|
|
116
|
-
margin: 0,
|
|
117
|
-
padding: 0,
|
|
118
|
-
},
|
|
119
|
-
linearGradient: {
|
|
120
|
-
flex: 1,
|
|
121
|
-
borderRadius: dimensions.BORDER_RADIUS.LARGE,
|
|
122
|
-
flexDirection: 'row',
|
|
123
|
-
width: exports.BUTTON_WIDTH,
|
|
124
|
-
},
|
|
125
|
-
buttonContainer: {
|
|
126
|
-
flexDirection: 'row',
|
|
127
|
-
alignItems: 'center',
|
|
128
|
-
gap: 4,
|
|
129
|
-
},
|
|
130
|
-
endCallButton: {
|
|
131
|
-
justifyContent: 'center',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
width: 44,
|
|
134
|
-
height: 44,
|
|
135
|
-
},
|
|
136
|
-
muteButton: {
|
|
137
|
-
borderRadius: 100,
|
|
138
|
-
justifyContent: 'center',
|
|
139
|
-
alignItems: 'center',
|
|
140
|
-
width: 44,
|
|
141
|
-
height: 44,
|
|
142
|
-
},
|
|
143
|
-
micIcon: {
|
|
144
|
-
width: 24,
|
|
145
|
-
height: 24,
|
|
146
|
-
tintColor: 'white',
|
|
147
|
-
},
|
|
148
|
-
endCallIcon: {
|
|
149
|
-
width: 24,
|
|
150
|
-
height: 24,
|
|
151
|
-
tintColor: 'white',
|
|
152
|
-
},
|
|
153
|
-
buttonImage: {
|
|
154
|
-
width: '100%',
|
|
155
|
-
height: '100%',
|
|
156
|
-
resizeMode: 'contain',
|
|
157
|
-
},
|
|
158
|
-
// New styles for expanded button layout
|
|
159
|
-
expandedContent: {
|
|
160
|
-
flexDirection: 'row',
|
|
161
|
-
flex: 1,
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
width: '100%',
|
|
164
|
-
justifyContent: 'space-between',
|
|
165
|
-
},
|
|
166
|
-
leftSection: {
|
|
167
|
-
alignItems: 'flex-start',
|
|
168
|
-
},
|
|
169
|
-
centerSection: {
|
|
170
|
-
alignItems: 'center',
|
|
171
|
-
height: '100%',
|
|
172
|
-
},
|
|
173
|
-
rightSection: {
|
|
174
|
-
justifyContent: 'flex-end',
|
|
175
|
-
alignItems: 'center',
|
|
176
|
-
},
|
|
177
|
-
agentInfoContainer: {
|
|
178
|
-
height: exports.BUTTON_HEIGHT,
|
|
179
|
-
flexDirection: 'row',
|
|
180
|
-
alignItems: 'center',
|
|
181
|
-
overflow: 'hidden',
|
|
182
|
-
},
|
|
183
|
-
agentTextContainer: {
|
|
184
|
-
justifyContent: 'center',
|
|
185
|
-
height: '100%',
|
|
186
|
-
flex: 1,
|
|
187
|
-
},
|
|
188
|
-
agentNameText: {
|
|
189
|
-
fontFamily: 'Inter-Medium',
|
|
190
|
-
fontSize: 14,
|
|
191
|
-
fontWeight: '500',
|
|
192
|
-
color: 'white',
|
|
193
|
-
},
|
|
194
|
-
statusText: {
|
|
195
|
-
fontFamily: 'Inter-Regular',
|
|
196
|
-
fontSize: 11,
|
|
197
|
-
fontWeight: '300',
|
|
198
|
-
color: 'white',
|
|
199
|
-
},
|
|
200
|
-
// Chip styles
|
|
201
|
-
chip: {
|
|
202
|
-
height: 30,
|
|
203
|
-
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
204
|
-
marginBottom: 10,
|
|
205
|
-
alignSelf: 'flex-end',
|
|
206
|
-
overflow: 'hidden',
|
|
207
|
-
elevation: 3,
|
|
208
|
-
shadowColor: '#000',
|
|
209
|
-
shadowOffset: { width: 0, height: 2 },
|
|
210
|
-
shadowOpacity: 0.3,
|
|
211
|
-
shadowRadius: 2,
|
|
212
|
-
},
|
|
213
|
-
chipGradient: {
|
|
214
|
-
height: '100%',
|
|
215
|
-
paddingHorizontal: spacing.MEDIUM,
|
|
216
|
-
paddingVertical: spacing.SMALL / 2,
|
|
217
|
-
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
218
|
-
justifyContent: 'center',
|
|
219
|
-
alignItems: 'center',
|
|
220
|
-
},
|
|
221
|
-
chipText: {
|
|
222
|
-
color: 'white',
|
|
223
|
-
fontSize: 12,
|
|
224
|
-
fontWeight: '500',
|
|
225
|
-
},
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
exports.createOnwidButtonStyles = createOnwidButtonStyles;
|
|
229
|
-
// Default styles export with dynamic dimensions
|
|
230
|
-
exports.onwidButtonStyles = (0, exports.createOnwidButtonStyles)();
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @file reanimatedHelpers.ts
|
|
4
|
-
* @description Utility functions to handle react-native-reanimated configuration and provide fallbacks
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.getReanimatedAPI = getReanimatedAPI;
|
|
8
|
-
exports.checkReanimatedSetup = checkReanimatedSetup;
|
|
9
|
-
exports.showReanimatedSetupError = showReanimatedSetupError;
|
|
10
|
-
let reanimatedAPI;
|
|
11
|
-
/**
|
|
12
|
-
* Safely loads react-native-reanimated and provides fallbacks if not available
|
|
13
|
-
*/
|
|
14
|
-
function getReanimatedAPI() {
|
|
15
|
-
if (reanimatedAPI) {
|
|
16
|
-
return reanimatedAPI;
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const reanimated = require('react-native-reanimated');
|
|
20
|
-
// Check if makeMutable is available (this is what was causing the original error)
|
|
21
|
-
if (!reanimated.makeMutable) {
|
|
22
|
-
throw new Error('makeMutable not found - react-native-reanimated may not be properly configured');
|
|
23
|
-
}
|
|
24
|
-
reanimatedAPI = {
|
|
25
|
-
useSharedValue: reanimated.useSharedValue,
|
|
26
|
-
useAnimatedStyle: reanimated.useAnimatedStyle,
|
|
27
|
-
withTiming: reanimated.withTiming,
|
|
28
|
-
withSpring: reanimated.withSpring,
|
|
29
|
-
withRepeat: reanimated.withRepeat,
|
|
30
|
-
withSequence: reanimated.withSequence,
|
|
31
|
-
runOnJS: reanimated.runOnJS,
|
|
32
|
-
Easing: reanimated.Easing,
|
|
33
|
-
Animated: reanimated.default,
|
|
34
|
-
isAvailable: true,
|
|
35
|
-
};
|
|
36
|
-
console.log('✅ react-native-reanimated loaded successfully');
|
|
37
|
-
return reanimatedAPI;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.warn('⚠️ react-native-reanimated is not properly installed or configured:', error);
|
|
41
|
-
console.warn('📚 Please follow the setup guide: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started');
|
|
42
|
-
// Provide fallback implementations
|
|
43
|
-
const { View } = require('react-native');
|
|
44
|
-
reanimatedAPI = {
|
|
45
|
-
useSharedValue: (value) => ({ value }),
|
|
46
|
-
useAnimatedStyle: () => ({}),
|
|
47
|
-
withTiming: (value) => value,
|
|
48
|
-
withSpring: (value) => value,
|
|
49
|
-
withRepeat: (value) => value,
|
|
50
|
-
withSequence: (...args) => args[args.length - 1],
|
|
51
|
-
runOnJS: (fn) => fn,
|
|
52
|
-
Easing: {
|
|
53
|
-
inOut: (easing) => easing,
|
|
54
|
-
ease: (t) => t,
|
|
55
|
-
},
|
|
56
|
-
Animated: View,
|
|
57
|
-
isAvailable: false,
|
|
58
|
-
};
|
|
59
|
-
return reanimatedAPI;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if react-native-reanimated is properly configured
|
|
64
|
-
*/
|
|
65
|
-
function checkReanimatedSetup() {
|
|
66
|
-
const api = getReanimatedAPI();
|
|
67
|
-
return api.isAvailable;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Display a helpful error message if reanimated is not configured
|
|
71
|
-
*/
|
|
72
|
-
function showReanimatedSetupError() {
|
|
73
|
-
console.error(`
|
|
74
|
-
🚨 React Native Reanimated Setup Required
|
|
75
|
-
|
|
76
|
-
The OnwidButton component requires react-native-reanimated to be properly installed and configured.
|
|
77
|
-
|
|
78
|
-
Quick Fix:
|
|
79
|
-
1. Install: npm install react-native-reanimated
|
|
80
|
-
2. Add to babel.config.js:
|
|
81
|
-
plugins: ['react-native-reanimated/plugin']
|
|
82
|
-
3. Rebuild your app
|
|
83
|
-
|
|
84
|
-
For detailed setup instructions, visit:
|
|
85
|
-
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
|
|
86
|
-
`);
|
|
87
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type EventCallback = (data: any) => void;
|
|
2
|
-
export declare enum EventKeys {
|
|
3
|
-
USER_DATA = "user_data",
|
|
4
|
-
SCREEN_STATE = "state_data"
|
|
5
|
-
}
|
|
6
|
-
declare class OnWid {
|
|
7
|
-
private events;
|
|
8
|
-
private ensureDefaultListener;
|
|
9
|
-
Event(eventKey: string, data: any): Promise<void>;
|
|
10
|
-
on(eventKey: EventKeys, callback: EventCallback): void;
|
|
11
|
-
}
|
|
12
|
-
declare const onwid: OnWid;
|
|
13
|
-
export default onwid;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file OnwidButton.tsx
|
|
3
|
-
* @description A customizable floating action button component for React Native applications.
|
|
4
|
-
* This component provides a draggable, expandable button with animation support and gradient styling.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* OnwidButton Component
|
|
8
|
-
*
|
|
9
|
-
* A floating action button that can be dragged around the screen and expanded to show additional content.
|
|
10
|
-
* Features include:
|
|
11
|
-
* - Draggable functionality
|
|
12
|
-
* - Expandable menu
|
|
13
|
-
* - Animated transitions
|
|
14
|
-
* - Gradient background
|
|
15
|
-
* - Customizable styling
|
|
16
|
-
*
|
|
17
|
-
* @component
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <OnwidButton
|
|
21
|
-
* isOpen={false}
|
|
22
|
-
* onPress={(isOpen) => console.log('Button pressed:', isOpen)}
|
|
23
|
-
* menuComponent={<YourMenuComponent />}
|
|
24
|
-
* />
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function OnwidButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
28
|
-
export default OnwidButton;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Room } from 'livekit-client';
|
|
2
|
-
import { RefObject } from 'react';
|
|
3
|
-
interface VoiceProps {
|
|
4
|
-
url: string;
|
|
5
|
-
token: string;
|
|
6
|
-
onDisconnected: (data: string) => void;
|
|
7
|
-
onConnected: (data: string) => void;
|
|
8
|
-
roomRef: RefObject<Room>;
|
|
9
|
-
}
|
|
10
|
-
export interface VoiceRef {
|
|
11
|
-
mute: () => void;
|
|
12
|
-
unmute: () => void;
|
|
13
|
-
}
|
|
14
|
-
declare const Voice: (props: VoiceProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
-
export default Voice;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ConnectionState, Room } from 'livekit-client';
|
|
2
|
-
import { RefObject } from 'react';
|
|
3
|
-
export type UseVoiceAgentReturn = {
|
|
4
|
-
initializeVoiceAgent: () => Promise<void>;
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
error: string | null;
|
|
7
|
-
tokenDetails: any;
|
|
8
|
-
endCall: () => Promise<void>;
|
|
9
|
-
room: Room;
|
|
10
|
-
roomRef: RefObject<Room>;
|
|
11
|
-
isMicMuted: boolean;
|
|
12
|
-
muteMic: () => void;
|
|
13
|
-
unmuteMic: () => void;
|
|
14
|
-
connectionState: ConnectionState;
|
|
15
|
-
cleanup: () => void;
|
|
16
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file index.tsx
|
|
3
|
-
* @description Main entry point for the Onwid React Native library.
|
|
4
|
-
* This file exports the core components and utilities for the Onwid SDK.
|
|
5
|
-
*/
|
|
6
|
-
import onwid, { EventKeys } from './Event/onwid';
|
|
7
|
-
import { useInitialize } from './hooks/initialize';
|
|
8
|
-
import type { UseInitializeProps } from './hooks/initialize.types';
|
|
9
|
-
import registerAgent from './hooks/initializelivekit';
|
|
10
|
-
import type { ApiResponse, RegisterRequest, TokenDetails } from './onwidApi/api.types';
|
|
11
|
-
/**
|
|
12
|
-
* OnwidButton component that provides a customizable button with menu functionality
|
|
13
|
-
* @returns React component
|
|
14
|
-
*/
|
|
15
|
-
export declare function OnwidButton(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/**
|
|
17
|
-
* Core exports from the Onwid library
|
|
18
|
-
* @exports
|
|
19
|
-
* @property {OnwidButton} OnwidButton - Custom button component with menu functionality
|
|
20
|
-
* @property {Function} registerAgent - Function to register the Agent (Optional)
|
|
21
|
-
* @property {OnWid} onwid - Event management system instance
|
|
22
|
-
* @property {useInitialize} useInitialize - Hook to initialize the Onwid SDK
|
|
23
|
-
* @property {useVoiceAgent} useVoiceAgent - Hook for voice agent functionality
|
|
24
|
-
* @property {EventKeys} EventKeys - Available event types
|
|
25
|
-
*/
|
|
26
|
-
export { EventKeys, onwid, registerAgent, useInitialize };
|
|
27
|
-
export type { ApiResponse, RegisterRequest, TokenDetails, UseInitializeProps };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ApiResponse, TokenDetails, UpdateDataRequest } from './api.types';
|
|
2
|
-
/**
|
|
3
|
-
* APIService class that ensures proper initialization before API calls
|
|
4
|
-
*/
|
|
5
|
-
export declare class APIService {
|
|
6
|
-
private static instance;
|
|
7
|
-
private apiBaseUrl;
|
|
8
|
-
private isInitialized;
|
|
9
|
-
private constructor();
|
|
10
|
-
/**
|
|
11
|
-
* Get singleton instance of APIService
|
|
12
|
-
*/
|
|
13
|
-
static getInstance(): APIService;
|
|
14
|
-
/**
|
|
15
|
-
* Initialize the API service with the base URL
|
|
16
|
-
*/
|
|
17
|
-
initialize(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Ensure the service is initialized before making API calls
|
|
20
|
-
*/
|
|
21
|
-
private ensureInitialized;
|
|
22
|
-
/**
|
|
23
|
-
* Get headers with stored API key
|
|
24
|
-
*/
|
|
25
|
-
private getHeaders;
|
|
26
|
-
/**
|
|
27
|
-
* Register a new user/device on initialization
|
|
28
|
-
* @returns Promise with registration response
|
|
29
|
-
*/
|
|
30
|
-
registerOnInitialize(): Promise<ApiResponse<TokenDetails>>;
|
|
31
|
-
/**
|
|
32
|
-
* Update user data
|
|
33
|
-
* @param params Update parameters including userId and data to update
|
|
34
|
-
* @returns Promise with update response
|
|
35
|
-
*/
|
|
36
|
-
updateUserData(params: UpdateDataRequest): Promise<ApiResponse<void>>;
|
|
37
|
-
/**
|
|
38
|
-
* Get token details for a user
|
|
39
|
-
* @param params Parameters including app_user_id and call_type
|
|
40
|
-
* @returns Promise with token details
|
|
41
|
-
*/
|
|
42
|
-
getTokenDetails(params: {
|
|
43
|
-
app_user_id: string;
|
|
44
|
-
call_type: string;
|
|
45
|
-
}): Promise<ApiResponse<TokenDetails>>;
|
|
46
|
-
}
|
|
47
|
-
export declare const initializeApi: () => Promise<void>;
|
|
48
|
-
export declare const registerOnInitialize: () => Promise<ApiResponse<TokenDetails>>;
|
|
49
|
-
export declare const updateUserData: (params: UpdateDataRequest) => Promise<ApiResponse<void>>;
|
|
50
|
-
export declare const getTokenDetails: (params: {
|
|
51
|
-
app_user_id: string;
|
|
52
|
-
call_type: string;
|
|
53
|
-
}) => Promise<ApiResponse<TokenDetails>>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type RegisterRequest = {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
onwidUrl: string;
|
|
4
|
-
metadata?: Record<string, any>;
|
|
5
|
-
};
|
|
6
|
-
export type UpdateDataRequest = {
|
|
7
|
-
eventKey: string;
|
|
8
|
-
data: Record<string, any>;
|
|
9
|
-
};
|
|
10
|
-
export type TokenDetails = {
|
|
11
|
-
token: string;
|
|
12
|
-
expiresAt: number;
|
|
13
|
-
apiKey: string;
|
|
14
|
-
config: Record<string, any>;
|
|
15
|
-
server_url: string;
|
|
16
|
-
};
|
|
17
|
-
export type ApiResponse<T> = {
|
|
18
|
-
success: boolean;
|
|
19
|
-
data?: T;
|
|
20
|
-
error?: string;
|
|
21
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ViewStyle, TextStyle, ImageStyle } from 'react-native';
|
|
2
|
-
export declare const BUTTON_WIDTH: number;
|
|
3
|
-
export declare const EXPANDED_WIDTH: number;
|
|
4
|
-
export declare const BUTTON_HEIGHT: number;
|
|
5
|
-
type SpacingType = {
|
|
6
|
-
SMALL: number;
|
|
7
|
-
MEDIUM: number;
|
|
8
|
-
LARGE: number;
|
|
9
|
-
};
|
|
10
|
-
type CustomStyles = {
|
|
11
|
-
buttonWidth?: number;
|
|
12
|
-
buttonHeight?: number;
|
|
13
|
-
backgroundColor?: string;
|
|
14
|
-
borderRadius?: number;
|
|
15
|
-
marginBottom?: number;
|
|
16
|
-
spacing?: SpacingType;
|
|
17
|
-
};
|
|
18
|
-
export declare const createOnwidButtonStyles: (customStyles?: CustomStyles) => {
|
|
19
|
-
container: ViewStyle;
|
|
20
|
-
button: ViewStyle;
|
|
21
|
-
pressable: ViewStyle;
|
|
22
|
-
menu: ViewStyle;
|
|
23
|
-
menuLeft: ViewStyle;
|
|
24
|
-
menuRight: ViewStyle;
|
|
25
|
-
iconText: TextStyle;
|
|
26
|
-
buttonContent: ViewStyle;
|
|
27
|
-
iconImage: ImageStyle;
|
|
28
|
-
startCallButton: ViewStyle;
|
|
29
|
-
startCallText: TextStyle;
|
|
30
|
-
rowContainer: ViewStyle;
|
|
31
|
-
linearGradient: ViewStyle;
|
|
32
|
-
buttonContainer: ViewStyle;
|
|
33
|
-
endCallButton: ViewStyle;
|
|
34
|
-
muteButton: ViewStyle;
|
|
35
|
-
micIcon: {
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
tintColor: string;
|
|
39
|
-
};
|
|
40
|
-
endCallIcon: {
|
|
41
|
-
width: number;
|
|
42
|
-
height: number;
|
|
43
|
-
tintColor: string;
|
|
44
|
-
};
|
|
45
|
-
buttonImage: ImageStyle;
|
|
46
|
-
expandedContent: ViewStyle;
|
|
47
|
-
leftSection: ViewStyle;
|
|
48
|
-
centerSection: ViewStyle;
|
|
49
|
-
rightSection: ViewStyle;
|
|
50
|
-
agentInfoContainer: ViewStyle;
|
|
51
|
-
agentTextContainer: ViewStyle;
|
|
52
|
-
agentNameText: TextStyle;
|
|
53
|
-
statusText: TextStyle;
|
|
54
|
-
chip: ViewStyle;
|
|
55
|
-
chipGradient: ViewStyle;
|
|
56
|
-
chipText: TextStyle;
|
|
57
|
-
};
|
|
58
|
-
export declare const onwidButtonStyles: {
|
|
59
|
-
container: ViewStyle;
|
|
60
|
-
button: ViewStyle;
|
|
61
|
-
pressable: ViewStyle;
|
|
62
|
-
menu: ViewStyle;
|
|
63
|
-
menuLeft: ViewStyle;
|
|
64
|
-
menuRight: ViewStyle;
|
|
65
|
-
iconText: TextStyle;
|
|
66
|
-
buttonContent: ViewStyle;
|
|
67
|
-
iconImage: ImageStyle;
|
|
68
|
-
startCallButton: ViewStyle;
|
|
69
|
-
startCallText: TextStyle;
|
|
70
|
-
rowContainer: ViewStyle;
|
|
71
|
-
linearGradient: ViewStyle;
|
|
72
|
-
buttonContainer: ViewStyle;
|
|
73
|
-
endCallButton: ViewStyle;
|
|
74
|
-
muteButton: ViewStyle;
|
|
75
|
-
micIcon: {
|
|
76
|
-
width: number;
|
|
77
|
-
height: number;
|
|
78
|
-
tintColor: string;
|
|
79
|
-
};
|
|
80
|
-
endCallIcon: {
|
|
81
|
-
width: number;
|
|
82
|
-
height: number;
|
|
83
|
-
tintColor: string;
|
|
84
|
-
};
|
|
85
|
-
buttonImage: ImageStyle;
|
|
86
|
-
expandedContent: ViewStyle;
|
|
87
|
-
leftSection: ViewStyle;
|
|
88
|
-
centerSection: ViewStyle;
|
|
89
|
-
rightSection: ViewStyle;
|
|
90
|
-
agentInfoContainer: ViewStyle;
|
|
91
|
-
agentTextContainer: ViewStyle;
|
|
92
|
-
agentNameText: TextStyle;
|
|
93
|
-
statusText: TextStyle;
|
|
94
|
-
chip: ViewStyle;
|
|
95
|
-
chipGradient: ViewStyle;
|
|
96
|
-
chipText: TextStyle;
|
|
97
|
-
};
|
|
98
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file reanimatedHelpers.ts
|
|
3
|
-
* @description Utility functions to handle react-native-reanimated configuration and provide fallbacks
|
|
4
|
-
*/
|
|
5
|
-
interface ReanimatedAPI {
|
|
6
|
-
useSharedValue: any;
|
|
7
|
-
useAnimatedStyle: any;
|
|
8
|
-
withTiming: any;
|
|
9
|
-
withSpring: any;
|
|
10
|
-
withRepeat: any;
|
|
11
|
-
withSequence: any;
|
|
12
|
-
runOnJS: any;
|
|
13
|
-
Easing: any;
|
|
14
|
-
Animated: any;
|
|
15
|
-
isAvailable: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Safely loads react-native-reanimated and provides fallbacks if not available
|
|
19
|
-
*/
|
|
20
|
-
export declare function getReanimatedAPI(): ReanimatedAPI;
|
|
21
|
-
/**
|
|
22
|
-
* Check if react-native-reanimated is properly configured
|
|
23
|
-
*/
|
|
24
|
-
export declare function checkReanimatedSetup(): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Display a helpful error message if reanimated is not configured
|
|
27
|
-
*/
|
|
28
|
-
export declare function showReanimatedSetupError(): void;
|
|
29
|
-
export {};
|
|
File without changes
|