@onairos/react-native 3.0.56 → 3.0.58

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.
Files changed (34) hide show
  1. package/lib/commonjs/components/DataRequestModal.js +87 -35
  2. package/lib/commonjs/components/DataRequestModal.js.map +1 -1
  3. package/lib/commonjs/components/OnairosButton.js +2 -0
  4. package/lib/commonjs/components/OnairosButton.js.map +1 -1
  5. package/lib/commonjs/components/Overlay.js +1 -1
  6. package/lib/commonjs/components/Overlay.js.map +1 -1
  7. package/lib/commonjs/components/TrainingModal.js +1 -1
  8. package/lib/commonjs/components/UniversalOnboarding.js +30 -29
  9. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  10. package/lib/module/components/DataRequestModal.js +88 -36
  11. package/lib/module/components/DataRequestModal.js.map +1 -1
  12. package/lib/module/components/OnairosButton.js +2 -0
  13. package/lib/module/components/OnairosButton.js.map +1 -1
  14. package/lib/module/components/Overlay.js +1 -1
  15. package/lib/module/components/Overlay.js.map +1 -1
  16. package/lib/module/components/TrainingModal.js +1 -1
  17. package/lib/module/components/UniversalOnboarding.js +30 -29
  18. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  19. package/lib/typescript/components/DataRequestModal.d.ts +1 -1
  20. package/lib/typescript/components/DataRequestModal.d.ts.map +1 -1
  21. package/lib/typescript/components/OnairosButton.d.ts +1 -1
  22. package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
  23. package/lib/typescript/components/Overlay.d.ts +1 -20
  24. package/lib/typescript/components/Overlay.d.ts.map +1 -1
  25. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
  26. package/lib/typescript/types.d.ts +32 -11
  27. package/lib/typescript/types.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/DataRequestModal.tsx +226 -186
  30. package/src/components/OnairosButton.tsx +3 -1
  31. package/src/components/Overlay.tsx +2 -16
  32. package/src/components/TrainingModal.tsx +1 -1
  33. package/src/components/UniversalOnboarding.tsx +31 -25
  34. package/src/types.ts +35 -11
