@revrag-ai/embed-react-native 1.0.5 → 1.0.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.
- package/dist/commonjs/Event/onwid.js +70 -0
- package/dist/commonjs/NativeOnwid.js +5 -0
- package/dist/commonjs/button.json +1 -0
- package/dist/commonjs/component/OnwidButton.js +507 -0
- package/dist/commonjs/component/audiowave.js +153 -0
- package/dist/commonjs/component/voice.js +127 -0
- package/dist/commonjs/hooks/initialize.js +96 -0
- package/dist/commonjs/hooks/initialize.types.js +2 -0
- package/{lib/module → dist/commonjs}/hooks/initializelivekit.js +7 -4
- package/dist/commonjs/hooks/voiceAgent.js +353 -0
- package/dist/commonjs/hooks/voiceAgent.types.js +4 -0
- package/dist/commonjs/index.d.js +22 -0
- package/dist/commonjs/index.js +34 -0
- package/dist/commonjs/onwidApi/api.js +185 -0
- package/dist/commonjs/onwidApi/api.types.js +2 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/store.key.js +38 -0
- package/dist/commonjs/style/onwidButton.style.js +243 -0
- package/dist/commonjs/utils/reanimatedHelpers.js +94 -0
- package/dist/commonjs/utils/utils.js +2 -0
- package/dist/module/Event/onwid.js +70 -0
- package/dist/module/NativeOnwid.js +5 -0
- package/dist/module/button.json +1 -0
- package/dist/module/component/OnwidButton.js +507 -0
- package/dist/module/component/audiowave.js +153 -0
- package/dist/module/component/voice.js +127 -0
- package/dist/module/hooks/initialize.js +96 -0
- package/dist/module/hooks/initialize.types.js +2 -0
- package/dist/module/hooks/initializelivekit.js +17 -0
- package/dist/module/hooks/voiceAgent.js +353 -0
- package/dist/module/hooks/voiceAgent.types.js +4 -0
- package/dist/module/index.d.js +22 -0
- package/dist/module/index.js +34 -0
- package/dist/module/onwidApi/api.js +185 -0
- package/dist/module/onwidApi/api.types.js +2 -0
- package/dist/module/store.key.js +38 -0
- package/dist/module/style/onwidButton.style.js +243 -0
- package/dist/module/utils/reanimatedHelpers.js +94 -0
- package/dist/module/utils/utils.js +2 -0
- package/{lib → dist}/typescript/Event/onwid.d.ts +1 -0
- package/{lib → dist}/typescript/NativeOnwid.d.ts +1 -0
- package/{lib → dist}/typescript/component/OnwidButton.d.ts +1 -0
- package/{lib → dist}/typescript/component/audiowave.d.ts +1 -0
- package/{lib → dist}/typescript/component/voice.d.ts +1 -0
- package/{lib → dist}/typescript/hooks/initialize.d.ts +1 -0
- package/{lib → dist}/typescript/hooks/initialize.types.d.ts +1 -0
- package/{lib → dist}/typescript/hooks/initializelivekit.d.ts +1 -0
- package/{lib → dist}/typescript/hooks/voiceAgent.d.ts +1 -0
- package/{lib → dist}/typescript/hooks/voiceAgent.types.d.ts +1 -0
- package/{lib → dist}/typescript/index.d.ts +3 -3
- package/{lib → dist}/typescript/onwidApi/api.d.ts +1 -0
- package/{lib → dist}/typescript/onwidApi/api.types.d.ts +1 -0
- package/{lib → dist}/typescript/store.key.d.ts +1 -0
- package/{lib → dist}/typescript/style/onwidButton.style.d.ts +1 -0
- package/{lib → dist}/typescript/utils/reanimatedHelpers.d.ts +1 -0
- package/dist/typescript/utils/utils.d.ts +1 -0
- package/package.json +29 -21
- 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.js +0 -92
- 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/index.js +0 -61
- 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/utils/utils.d.ts +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getAgentData, setAgentData } from '../store.key';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* APIService class that ensures proper initialization before API calls
|
|
7
|
+
*/
|
|
8
|
+
export class APIService {
|
|
9
|
+
static instance = null;
|
|
10
|
+
apiBaseUrl = null;
|
|
11
|
+
isInitialized = false;
|
|
12
|
+
constructor() {}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get singleton instance of APIService
|
|
16
|
+
*/
|
|
17
|
+
static getInstance() {
|
|
18
|
+
if (!APIService.instance) {
|
|
19
|
+
APIService.instance = new APIService();
|
|
20
|
+
}
|
|
21
|
+
return APIService.instance;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the API service with the base URL
|
|
26
|
+
*/
|
|
27
|
+
async initialize() {
|
|
28
|
+
if (this.isInitialized && this.apiBaseUrl) {
|
|
29
|
+
return; // Already initialized
|
|
30
|
+
}
|
|
31
|
+
const AgentData = await getAgentData();
|
|
32
|
+
console.log('AgentData', AgentData);
|
|
33
|
+
if (AgentData?.onwidUrl) {
|
|
34
|
+
this.apiBaseUrl = AgentData.onwidUrl;
|
|
35
|
+
this.isInitialized = true;
|
|
36
|
+
console.log('API_BASE_URL initialized:', this.apiBaseUrl);
|
|
37
|
+
} else {
|
|
38
|
+
throw new Error('API base URL not found in keychain');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Ensure the service is initialized before making API calls
|
|
44
|
+
*/
|
|
45
|
+
async ensureInitialized() {
|
|
46
|
+
if (!this.isInitialized || !this.apiBaseUrl) {
|
|
47
|
+
await this.initialize();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get headers with stored API key
|
|
53
|
+
*/
|
|
54
|
+
async getHeaders() {
|
|
55
|
+
const AgentData = await getAgentData();
|
|
56
|
+
if (!AgentData?.apiKey) {
|
|
57
|
+
throw new Error('API key not found in keychain');
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
'Authorization': `Bearer ${AgentData.apiKey}`,
|
|
62
|
+
'X-Revrag-Embedded-Key': AgentData.apiKey
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Register a new user/device on initialization
|
|
68
|
+
* @returns Promise with registration response
|
|
69
|
+
*/
|
|
70
|
+
async registerOnInitialize() {
|
|
71
|
+
try {
|
|
72
|
+
await this.ensureInitialized();
|
|
73
|
+
console.log('registerOnInitialize ApiData', this.apiBaseUrl);
|
|
74
|
+
const headers = await this.getHeaders();
|
|
75
|
+
const response = await fetch(`${this.apiBaseUrl}/embedded-agent/initialize`, {
|
|
76
|
+
method: 'GET',
|
|
77
|
+
headers: headers
|
|
78
|
+
});
|
|
79
|
+
const data = await response.json();
|
|
80
|
+
console.log('dat config data after register', data);
|
|
81
|
+
await setAgentData(data, '@config_data');
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
console.log('registerOnInitialize error', data.error);
|
|
84
|
+
throw new Error(data.error || 'Registration failed');
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
data: data
|
|
89
|
+
};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.log('registerOnInitialize error', error);
|
|
92
|
+
return {
|
|
93
|
+
success: false,
|
|
94
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred'
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Update user data
|
|
101
|
+
* @param params Update parameters including userId and data to update
|
|
102
|
+
* @returns Promise with update response
|
|
103
|
+
*/
|
|
104
|
+
async updateUserData(params) {
|
|
105
|
+
try {
|
|
106
|
+
await this.ensureInitialized();
|
|
107
|
+
console.log('params', params, `${this.apiBaseUrl}/embedded-agent/user-context/update?app_user_id=${params.data.app_user_id}`);
|
|
108
|
+
console.log('updateUserData');
|
|
109
|
+
const headers = await this.getHeaders();
|
|
110
|
+
const response = await fetch(`${this.apiBaseUrl}/embedded-agent/user-context/update?app_user_id=${params.data.app_user_id}`, {
|
|
111
|
+
method: 'PUT',
|
|
112
|
+
headers,
|
|
113
|
+
body: JSON.stringify({
|
|
114
|
+
[params.eventKey]: params.data
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
const data = await response.json();
|
|
118
|
+
console.log('data after update', data);
|
|
119
|
+
if (!response.ok) {
|
|
120
|
+
throw new Error(data.error || 'Update failed');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
success: true
|
|
124
|
+
};
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.log('updateUserData error', error);
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred'
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get token details for a user
|
|
136
|
+
* @param params Parameters including app_user_id and call_type
|
|
137
|
+
* @returns Promise with token details
|
|
138
|
+
*/
|
|
139
|
+
async getTokenDetails(params) {
|
|
140
|
+
try {
|
|
141
|
+
await this.ensureInitialized();
|
|
142
|
+
const headers = await this.getHeaders();
|
|
143
|
+
console.log('params', this.apiBaseUrl, params, headers, `${this.apiBaseUrl}/embedded-agent/token`);
|
|
144
|
+
const response = await fetch(`${this.apiBaseUrl}/embedded-agent/token`, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers,
|
|
147
|
+
body: JSON.stringify(params)
|
|
148
|
+
});
|
|
149
|
+
const data = await response.json();
|
|
150
|
+
console.log('data', data);
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
throw new Error(data.error || 'Failed to get token details');
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
success: true,
|
|
156
|
+
data: data
|
|
157
|
+
};
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.log('getTokenDetails error', error);
|
|
160
|
+
return {
|
|
161
|
+
success: false,
|
|
162
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred'
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Export convenience functions for backward compatibility
|
|
169
|
+
export const initializeApi = async () => {
|
|
170
|
+
const apiService = APIService.getInstance();
|
|
171
|
+
await apiService.initialize();
|
|
172
|
+
};
|
|
173
|
+
export const registerOnInitialize = async () => {
|
|
174
|
+
const apiService = APIService.getInstance();
|
|
175
|
+
return await apiService.registerOnInitialize();
|
|
176
|
+
};
|
|
177
|
+
export const updateUserData = async params => {
|
|
178
|
+
const apiService = APIService.getInstance();
|
|
179
|
+
return await apiService.updateUserData(params);
|
|
180
|
+
};
|
|
181
|
+
export const getTokenDetails = async params => {
|
|
182
|
+
const apiService = APIService.getInstance();
|
|
183
|
+
return await apiService.getTokenDetails(params);
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
|
+
const STORAGE_KEY = '@user_data';
|
|
5
|
+
export const setAgentData = async (data, key = STORAGE_KEY) => {
|
|
6
|
+
try {
|
|
7
|
+
const jsonString = JSON.stringify(data);
|
|
8
|
+
await AsyncStorage.setItem(key, jsonString);
|
|
9
|
+
console.log('Data saved to storage successfully');
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error('Storage save error:', error);
|
|
12
|
+
throw error; // Re-throw to allow caller to handle
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const getAgentData = async (key = STORAGE_KEY) => {
|
|
16
|
+
try {
|
|
17
|
+
const jsonString = await AsyncStorage.getItem(key);
|
|
18
|
+
if (!jsonString) {
|
|
19
|
+
console.log('No data stored');
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const data = JSON.parse(jsonString);
|
|
23
|
+
return data;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Storage fetch error:', error);
|
|
26
|
+
throw error; // Re-throw to allow caller to handle
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const deleteFromDetail = async key => {
|
|
30
|
+
try {
|
|
31
|
+
await AsyncStorage.removeItem(key);
|
|
32
|
+
console.log('Storage data reset successfully');
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Storage reset error:', error);
|
|
35
|
+
throw error; // Re-throw to allow caller to handle
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=store.key.js.map
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, Dimensions } from 'react-native';
|
|
4
|
+
const {
|
|
5
|
+
width: SCREEN_WIDTH
|
|
6
|
+
} = Dimensions.get('window');
|
|
7
|
+
|
|
8
|
+
// Calculate dynamic dimensions based on screen size
|
|
9
|
+
const calculateDimensions = () => {
|
|
10
|
+
const isSmallScreen = SCREEN_WIDTH < 375;
|
|
11
|
+
const isLargeScreen = SCREEN_WIDTH > 768;
|
|
12
|
+
return {
|
|
13
|
+
BUTTON_WIDTH: isSmallScreen ? 60 : isLargeScreen ? 60 : 60,
|
|
14
|
+
EXPANDED_WIDTH: SCREEN_WIDTH * (isSmallScreen ? 0.9 : isLargeScreen ? 0.7 : 0.8),
|
|
15
|
+
BUTTON_HEIGHT: isSmallScreen ? 60 : isLargeScreen ? 60 : 60,
|
|
16
|
+
SPACING: {
|
|
17
|
+
SMALL: isSmallScreen ? 8 : isLargeScreen ? 16 : 12,
|
|
18
|
+
MEDIUM: isSmallScreen ? 12 : isLargeScreen ? 20 : 16,
|
|
19
|
+
LARGE: isSmallScreen ? 16 : isLargeScreen ? 24 : 20
|
|
20
|
+
},
|
|
21
|
+
BORDER_RADIUS: {
|
|
22
|
+
SMALL: isSmallScreen ? 20 : isLargeScreen ? 30 : 25,
|
|
23
|
+
MEDIUM: isSmallScreen ? 25 : isLargeScreen ? 35 : 30,
|
|
24
|
+
LARGE: isSmallScreen ? 30 : isLargeScreen ? 40 : 35
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const dimensions = calculateDimensions();
|
|
29
|
+
export const BUTTON_WIDTH = dimensions.BUTTON_WIDTH;
|
|
30
|
+
export const EXPANDED_WIDTH = dimensions.EXPANDED_WIDTH;
|
|
31
|
+
export const BUTTON_HEIGHT = dimensions.BUTTON_HEIGHT;
|
|
32
|
+
export const createOnwidButtonStyles = customStyles => {
|
|
33
|
+
const {
|
|
34
|
+
buttonWidth = BUTTON_WIDTH,
|
|
35
|
+
buttonHeight = BUTTON_HEIGHT,
|
|
36
|
+
backgroundColor = 'transparent',
|
|
37
|
+
borderRadius = dimensions.BORDER_RADIUS.MEDIUM,
|
|
38
|
+
marginBottom = dimensions.SPACING.LARGE,
|
|
39
|
+
spacing = dimensions.SPACING
|
|
40
|
+
} = customStyles || {};
|
|
41
|
+
return StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
bottom: 0,
|
|
45
|
+
right: 0,
|
|
46
|
+
height: '100%',
|
|
47
|
+
width: '100%',
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
justifyContent: 'flex-end',
|
|
50
|
+
alignItems: 'flex-end',
|
|
51
|
+
padding: spacing.MEDIUM,
|
|
52
|
+
backgroundColor: 'transparent',
|
|
53
|
+
pointerEvents: 'box-none'
|
|
54
|
+
},
|
|
55
|
+
button: {
|
|
56
|
+
width: buttonWidth,
|
|
57
|
+
height: buttonHeight,
|
|
58
|
+
borderRadius: borderRadius,
|
|
59
|
+
marginBottom: marginBottom,
|
|
60
|
+
backgroundColor: backgroundColor
|
|
61
|
+
},
|
|
62
|
+
pressable: {
|
|
63
|
+
borderRadius: 100,
|
|
64
|
+
padding: 5,
|
|
65
|
+
margin: 0,
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
height: '100%',
|
|
69
|
+
width: '100%'
|
|
70
|
+
},
|
|
71
|
+
menu: {
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
top: 0,
|
|
74
|
+
backgroundColor: 'white',
|
|
75
|
+
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
76
|
+
padding: spacing.MEDIUM
|
|
77
|
+
},
|
|
78
|
+
menuLeft: {
|
|
79
|
+
right: '100%',
|
|
80
|
+
marginRight: spacing.SMALL
|
|
81
|
+
},
|
|
82
|
+
menuRight: {
|
|
83
|
+
left: '100%',
|
|
84
|
+
marginLeft: spacing.SMALL
|
|
85
|
+
},
|
|
86
|
+
iconText: {
|
|
87
|
+
color: 'white',
|
|
88
|
+
fontSize: 20
|
|
89
|
+
},
|
|
90
|
+
buttonContent: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center'
|
|
93
|
+
// height: '100%',
|
|
94
|
+
},
|
|
95
|
+
iconImage: {
|
|
96
|
+
width: buttonWidth - 10,
|
|
97
|
+
height: buttonHeight - 10,
|
|
98
|
+
resizeMode: 'contain',
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
alignSelf: 'center',
|
|
102
|
+
margin: 0,
|
|
103
|
+
padding: 0
|
|
104
|
+
},
|
|
105
|
+
startCallButton: {
|
|
106
|
+
height: 36,
|
|
107
|
+
borderRadius: dimensions.BORDER_RADIUS.MEDIUM,
|
|
108
|
+
backgroundColor: '#000',
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
paddingHorizontal: spacing.SMALL + 1,
|
|
112
|
+
minWidth: 80,
|
|
113
|
+
maxWidth: '90%'
|
|
114
|
+
},
|
|
115
|
+
startCallText: {
|
|
116
|
+
color: 'white',
|
|
117
|
+
fontSize: 12,
|
|
118
|
+
fontWeight: '500'
|
|
119
|
+
},
|
|
120
|
+
rowContainer: {
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
height: '100%',
|
|
125
|
+
margin: 0,
|
|
126
|
+
padding: 0
|
|
127
|
+
},
|
|
128
|
+
linearGradient: {
|
|
129
|
+
flex: 1,
|
|
130
|
+
borderRadius: dimensions.BORDER_RADIUS.LARGE,
|
|
131
|
+
flexDirection: 'row',
|
|
132
|
+
width: BUTTON_WIDTH
|
|
133
|
+
},
|
|
134
|
+
buttonContainer: {
|
|
135
|
+
flexDirection: 'row',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: 4
|
|
138
|
+
},
|
|
139
|
+
endCallButton: {
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
alignItems: 'center',
|
|
142
|
+
width: 44,
|
|
143
|
+
height: 44
|
|
144
|
+
},
|
|
145
|
+
muteButton: {
|
|
146
|
+
borderRadius: 100,
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
width: 44,
|
|
150
|
+
height: 44
|
|
151
|
+
},
|
|
152
|
+
micIcon: {
|
|
153
|
+
width: 24,
|
|
154
|
+
height: 24,
|
|
155
|
+
tintColor: 'white'
|
|
156
|
+
},
|
|
157
|
+
endCallIcon: {
|
|
158
|
+
width: 24,
|
|
159
|
+
height: 24,
|
|
160
|
+
tintColor: 'white'
|
|
161
|
+
},
|
|
162
|
+
buttonImage: {
|
|
163
|
+
width: '100%',
|
|
164
|
+
height: '100%',
|
|
165
|
+
resizeMode: 'contain'
|
|
166
|
+
},
|
|
167
|
+
// New styles for expanded button layout
|
|
168
|
+
expandedContent: {
|
|
169
|
+
flexDirection: 'row',
|
|
170
|
+
flex: 1,
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
width: '100%',
|
|
173
|
+
justifyContent: 'space-between'
|
|
174
|
+
},
|
|
175
|
+
leftSection: {
|
|
176
|
+
alignItems: 'flex-start'
|
|
177
|
+
},
|
|
178
|
+
centerSection: {
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
height: '100%'
|
|
181
|
+
},
|
|
182
|
+
rightSection: {
|
|
183
|
+
justifyContent: 'flex-end',
|
|
184
|
+
alignItems: 'center'
|
|
185
|
+
},
|
|
186
|
+
agentInfoContainer: {
|
|
187
|
+
height: BUTTON_HEIGHT,
|
|
188
|
+
flexDirection: 'row',
|
|
189
|
+
alignItems: 'center',
|
|
190
|
+
overflow: 'hidden'
|
|
191
|
+
},
|
|
192
|
+
agentTextContainer: {
|
|
193
|
+
justifyContent: 'center',
|
|
194
|
+
height: '100%',
|
|
195
|
+
flex: 1
|
|
196
|
+
},
|
|
197
|
+
agentNameText: {
|
|
198
|
+
fontFamily: 'Inter-Medium',
|
|
199
|
+
fontSize: 14,
|
|
200
|
+
fontWeight: '500',
|
|
201
|
+
color: 'white'
|
|
202
|
+
},
|
|
203
|
+
statusText: {
|
|
204
|
+
fontFamily: 'Inter-Regular',
|
|
205
|
+
fontSize: 10,
|
|
206
|
+
fontWeight: '300',
|
|
207
|
+
color: 'white'
|
|
208
|
+
},
|
|
209
|
+
// Chip styles
|
|
210
|
+
chip: {
|
|
211
|
+
height: 30,
|
|
212
|
+
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
213
|
+
marginBottom: 10,
|
|
214
|
+
alignSelf: 'flex-end',
|
|
215
|
+
overflow: 'hidden',
|
|
216
|
+
elevation: 3,
|
|
217
|
+
shadowColor: '#000',
|
|
218
|
+
shadowOffset: {
|
|
219
|
+
width: 0,
|
|
220
|
+
height: 2
|
|
221
|
+
},
|
|
222
|
+
shadowOpacity: 0.3,
|
|
223
|
+
shadowRadius: 2
|
|
224
|
+
},
|
|
225
|
+
chipGradient: {
|
|
226
|
+
height: '100%',
|
|
227
|
+
paddingHorizontal: spacing.MEDIUM,
|
|
228
|
+
paddingVertical: spacing.SMALL / 2,
|
|
229
|
+
borderRadius: dimensions.BORDER_RADIUS.SMALL,
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
alignItems: 'center'
|
|
232
|
+
},
|
|
233
|
+
chipText: {
|
|
234
|
+
color: 'white',
|
|
235
|
+
fontSize: 12,
|
|
236
|
+
fontWeight: '500'
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// Default styles export with dynamic dimensions
|
|
242
|
+
export const onwidButtonStyles = createOnwidButtonStyles();
|
|
243
|
+
//# sourceMappingURL=onwidButton.style.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file reanimatedHelpers.ts
|
|
5
|
+
* @description Utility functions to handle react-native-reanimated configuration and provide fallbacks
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
let reanimatedAPI;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Safely loads react-native-reanimated and provides fallbacks if not available
|
|
12
|
+
*/
|
|
13
|
+
export function getReanimatedAPI() {
|
|
14
|
+
if (reanimatedAPI) {
|
|
15
|
+
return reanimatedAPI;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const reanimated = require('react-native-reanimated');
|
|
19
|
+
|
|
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
|
+
} catch (error) {
|
|
39
|
+
console.warn('⚠️ react-native-reanimated is not properly installed or configured:', error);
|
|
40
|
+
console.warn('📚 Please follow the setup guide: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started');
|
|
41
|
+
|
|
42
|
+
// Provide fallback implementations
|
|
43
|
+
const {
|
|
44
|
+
View
|
|
45
|
+
} = require('react-native');
|
|
46
|
+
reanimatedAPI = {
|
|
47
|
+
useSharedValue: value => ({
|
|
48
|
+
value
|
|
49
|
+
}),
|
|
50
|
+
useAnimatedStyle: () => ({}),
|
|
51
|
+
withTiming: value => value,
|
|
52
|
+
withSpring: value => value,
|
|
53
|
+
withRepeat: value => value,
|
|
54
|
+
withSequence: (...args) => args[args.length - 1],
|
|
55
|
+
runOnJS: fn => fn,
|
|
56
|
+
Easing: {
|
|
57
|
+
inOut: easing => easing,
|
|
58
|
+
ease: t => t
|
|
59
|
+
},
|
|
60
|
+
Animated: View,
|
|
61
|
+
isAvailable: false
|
|
62
|
+
};
|
|
63
|
+
return reanimatedAPI;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Check if react-native-reanimated is properly configured
|
|
69
|
+
*/
|
|
70
|
+
export function checkReanimatedSetup() {
|
|
71
|
+
const api = getReanimatedAPI();
|
|
72
|
+
return api.isAvailable;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Display a helpful error message if reanimated is not configured
|
|
77
|
+
*/
|
|
78
|
+
export function showReanimatedSetupError() {
|
|
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
|
+
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
|
+
}
|
|
94
|
+
//# sourceMappingURL=reanimatedHelpers.js.map
|
|
@@ -7,7 +7,7 @@ import onwid, { EventKeys } from './Event/onwid';
|
|
|
7
7
|
import { useInitialize } from './hooks/initialize';
|
|
8
8
|
import type { UseInitializeProps } from './hooks/initialize.types';
|
|
9
9
|
import registerAgent from './hooks/initializelivekit';
|
|
10
|
-
import type { ApiResponse, RegisterRequest, TokenDetails } from './onwidApi/api.types';
|
|
10
|
+
import type { ApiResponse, RegisterRequest, TokenDetails, UpdateDataRequest } from './onwidApi/api.types';
|
|
11
11
|
/**
|
|
12
12
|
* OnwidButton component that provides a customizable button with menu functionality
|
|
13
13
|
* @returns React component
|
|
@@ -20,8 +20,8 @@ export declare function OnwidButton(): import("react/jsx-runtime").JSX.Element;
|
|
|
20
20
|
* @property {Function} registerAgent - Function to register the Agent (Optional)
|
|
21
21
|
* @property {OnWid} onwid - Event management system instance
|
|
22
22
|
* @property {useInitialize} useInitialize - Hook to initialize the Onwid SDK
|
|
23
|
-
* @property {useVoiceAgent} useVoiceAgent - Hook for voice agent functionality
|
|
24
23
|
* @property {EventKeys} EventKeys - Available event types
|
|
25
24
|
*/
|
|
26
25
|
export { EventKeys, onwid, registerAgent, useInitialize };
|
|
27
|
-
export type { ApiResponse, RegisterRequest, TokenDetails, UseInitializeProps };
|
|
26
|
+
export type { ApiResponse, RegisterRequest, TokenDetails, UseInitializeProps, UpdateDataRequest };
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const setAgentData: (data: Record<string, any>, key?: string) => Promise<void>;
|
|
2
2
|
export declare const getAgentData: (key?: string) => Promise<any>;
|
|
3
3
|
export declare const deleteFromDetail: (key: string) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=store.key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=utils.d.ts.map
|