@@ -1,187 +1,227 @@
1
- import React from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- TouchableOpacity,
7
- ScrollView,
8
- Modal,
9
- } from 'react-native';
10
- import Icon from 'react-native-vector-icons/MaterialIcons';
11
- import { COLORS, PLATFORMS } from '../constants';
12
-
13
- interface DataRequestModalProps {
14
- visible: boolean;
15
- onClose: () => void;
16
- onAccept: () => void;
17
- requestData: Record<string, Record<string, string>>;
18
- AppName: string;
19
- }
20
-
21
- export const DataRequestModal: React.FC<DataRequestModalProps> = ({
22
- visible,
23
- onClose,
24
- onAccept,
25
- requestData,
26
- AppName,
27
- }) => {
28
- const renderPermissions = () => {
29
- return Object.entries(requestData).map(([platform, permissions]) => {
30
- const platformConfig = PLATFORMS[platform];
31
- if (!platformConfig) return null;
32
-
33
- return (
34
- <View key={platform} style={styles.platformContainer}>
35
- <View style={styles.platformHeader}>
36
- <Icon name={platformConfig.icon} size={24} color={platformConfig.color} />
37
- <Text style={styles.platformName}>{platformConfig.name}</Text>
38
- </View>
39
- <View style={styles.permissionsContainer}>
40
- {Object.entries(permissions).map(([key, value]) => (
41
- <Text key={key} style={styles.permissionText}>
42
- • {key}: {value}
43
- </Text>
44
- ))}
45
- </View>
46
- </View>
47
- );
48
- });
49
- };
50
-
51
- return (
52
- <Modal
53
- visible={visible}
54
- transparent
55
- animationType="slide"
56
- onRequestClose={onClose}
57
- >
58
- <View style={styles.modalOverlay}>
59
- <View style={styles.modalContent}>
60
- <View style={styles.header}>
61
- <Icon name="auto_awesome" size={24} color={COLORS.primary} />
62
- <Text style={styles.headerTitle}>
63
- {AppName} Data Request
64
- </Text>
65
- <TouchableOpacity onPress={onClose} style={styles.closeButton}>
66
- <Icon name="close" size={24} color="#000" />
67
- </TouchableOpacity>
68
- </View>
69
-
70
- <ScrollView style={styles.scrollContent}>
71
- <Text style={styles.description}>
72
- {AppName} is requesting access to the following data:
73
- </Text>
74
- {renderPermissions()}
75
- </ScrollView>
76
-
77
- <View style={styles.footer}>
78
- <TouchableOpacity
79
- style={[styles.button, styles.cancelButton]}
80
- onPress={onClose}
81
- >
82
- <Text style={styles.cancelButtonText}>Cancel</Text>
83
- </TouchableOpacity>
84
- <TouchableOpacity
85
- style={[styles.button, styles.acceptButton]}
86
- onPress={onAccept}
87
- >
88
- <Text style={styles.acceptButtonText}>Accept</Text>
89
- </TouchableOpacity>
90
- </View>
91
- </View>
92
- </View>
93
- </Modal>
94
- );
95
- };
96
-
97
- const styles = StyleSheet.create({
98
- modalOverlay: {
99
- flex: 1,
100
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
101
- justifyContent: 'center',
102
- alignItems: 'center',
103
- },
104
- modalContent: {
105
- backgroundColor: '#fff',
106
- borderRadius: 16,
107
- width: '90%',
108
- maxHeight: '80%',
109
- overflow: 'hidden',
110
- },
111
- header: {
112
- flexDirection: 'row',
113
- alignItems: 'center',
114
- padding: 16,
115
- backgroundColor: COLORS.headerBg,
116
- },
117
- headerTitle: {
118
- flex: 1,
119
- fontSize: 18,
120
- fontWeight: '600',
121
- marginLeft: 12,
122
- color: '#000',
123
- },
124
- closeButton: {
125
- padding: 8,
126
- },
127
- scrollContent: {
128
- padding: 16,
129
- },
130
- description: {
131
- fontSize: 16,
132
- color: COLORS.text.secondary,
133
- marginBottom: 16,
134
- },
135
- platformContainer: {
136
- marginBottom: 16,
137
- borderWidth: 1,
138
- borderColor: COLORS.border,
139
- borderRadius: 8,
140
- padding: 12,
141
- },
142
- platformHeader: {
143
- flexDirection: 'row',
144
- alignItems: 'center',
145
- marginBottom: 8,
146
- },
147
- platformName: {
148
- fontSize: 16,
149
- fontWeight: '600',
150
- marginLeft: 8,
151
- },
152
- permissionsContainer: {
153
- marginLeft: 32,
154
- },
155
- permissionText: {
156
- fontSize: 14,
157
- color: COLORS.text.secondary,
158
- marginBottom: 4,
159
- },
160
- footer: {
161
- flexDirection: 'row',
162
- padding: 16,
163
- borderTopWidth: 1,
164
- borderTopColor: COLORS.border,
165
- justifyContent: 'flex-end',
166
- },
167
- button: {
168
- paddingHorizontal: 20,
169
- paddingVertical: 10,
170
- borderRadius: 8,
171
- marginLeft: 12,
172
- },
173
- cancelButton: {
174
- backgroundColor: COLORS.border,
175
- },
176
- acceptButton: {
177
- backgroundColor: COLORS.primary,
178
- },
179
- cancelButtonText: {
180
- color: COLORS.text.secondary,
181
- fontWeight: '600',
182
- },
183
- acceptButtonText: {
184
- color: '#fff',
185
- fontWeight: '600',
186
- },
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ ScrollView,
8
+ Modal,
9
+ } from 'react-native';
10
+ import Icon from 'react-native-vector-icons/MaterialIcons';
11
+ import { COLORS, PLATFORMS } from '../constants';
12
+
13
+ interface DataRequestModalProps {
14
+ visible: boolean;
15
+ onClose: () => void;
16
+ onAccept: () => void;
17
+ requestData: Record<string, any>;
18
+ AppName: string;
19
+ }
20
+
21
+ export const DataRequestModal: React.FC<DataRequestModalProps> = ({
22
+ visible,
23
+ onClose,
24
+ onAccept,
25
+ requestData,
26
+ AppName,
27
+ }) => {
28
+ const renderDataRequests = () => {
29
+ return Object.entries(requestData).map(([key, data]) => {
30
+ // Skip if data is undefined or doesn't have the expected structure
31
+ if (!data || typeof data !== 'object') return null;
32
+
33
+ // Handle new format (personality_traits, sentiment_analysis)
34
+ if ('name' in data && 'description' in data && 'reward' in data) {
35
+ return (
36
+ <View key={key} style={styles.dataRequestContainer}>
37
+ <View style={styles.dataRequestHeader}>
38
+ <Icon
39
+ name={key === 'personality_traits' ? 'psychology' : 'analytics'}
40
+ size={24}
41
+ color={COLORS.primary}
42
+ />
43
+ <Text style={styles.dataRequestName}>{data.name}</Text>
44
+ </View>
45
+ <Text style={styles.dataRequestDescription}>{data.description}</Text>
46
+ <View style={styles.rewardContainer}>
47
+ <Icon name="star" size={16} color="#FFD700" />
48
+ <Text style={styles.rewardText}>{data.reward}</Text>
49
+ </View>
50
+ </View>
51
+ );
52
+ }
53
+
54
+ // Handle old format (Small, Medium, Large) for backward compatibility
55
+ if ('type' in data && 'descriptions' in data && 'reward' in data) {
56
+ return (
57
+ <View key={key} style={styles.dataRequestContainer}>
58
+ <View style={styles.dataRequestHeader}>
59
+ <Icon name="data_usage" size={24} color={COLORS.primary} />
60
+ <Text style={styles.dataRequestName}>{key} - {data.type}</Text>
61
+ </View>
62
+ <Text style={styles.dataRequestDescription}>{data.descriptions}</Text>
63
+ <View style={styles.rewardContainer}>
64
+ <Icon name="star" size={16} color="#FFD700" />
65
+ <Text style={styles.rewardText}>{data.reward}</Text>
66
+ </View>
67
+ </View>
68
+ );
69
+ }
70
+
71
+ return null;
72
+ });
73
+ };
74
+
75
+ return (
76
+ <Modal
77
+ visible={visible}
78
+ transparent
79
+ animationType="slide"
80
+ onRequestClose={onClose}
81
+ >
82
+ <View style={styles.modalOverlay}>
83
+ <View style={styles.modalContent}>
84
+ <View style={styles.header}>
85
+ <Icon name="auto_awesome" size={24} color={COLORS.primary} />
86
+ <Text style={styles.headerTitle}>
87
+ {AppName} Data Request
88
+ </Text>
89
+ <TouchableOpacity onPress={onClose} style={styles.closeButton}>
90
+ <Icon name="close" size={24} color="#000" />
91
+ </TouchableOpacity>
92
+ </View>
93
+
94
+ <ScrollView style={styles.scrollContent}>
95
+ <Text style={styles.description}>
96
+ {AppName} is requesting access to the following data insights:
97
+ </Text>
98
+ {renderDataRequests()}
99
+ </ScrollView>
100
+
101
+ <View style={styles.footer}>
102
+ <TouchableOpacity
103
+ style={[styles.button, styles.cancelButton]}
104
+ onPress={onClose}
105
+ >
106
+ <Text style={styles.cancelButtonText}>Cancel</Text>
107
+ </TouchableOpacity>
108
+ <TouchableOpacity
109
+ style={[styles.button, styles.acceptButton]}
110
+ onPress={onAccept}
111
+ >
112
+ <Text style={styles.acceptButtonText}>Accept</Text>
113
+ </TouchableOpacity>
114
+ </View>
115
+ </View>
116
+ </View>
117
+ </Modal>
118
+ );
119
+ };
120
+
121
+ const styles = StyleSheet.create({
122
+ modalOverlay: {
123
+ flex: 1,
124
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
125
+ justifyContent: 'center',
126
+ alignItems: 'center',
127
+ },
128
+ modalContent: {
129
+ backgroundColor: '#fff',
130
+ borderRadius: 16,
131
+ width: '90%',
132
+ maxHeight: '80%',
133
+ overflow: 'hidden',
134
+ },
135
+ header: {
136
+ flexDirection: 'row',
137
+ alignItems: 'center',
138
+ padding: 16,
139
+ backgroundColor: COLORS.headerBg,
140
+ },
141
+ headerTitle: {
142
+ flex: 1,
143
+ fontSize: 18,
144
+ fontWeight: '600',
145
+ marginLeft: 12,
146
+ color: '#000',
147
+ },
148
+ closeButton: {
149
+ padding: 8,
150
+ },
151
+ scrollContent: {
152
+ padding: 16,
153
+ },
154
+ description: {
155
+ fontSize: 16,
156
+ color: COLORS.text.secondary,
157
+ marginBottom: 16,
158
+ },
159
+ dataRequestContainer: {
160
+ marginBottom: 16,
161
+ borderWidth: 1,
162
+ borderColor: COLORS.border,
163
+ borderRadius: 12,
164
+ padding: 16,
165
+ backgroundColor: '#f8f9fa',
166
+ },
167
+ dataRequestHeader: {
168
+ flexDirection: 'row',
169
+ alignItems: 'center',
170
+ marginBottom: 12,
171
+ },
172
+ dataRequestName: {
173
+ fontSize: 18,
174
+ fontWeight: '600',
175
+ marginLeft: 12,
176
+ color: '#000',
177
+ },
178
+ dataRequestDescription: {
179
+ fontSize: 14,
180
+ color: COLORS.text.secondary,
181
+ marginBottom: 12,
182
+ lineHeight: 20,
183
+ },
184
+ rewardContainer: {
185
+ flexDirection: 'row',
186
+ alignItems: 'center',
187
+ backgroundColor: '#fff',
188
+ padding: 8,
189
+ borderRadius: 8,
190
+ borderLeftWidth: 3,
191
+ borderLeftColor: '#FFD700',
192
+ },
193
+ rewardText: {
194
+ fontSize: 14,
195
+ fontWeight: '500',
196
+ marginLeft: 6,
197
+ color: '#000',
198
+ flex: 1,
199
+ },
200
+ footer: {
201
+ flexDirection: 'row',
202
+ padding: 16,
203
+ borderTopWidth: 1,
204
+ borderTopColor: COLORS.border,
205
+ justifyContent: 'flex-end',
206
+ },
207
+ button: {
208
+ paddingHorizontal: 20,
209
+ paddingVertical: 10,
210
+ borderRadius: 8,
211
+ marginLeft: 12,
212
+ },
213
+ cancelButton: {
214
+ backgroundColor: COLORS.border,
215
+ },
216
+ acceptButton: {
217
+ backgroundColor: COLORS.primary,
218
+ },
219
+ cancelButtonText: {
220
+ color: COLORS.text.secondary,
221
+ fontWeight: '600',
222
+ },
223
+ acceptButtonText: {
224
+ color: '#fff',
225
+ fontWeight: '600',
226
+ },
187
227
  });
@@ -12,7 +12,7 @@ import {
12
12
  import { UniversalOnboarding } from './UniversalOnboarding';
13
13
  import { Overlay } from './Overlay';
14
14
  import { COLORS } from '../constants';
15
- import type { OnairosButtonProps } from '../types/index';
15
+ import type { OnairosButtonProps } from '../types';
16
16
  import { hasCredentials, getCredentials, deleteCredentials as clearCredentials } from '../utils/secureStorage';
17
17
  import { onairosApi } from '../api';
18
18
 
@@ -26,6 +26,7 @@ export interface OnairosButtonRef {
26
26
  */
27
27
  export const OnairosButton = forwardRef<OnairosButtonRef, OnairosButtonProps>(({
28
28
  AppName,
29
+ appIcon,
29
30
  requestData,
30
31
  returnLink,
31
32
  prefillUrl,
@@ -282,6 +283,7 @@ export const OnairosButton = forwardRef<OnairosButtonRef, OnairosButtonProps>(({
282
283
  onRejection?.('User closed onboarding');
283
284
  }}
284
285
  AppName={AppName}
286
+ appIcon={appIcon}
285
287
  requestData={requestData as any}
286
288
  returnLink={returnLink || ''}
287
289
  onComplete={handleOnboardingComplete}
@@ -22,21 +22,7 @@ import { COLORS } from '../constants';
22
22
 
23
23
  const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
24
24
 
25
- interface OverlayProps {
26
- data: {
27
- [key: string]: {
28
- type: string;
29
- descriptions: string;
30
- reward: string;
31
- };
32
- };
33
- username: string;
34
- modelKey: string;
35
- onResolved: (apiUrl: string, accessToken: string, loginDetails: any) => void;
36
- appName?: string;
37
- darkMode?: boolean;
38
- platforms?: Array<{id: string, name: string, icon: any}>;
39
- }
25
+ import type { OverlayProps } from '../types';
40
26
 
41
27
  export const Overlay: React.FC<OverlayProps> = ({
42
28
  data,
@@ -341,7 +327,7 @@ const styles = StyleSheet.create({
341
327
  borderTopLeftRadius: 24,
342
328
  borderTopRightRadius: 24,
343
329
  width: SCREEN_WIDTH,
344
- height: SCREEN_HEIGHT * 0.6,
330
+ height: SCREEN_HEIGHT * 0.8,
345
331
  overflow: 'hidden',
346
332
  },
347
333
  handleContainer: {
@@ -280,7 +280,7 @@ const styles = StyleSheet.create({
280
280
  bottomSheet: {
281
281
  backgroundColor: '#fff',
282
282
  width: width,
283
- height: height * 0.6,
283
+ height: height * 0.8,
284
284
  borderTopLeftRadius: 24,
285
285
  borderTopRightRadius: 24,
286
286
  overflow: 'hidden',
@@ -50,6 +50,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
50
50
  visible,
51
51
  onClose,
52
52
  AppName,
53
+ appIcon,
53
54
  requestData,
54
55
  returnLink,
55
56
  onComplete,
@@ -605,6 +606,12 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
605
606
  }, [handleClose]);
606
607
 
607
608
  const canProceedToPin = useCallback(() => {
609
+ // For testing, allow proceeding without any platforms connected
610
+ if (debug || test) {
611
+ console.log('🧪 Testing mode: Allowing proceed without platform connections');
612
+ return true;
613
+ }
614
+
608
615
  // Check if at least one platform is toggled on
609
616
  const hasPlatformConnected = Object.values(platformToggles).some(value => value === true);
610
617
 
@@ -615,7 +622,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
615
622
  }
616
623
 
617
624
  return hasPlatformConnected;
618
- }, [platformToggles, auto, partner, inferenceData]);
625
+ }, [platformToggles, auto, partner, inferenceData, debug, test]);
619
626
 
620
627
  const handleProceed = () => {
621
628
  console.log('Proceeding to next step');
@@ -775,15 +782,9 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
775
782
 
776
783
  {step === 'connect' && (
777
784
  <>
778
- {/* Header with app icon and arrow to Onairos icon */}
785
+ {/* Header with Onairos icon and arrow to app icon */}
779
786
  <View style={styles.header}>
780
787
  <View style={styles.headerContent}>
781
- <View style={styles.appIcon}>
782
- <Text style={styles.appIconText}>
783
- {AppName.charAt(0)}
784
- </Text>
785
- </View>
786
- <Icon name="arrow-forward" size={24} color="#666" style={styles.arrow} />
787
788
  <View style={styles.onairosIcon}>
788
789
  <Image
789
790
  source={require('../assets/images/onairos_logo.png')}
@@ -791,6 +792,20 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
791
792
  resizeMode="contain"
792
793
  />
793
794
  </View>
795
+ <Icon name="arrow-forward" size={24} color="#666" style={styles.arrow} />
796
+ <View style={styles.appIcon}>
797
+ {appIcon ? (
798
+ <Image
799
+ source={appIcon}
800
+ style={styles.appIconImage}
801
+ resizeMode="contain"
802
+ />
803
+ ) : (
804
+ <Text style={styles.appIconText}>
805
+ {AppName.charAt(0)}
806
+ </Text>
807
+ )}
808
+ </View>
794
809
  </View>
795
810
 
796
811
 
@@ -953,21 +968,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
953
968
  visible={showDataRequestModal}
954
969
  onClose={handleDataRequestDecline}
955
970
  onAccept={handleDataRequestAccept}
956
- requestData={{
957
- // Convert DataTier format to expected format
958
- Small: {
959
- description: requestData.Small?.descriptions || 'Basic data access',
960
- type: requestData.Small?.type || 'basic'
961
- },
962
- Medium: {
963
- description: requestData.Medium?.descriptions || 'Standard data access',
964
- type: requestData.Medium?.type || 'standard'
965
- },
966
- Large: {
967
- description: requestData.Large?.descriptions || 'Full data access',
968
- type: requestData.Large?.type || 'full'
969
- }
970
- }}
971
+ requestData={requestData}
971
972
  AppName={AppName}
972
973
  />
973
974
  )}
@@ -985,7 +986,7 @@ const styles = StyleSheet.create({
985
986
  bottomSheet: {
986
987
  backgroundColor: '#fff',
987
988
  width: width,
988
- height: height * 0.6,
989
+ height: height * 0.8,
989
990
  borderTopLeftRadius: 24,
990
991
  borderTopRightRadius: 24,
991
992
  overflow: 'hidden',
@@ -1028,6 +1029,10 @@ const styles = StyleSheet.create({
1028
1029
  fontSize: 24,
1029
1030
  color: '#000',
1030
1031
  },
1032
+ appIconImage: {
1033
+ width: 32,
1034
+ height: 32,
1035
+ },
1031
1036
  arrow: {
1032
1037
  marginHorizontal: 16,
1033
1038
  },
@@ -1213,9 +1218,10 @@ const styles = StyleSheet.create({
1213
1218
  // Email input styles
1214
1219
  emailInputContainer: {
1215
1220
  flex: 1,
1216
- justifyContent: 'center',
1221
+ justifyContent: 'flex-start',
1217
1222
  alignItems: 'center',
1218
1223
  padding: 24,
1224
+ paddingTop: 60,
1219
1225
  },
1220
1226
  emailHeader: {
1221
1227
  alignItems: 'center',