@onairos/react-native 1.0.0

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 (130) hide show
  1. package/README.md +334 -0
  2. package/lib/commonjs/components/DataRequestModal.js +176 -0
  3. package/lib/commonjs/components/DataRequestModal.js.map +1 -0
  4. package/lib/commonjs/components/Notification.js +106 -0
  5. package/lib/commonjs/components/Notification.js.map +1 -0
  6. package/lib/commonjs/components/OnairosButton.js +575 -0
  7. package/lib/commonjs/components/OnairosButton.js.map +1 -0
  8. package/lib/commonjs/components/Overlay.js +818 -0
  9. package/lib/commonjs/components/Overlay.js.map +1 -0
  10. package/lib/commonjs/components/UniversalOnboarding.js +173 -0
  11. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -0
  12. package/lib/commonjs/components/onboarding/OAuthWebView.js +137 -0
  13. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -0
  14. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -0
  15. package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +1 -0
  16. package/lib/commonjs/components/onboarding/PinInput.js +283 -0
  17. package/lib/commonjs/components/onboarding/PinInput.js.map +1 -0
  18. package/lib/commonjs/components/onboarding/PlatformConnector.js +244 -0
  19. package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -0
  20. package/lib/commonjs/components/screens/ConnectorScreen.js +145 -0
  21. package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -0
  22. package/lib/commonjs/components/screens/LoadingScreen.js +91 -0
  23. package/lib/commonjs/components/screens/LoadingScreen.js.map +1 -0
  24. package/lib/commonjs/components/screens/PinCreationScreen.js +61 -0
  25. package/lib/commonjs/components/screens/PinCreationScreen.js.map +1 -0
  26. package/lib/commonjs/constants/index.js +78 -0
  27. package/lib/commonjs/constants/index.js.map +1 -0
  28. package/lib/commonjs/hooks/useConnections.js +89 -0
  29. package/lib/commonjs/hooks/useConnections.js.map +1 -0
  30. package/lib/commonjs/hooks/useCredentials.js +85 -0
  31. package/lib/commonjs/hooks/useCredentials.js.map +1 -0
  32. package/lib/commonjs/index.js +282 -0
  33. package/lib/commonjs/index.js.map +1 -0
  34. package/lib/commonjs/services/oauthService.js +362 -0
  35. package/lib/commonjs/services/oauthService.js.map +1 -0
  36. package/lib/commonjs/types/declarations.d.js +2 -0
  37. package/lib/commonjs/types/declarations.d.js.map +1 -0
  38. package/lib/commonjs/types/index.js +2 -0
  39. package/lib/commonjs/types/index.js.map +1 -0
  40. package/lib/commonjs/utils/api.js +129 -0
  41. package/lib/commonjs/utils/api.js.map +1 -0
  42. package/lib/commonjs/utils/auth.js +111 -0
  43. package/lib/commonjs/utils/auth.js.map +1 -0
  44. package/lib/commonjs/utils/crypto.js +62 -0
  45. package/lib/commonjs/utils/crypto.js.map +1 -0
  46. package/lib/commonjs/utils/debugHelper.js +64 -0
  47. package/lib/commonjs/utils/debugHelper.js.map +1 -0
  48. package/lib/commonjs/utils/onairosApi.js +270 -0
  49. package/lib/commonjs/utils/onairosApi.js.map +1 -0
  50. package/lib/commonjs/utils/secureStorage.js +210 -0
  51. package/lib/commonjs/utils/secureStorage.js.map +1 -0
  52. package/lib/module/components/DataRequestModal.js +168 -0
  53. package/lib/module/components/DataRequestModal.js.map +1 -0
  54. package/lib/module/components/Notification.js +99 -0
  55. package/lib/module/components/Notification.js.map +1 -0
  56. package/lib/module/components/OnairosButton.js +550 -0
  57. package/lib/module/components/OnairosButton.js.map +1 -0
  58. package/lib/module/components/Overlay.js +825 -0
  59. package/lib/module/components/Overlay.js.map +1 -0
  60. package/lib/module/components/UniversalOnboarding.js +164 -0
  61. package/lib/module/components/UniversalOnboarding.js.map +1 -0
  62. package/lib/module/components/onboarding/OAuthWebView.js +128 -0
  63. package/lib/module/components/onboarding/OAuthWebView.js.map +1 -0
  64. package/lib/module/components/onboarding/OnboardingHeader.js +66 -0
  65. package/lib/module/components/onboarding/OnboardingHeader.js.map +1 -0
  66. package/lib/module/components/onboarding/PinInput.js +274 -0
  67. package/lib/module/components/onboarding/PinInput.js.map +1 -0
  68. package/lib/module/components/onboarding/PlatformConnector.js +235 -0
  69. package/lib/module/components/onboarding/PlatformConnector.js.map +1 -0
  70. package/lib/module/components/screens/ConnectorScreen.js +137 -0
  71. package/lib/module/components/screens/ConnectorScreen.js.map +1 -0
  72. package/lib/module/components/screens/LoadingScreen.js +83 -0
  73. package/lib/module/components/screens/LoadingScreen.js.map +1 -0
  74. package/lib/module/components/screens/PinCreationScreen.js +53 -0
  75. package/lib/module/components/screens/PinCreationScreen.js.map +1 -0
  76. package/lib/module/constants/index.js +72 -0
  77. package/lib/module/constants/index.js.map +1 -0
  78. package/lib/module/hooks/useConnections.js +81 -0
  79. package/lib/module/hooks/useConnections.js.map +1 -0
  80. package/lib/module/hooks/useCredentials.js +77 -0
  81. package/lib/module/hooks/useCredentials.js.map +1 -0
  82. package/lib/module/index.js +34 -0
  83. package/lib/module/index.js.map +1 -0
  84. package/lib/module/services/oauthService.js +352 -0
  85. package/lib/module/services/oauthService.js.map +1 -0
  86. package/lib/module/types/declarations.d.js +2 -0
  87. package/lib/module/types/declarations.d.js.map +1 -0
  88. package/lib/module/types/index.js +2 -0
  89. package/lib/module/types/index.js.map +1 -0
  90. package/lib/module/utils/api.js +117 -0
  91. package/lib/module/utils/api.js.map +1 -0
  92. package/lib/module/utils/auth.js +99 -0
  93. package/lib/module/utils/auth.js.map +1 -0
  94. package/lib/module/utils/crypto.js +54 -0
  95. package/lib/module/utils/crypto.js.map +1 -0
  96. package/lib/module/utils/debugHelper.js +54 -0
  97. package/lib/module/utils/debugHelper.js.map +1 -0
  98. package/lib/module/utils/onairosApi.js +256 -0
  99. package/lib/module/utils/onairosApi.js.map +1 -0
  100. package/lib/module/utils/secureStorage.js +196 -0
  101. package/lib/module/utils/secureStorage.js.map +1 -0
  102. package/package.json +115 -0
  103. package/src/components/DataRequestModal.tsx +187 -0
  104. package/src/components/Notification.js +101 -0
  105. package/src/components/OnairosButton.js +604 -0
  106. package/src/components/OnairosButton.tsx +182 -0
  107. package/src/components/Overlay.js +854 -0
  108. package/src/components/Overlay.tsx +272 -0
  109. package/src/components/UniversalOnboarding.tsx +184 -0
  110. package/src/components/onboarding/OAuthWebView.tsx +134 -0
  111. package/src/components/onboarding/OnboardingHeader.tsx +70 -0
  112. package/src/components/onboarding/PinInput.tsx +356 -0
  113. package/src/components/onboarding/PlatformConnector.tsx +297 -0
  114. package/src/components/screens/ConnectorScreen.tsx +152 -0
  115. package/src/components/screens/LoadingScreen.tsx +100 -0
  116. package/src/components/screens/PinCreationScreen.tsx +67 -0
  117. package/src/constants/index.ts +78 -0
  118. package/src/hooks/useConnections.ts +90 -0
  119. package/src/hooks/useCredentials.ts +83 -0
  120. package/src/index.js +14 -0
  121. package/src/index.ts +82 -0
  122. package/src/services/oauthService.ts +360 -0
  123. package/src/types/declarations.d.ts +26 -0
  124. package/src/types/index.ts +82 -0
  125. package/src/utils/api.js +112 -0
  126. package/src/utils/auth.js +104 -0
  127. package/src/utils/crypto.js +60 -0
  128. package/src/utils/debugHelper.ts +53 -0
  129. package/src/utils/onairosApi.ts +303 -0
  130. package/src/utils/secureStorage.ts +230 -0
@@ -0,0 +1,825 @@
1
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform, Dimensions } from 'react-native';
3
+ import BottomSheet from '@gorhom/bottom-sheet';
4
+ import Icon from 'react-native-vector-icons/MaterialIcons';
5
+ import { COLORS } from '../constants';
6
+ const {
7
+ height
8
+ } = Dimensions.get('window');
9
+ export const Overlay = ({
10
+ visible,
11
+ onClose,
12
+ onAccept,
13
+ AppName,
14
+ requestData,
15
+ biometricType = Platform.OS === 'ios' ? 'FaceID' : 'BiometricID'
16
+ }) => {
17
+ const bottomSheetRef = useRef(null);
18
+ const snapPoints = useMemo(() => ['85%'], []);
19
+
20
+ // Expand or collapse the bottom sheet based on visibility
21
+ useEffect(() => {
22
+ if (visible) {
23
+ var _bottomSheetRef$curre;
24
+ (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 || _bottomSheetRef$curre.expand();
25
+ } else {
26
+ var _bottomSheetRef$curre2;
27
+ (_bottomSheetRef$curre2 = bottomSheetRef.current) === null || _bottomSheetRef$curre2 === void 0 || _bottomSheetRef$curre2.close();
28
+ }
29
+ }, [visible]);
30
+
31
+ // Get the icon for the biometric type
32
+ const getBiometricIcon = useCallback(() => {
33
+ switch (biometricType) {
34
+ case 'FaceID':
35
+ return 'face';
36
+ case 'TouchID':
37
+ return 'fingerprint';
38
+ default:
39
+ return 'security';
40
+ }
41
+ }, [biometricType]);
42
+
43
+ // Render the requested data sections
44
+ const renderDataCategories = () => {
45
+ return Object.entries(requestData).map(([category, items]) => /*#__PURE__*/React.createElement(View, {
46
+ key: category,
47
+ style: styles.categoryContainer
48
+ }, /*#__PURE__*/React.createElement(Text, {
49
+ style: styles.categoryTitle
50
+ }, category), Object.entries(items).map(([item, description]) => /*#__PURE__*/React.createElement(View, {
51
+ key: item,
52
+ style: styles.itemContainer
53
+ }, /*#__PURE__*/React.createElement(Icon, {
54
+ name: "check-circle",
55
+ size: 20,
56
+ color: COLORS.primary
57
+ }), /*#__PURE__*/React.createElement(View, {
58
+ style: styles.itemContent
59
+ }, /*#__PURE__*/React.createElement(Text, {
60
+ style: styles.itemTitle
61
+ }, item), /*#__PURE__*/React.createElement(Text, {
62
+ style: styles.itemDescription
63
+ }, description))))));
64
+ };
65
+ return /*#__PURE__*/React.createElement(BottomSheet, {
66
+ ref: bottomSheetRef,
67
+ index: visible ? 0 : -1,
68
+ snapPoints: snapPoints,
69
+ enablePanDownToClose: true,
70
+ onClose: onClose,
71
+ backdropComponent: ({
72
+ animatedIndex
73
+ }) => /*#__PURE__*/React.createElement(View, {
74
+ style: [styles.backdrop, {
75
+ opacity: animatedIndex.interpolate({
76
+ inputRange: [0, 1],
77
+ outputRange: [0.5, 0]
78
+ })
79
+ }]
80
+ })
81
+ }, /*#__PURE__*/React.createElement(View, {
82
+ style: styles.container
83
+ }, /*#__PURE__*/React.createElement(View, {
84
+ style: styles.header
85
+ }, /*#__PURE__*/React.createElement(Icon, {
86
+ name: "shield",
87
+ size: 24,
88
+ color: COLORS.primary
89
+ }), /*#__PURE__*/React.createElement(Text, {
90
+ style: styles.headerTitle
91
+ }, "Data Request"), /*#__PURE__*/React.createElement(TouchableOpacity, {
92
+ onPress: onClose,
93
+ style: styles.closeButton
94
+ }, /*#__PURE__*/React.createElement(Icon, {
95
+ name: "close",
96
+ size: 24,
97
+ color: "#000"
98
+ }))), /*#__PURE__*/React.createElement(ScrollView, {
99
+ style: styles.content
100
+ }, /*#__PURE__*/React.createElement(View, {
101
+ style: styles.appInfoContainer
102
+ }, /*#__PURE__*/React.createElement(Text, {
103
+ style: styles.appName
104
+ }, AppName), /*#__PURE__*/React.createElement(Text, {
105
+ style: styles.requestText
106
+ }, "is requesting access to the following data:")), renderDataCategories(), /*#__PURE__*/React.createElement(View, {
107
+ style: styles.securityNotice
108
+ }, /*#__PURE__*/React.createElement(Icon, {
109
+ name: "security",
110
+ size: 20,
111
+ color: "#666"
112
+ }), /*#__PURE__*/React.createElement(Text, {
113
+ style: styles.securityText
114
+ }, "Your data is securely processed and never shared with third parties."))), /*#__PURE__*/React.createElement(View, {
115
+ style: styles.footer
116
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
117
+ style: styles.cancelButton,
118
+ onPress: onClose
119
+ }, /*#__PURE__*/React.createElement(Text, {
120
+ style: styles.cancelButtonText
121
+ }, "Deny")), /*#__PURE__*/React.createElement(TouchableOpacity, {
122
+ style: styles.acceptButton,
123
+ onPress: onAccept
124
+ }, /*#__PURE__*/React.createElement(Text, {
125
+ style: styles.acceptButtonText
126
+ }, "Accept"), /*#__PURE__*/React.createElement(Icon, {
127
+ name: getBiometricIcon(),
128
+ size: 20,
129
+ color: "#fff",
130
+ style: styles.buttonIcon
131
+ })))));
132
+ };
133
+ const styles = StyleSheet.create({
134
+ container: {
135
+ flex: 1,
136
+ backgroundColor: '#fff'
137
+ },
138
+ backdrop: {
139
+ ...StyleSheet.absoluteFillObject,
140
+ backgroundColor: '#000'
141
+ },
142
+ header: {
143
+ flexDirection: 'row',
144
+ alignItems: 'center',
145
+ padding: 16,
146
+ backgroundColor: COLORS.headerBg,
147
+ borderTopLeftRadius: 16,
148
+ borderTopRightRadius: 16
149
+ },
150
+ headerTitle: {
151
+ flex: 1,
152
+ fontSize: 18,
153
+ fontWeight: '600',
154
+ marginLeft: 12,
155
+ color: '#000'
156
+ },
157
+ closeButton: {
158
+ padding: 8
159
+ },
160
+ content: {
161
+ flex: 1,
162
+ padding: 16
163
+ },
164
+ appInfoContainer: {
165
+ marginBottom: 24
166
+ },
167
+ appName: {
168
+ fontSize: 20,
169
+ fontWeight: 'bold',
170
+ color: '#000',
171
+ marginBottom: 4
172
+ },
173
+ requestText: {
174
+ fontSize: 16,
175
+ color: '#666'
176
+ },
177
+ categoryContainer: {
178
+ marginBottom: 20
179
+ },
180
+ categoryTitle: {
181
+ fontSize: 18,
182
+ fontWeight: '600',
183
+ color: '#000',
184
+ marginBottom: 12
185
+ },
186
+ itemContainer: {
187
+ flexDirection: 'row',
188
+ marginBottom: 12,
189
+ paddingLeft: 8
190
+ },
191
+ itemContent: {
192
+ flex: 1,
193
+ marginLeft: 12
194
+ },
195
+ itemTitle: {
196
+ fontSize: 16,
197
+ fontWeight: '500',
198
+ color: '#000',
199
+ marginBottom: 2
200
+ },
201
+ itemDescription: {
202
+ fontSize: 14,
203
+ color: '#666'
204
+ },
205
+ securityNotice: {
206
+ flexDirection: 'row',
207
+ alignItems: 'flex-start',
208
+ backgroundColor: '#f5f5f5',
209
+ padding: 12,
210
+ borderRadius: 8,
211
+ marginBottom: 24
212
+ },
213
+ securityText: {
214
+ flex: 1,
215
+ fontSize: 14,
216
+ color: '#666',
217
+ marginLeft: 8
218
+ },
219
+ footer: {
220
+ flexDirection: 'row',
221
+ padding: 16,
222
+ borderTopWidth: 1,
223
+ borderTopColor: '#eee'
224
+ },
225
+ cancelButton: {
226
+ flex: 1,
227
+ justifyContent: 'center',
228
+ alignItems: 'center',
229
+ paddingVertical: 12,
230
+ borderWidth: 1,
231
+ borderColor: '#ddd',
232
+ borderRadius: 25,
233
+ marginRight: 8
234
+ },
235
+ cancelButtonText: {
236
+ fontSize: 16,
237
+ fontWeight: '600',
238
+ color: '#666'
239
+ },
240
+ acceptButton: {
241
+ flex: 2,
242
+ flexDirection: 'row',
243
+ justifyContent: 'center',
244
+ alignItems: 'center',
245
+ paddingVertical: 12,
246
+ backgroundColor: COLORS.primary,
247
+ borderRadius: 25,
248
+ marginLeft: 8
249
+ },
250
+ acceptButtonText: {
251
+ fontSize: 16,
252
+ fontWeight: '600',
253
+ color: '#fff',
254
+ marginRight: 8
255
+ },
256
+ buttonIcon: {
257
+ marginLeft: 4
258
+ }
259
+ });
260
+ //# sourceMappingURL=Overlay.js.map'onairosToken', userOnairosDetails.token);
261
+
262
+ // Fetch account info
263
+ await onLoginSuccess(userDetails.email, true);
264
+ }
265
+ } catch (error) {
266
+ console.error('Othent login failed:', error);
267
+ setLoginError('Authentication failed. Please try again.');
268
+ } finally {
269
+ setIsLoading(false);
270
+ }
271
+ };
272
+
273
+ // Handle username/password login
274
+ const handleUsernameLogin = async () => {
275
+ if (!username || !password) {
276
+ setLoginError('Please enter both username and password');
277
+ return;
278
+ }
279
+ setIsLoading(true);
280
+ setLoginError('');
281
+ try {
282
+ const response = await axios.post(`${API_URL}/login`, {
283
+ username,
284
+ password
285
+ });
286
+ if (response.status === 200) {
287
+ // Store the token
288
+ await AsyncStorage.setItem('onairosToken', response.data.token);
289
+ await AsyncStorage.setItem('username', username);
290
+
291
+ // Update authentication state
292
+ await onLoginSuccess(username, false);
293
+ } else {
294
+ setLoginError('Invalid username or password');
295
+ }
296
+ } catch (error) {
297
+ console.error('Login failed:', error);
298
+ setLoginError('Login failed. Please check your credentials.');
299
+ } finally {
300
+ setIsLoading(false);
301
+ }
302
+ };
303
+
304
+ // Render login form
305
+ const renderLoginForm = () => /*#__PURE__*/React.createElement(View, {
306
+ style: styles.loginContainer
307
+ }, /*#__PURE__*/React.createElement(Text, {
308
+ style: styles.loginTitle
309
+ }, "Sign in to Onairos"), loginError ? /*#__PURE__*/React.createElement(Text, {
310
+ style: styles.errorText
311
+ }, loginError) : null, /*#__PURE__*/React.createElement(View, {
312
+ style: styles.inputContainer
313
+ }, /*#__PURE__*/React.createElement(Text, {
314
+ style: styles.inputLabel
315
+ }, "Username"), /*#__PURE__*/React.createElement(TextInput, {
316
+ style: styles.input,
317
+ value: username,
318
+ onChangeText: setUsername,
319
+ placeholder: "Enter your username",
320
+ autoCapitalize: "none"
321
+ })), /*#__PURE__*/React.createElement(View, {
322
+ style: styles.inputContainer
323
+ }, /*#__PURE__*/React.createElement(Text, {
324
+ style: styles.inputLabel
325
+ }, "Password"), /*#__PURE__*/React.createElement(TextInput, {
326
+ style: styles.input,
327
+ value: password,
328
+ onChangeText: setPassword,
329
+ placeholder: "Enter your password",
330
+ secureTextEntry: true
331
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
332
+ style: styles.loginButton,
333
+ onPress: handleUsernameLogin,
334
+ disabled: isLoading
335
+ }, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
336
+ color: "#fff",
337
+ size: "small"
338
+ }) : /*#__PURE__*/React.createElement(Text, {
339
+ style: styles.loginButtonText
340
+ }, "Sign In")), /*#__PURE__*/React.createElement(View, {
341
+ style: styles.divider
342
+ }, /*#__PURE__*/React.createElement(View, {
343
+ style: styles.dividerLine
344
+ }), /*#__PURE__*/React.createElement(Text, {
345
+ style: styles.dividerText
346
+ }, "OR"), /*#__PURE__*/React.createElement(View, {
347
+ style: styles.dividerLine
348
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
349
+ style: styles.othentButton,
350
+ onPress: handleOthentLogin,
351
+ disabled: isLoading
352
+ }, /*#__PURE__*/React.createElement(Image, {
353
+ source: {
354
+ uri: 'https://onairos.sirv.com/Images/othent-logo.png'
355
+ },
356
+ style: styles.othentLogo
357
+ }), /*#__PURE__*/React.createElement(Text, {
358
+ style: styles.othentButtonText
359
+ }, "Continue with Othent")));
360
+
361
+ // Render onboarding step
362
+ const renderOnboarding = () => /*#__PURE__*/React.createElement(View, {
363
+ style: styles.onboardingContainer
364
+ }, /*#__PURE__*/React.createElement(Text, {
365
+ style: styles.onboardingTitle
366
+ }, "Connect Your Accounts"), /*#__PURE__*/React.createElement(Text, {
367
+ style: styles.onboardingSubtitle
368
+ }, "Select the social media accounts you want to connect to Onairos"), /*#__PURE__*/React.createElement(View, {
369
+ style: styles.socialAccountsContainer
370
+ }, socialPlatforms.map(platform => /*#__PURE__*/React.createElement(TouchableOpacity, {
371
+ key: platform.id,
372
+ style: [styles.socialAccount, selectedSocialAccounts.includes(platform.id) && styles.selectedSocialAccount],
373
+ onPress: () => toggleSocialAccount(platform.id)
374
+ }, /*#__PURE__*/React.createElement(Image, {
375
+ source: {
376
+ uri: platform.icon
377
+ },
378
+ style: styles.socialIcon
379
+ }), /*#__PURE__*/React.createElement(Text, {
380
+ style: styles.socialName
381
+ }, platform.name), selectedSocialAccounts.includes(platform.id) && /*#__PURE__*/React.createElement(Icon, {
382
+ name: "check-circle",
383
+ size: 24,
384
+ color: "#4CAF50",
385
+ style: styles.checkIcon
386
+ })))), /*#__PURE__*/React.createElement(TouchableOpacity, {
387
+ style: [styles.nextButton, selectedSocialAccounts.length === 0 && styles.disabledButton],
388
+ onPress: startTraining,
389
+ disabled: selectedSocialAccounts.length === 0 || isTraining
390
+ }, isTraining ? /*#__PURE__*/React.createElement(ActivityIndicator, {
391
+ color: "#fff",
392
+ size: "small"
393
+ }) : /*#__PURE__*/React.createElement(Text, {
394
+ style: styles.nextButtonText
395
+ }, "Continue")));
396
+
397
+ // Render training progress
398
+ const renderTraining = () => /*#__PURE__*/React.createElement(View, {
399
+ style: styles.trainingContainer
400
+ }, /*#__PURE__*/React.createElement(Text, {
401
+ style: styles.trainingTitle
402
+ }, "Training Your Model"), /*#__PURE__*/React.createElement(Text, {
403
+ style: styles.trainingSubtitle
404
+ }, "Please wait while we train your personalized AI model"), /*#__PURE__*/React.createElement(View, {
405
+ style: styles.progressBarContainer
406
+ }, /*#__PURE__*/React.createElement(View, {
407
+ style: [styles.progressBar, {
408
+ width: `${trainingProgress}%`
409
+ }]
410
+ })), /*#__PURE__*/React.createElement(Text, {
411
+ style: styles.progressText
412
+ }, trainingProgress, "% Complete"));
413
+
414
+ // Render PIN creation step
415
+ const renderCreatePin = () => /*#__PURE__*/React.createElement(View, {
416
+ style: styles.pinContainer
417
+ }, /*#__PURE__*/React.createElement(Text, {
418
+ style: styles.pinTitle
419
+ }, "Create Your PIN"), /*#__PURE__*/React.createElement(Text, {
420
+ style: styles.pinSubtitle
421
+ }, "This PIN will be used to secure your data"), pinError ? /*#__PURE__*/React.createElement(Text, {
422
+ style: styles.errorText
423
+ }, pinError) : null, /*#__PURE__*/React.createElement(View, {
424
+ style: styles.inputContainer
425
+ }, /*#__PURE__*/React.createElement(Text, {
426
+ style: styles.inputLabel
427
+ }, "PIN"), /*#__PURE__*/React.createElement(TextInput, {
428
+ style: styles.input,
429
+ value: pin,
430
+ onChangeText: setPin,
431
+ placeholder: "Enter a 4-digit PIN",
432
+ keyboardType: "numeric",
433
+ secureTextEntry: true,
434
+ maxLength: 4
435
+ })), /*#__PURE__*/React.createElement(View, {
436
+ style: styles.inputContainer
437
+ }, /*#__PURE__*/React.createElement(Text, {
438
+ style: styles.inputLabel
439
+ }, "Confirm PIN"), /*#__PURE__*/React.createElement(TextInput, {
440
+ style: styles.input,
441
+ value: confirmPin,
442
+ onChangeText: setConfirmPin,
443
+ placeholder: "Confirm your PIN",
444
+ keyboardType: "numeric",
445
+ secureTextEntry: true,
446
+ maxLength: 4
447
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
448
+ style: styles.nextButton,
449
+ onPress: handleCreatePin,
450
+ disabled: isLoading
451
+ }, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
452
+ color: "#fff",
453
+ size: "small"
454
+ }) : /*#__PURE__*/React.createElement(Text, {
455
+ style: styles.nextButtonText
456
+ }, "Complete Setup")));
457
+
458
+ // Render data request step
459
+ const renderDataRequest = () => /*#__PURE__*/React.createElement(View, {
460
+ style: styles.dataRequestContainer
461
+ }, /*#__PURE__*/React.createElement(Text, {
462
+ style: styles.dataRequestTitle
463
+ }, dataRequester, " is requesting access to your data"), /*#__PURE__*/React.createElement(ScrollView, {
464
+ style: styles.requestsScrollView
465
+ }, Object.keys(requestData).map(key => /*#__PURE__*/React.createElement(View, {
466
+ key: key,
467
+ style: styles.requestSection
468
+ }, /*#__PURE__*/React.createElement(Text, {
469
+ style: styles.requestSectionTitle
470
+ }, key, " Data Request"), /*#__PURE__*/React.createElement(Text, {
471
+ style: styles.requestDescription
472
+ }, requestData[key].descriptions), /*#__PURE__*/React.createElement(TouchableOpacity, {
473
+ style: [styles.requestToggle, selectedConnections.some(conn => conn.key === key && conn.dataRequester === dataRequester) && styles.requestToggleSelected],
474
+ onPress: () => toggleDataRequest(dataRequester, key, 0, requestData[key].type, requestData[key].reward)
475
+ }, /*#__PURE__*/React.createElement(Text, {
476
+ style: styles.requestToggleText
477
+ }, selectedConnections.some(conn => conn.key === key && conn.dataRequester === dataRequester) ? 'Selected' : 'Select'))))), /*#__PURE__*/React.createElement(View, {
478
+ style: styles.actionButtonsContainer
479
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
480
+ style: styles.rejectButton,
481
+ onPress: rejectDataRequest
482
+ }, /*#__PURE__*/React.createElement(Text, {
483
+ style: styles.rejectButtonText
484
+ }, "Reject")), /*#__PURE__*/React.createElement(TouchableOpacity, {
485
+ style: [styles.approveButton, !allowSubmit && styles.disabledButton],
486
+ onPress: sendDataRequest,
487
+ disabled: !allowSubmit || isLoading
488
+ }, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
489
+ color: "#fff",
490
+ size: "small"
491
+ }) : /*#__PURE__*/React.createElement(Text, {
492
+ style: styles.approveButtonText
493
+ }, "Approve"))));
494
+
495
+ // Render content based on current step
496
+ const renderContent = () => {
497
+ if (!isAuthenticated && currentStep !== 'onboarding') {
498
+ return renderLoginForm();
499
+ }
500
+ switch (currentStep) {
501
+ case 'onboarding':
502
+ return renderOnboarding();
503
+ case 'training':
504
+ return renderTraining();
505
+ case 'createPin':
506
+ return renderCreatePin();
507
+ case 'dataRequest':
508
+ return renderDataRequest();
509
+ default:
510
+ return renderDataRequest();
511
+ }
512
+ };
513
+ return /*#__PURE__*/React.createElement(Modal, {
514
+ isVisible: true,
515
+ onBackdropPress: onClose,
516
+ onBackButtonPress: onClose,
517
+ style: styles.modal,
518
+ swipeDirection: "down",
519
+ onSwipeComplete: onClose,
520
+ propagateSwipe: true,
521
+ avoidKeyboard: true
522
+ }, /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
523
+ behavior: Platform.OS === 'ios' ? 'padding' : 'height',
524
+ style: styles.keyboardAvoidingView
525
+ }, /*#__PURE__*/React.createElement(View, {
526
+ style: styles.modalContent
527
+ }, /*#__PURE__*/React.createElement(View, {
528
+ style: styles.modalHeader
529
+ }, /*#__PURE__*/React.createElement(View, {
530
+ style: styles.dragIndicator
531
+ }), /*#__PURE__*/React.createElement(TouchableOpacity, {
532
+ style: styles.closeButton,
533
+ onPress: onClose
534
+ }, /*#__PURE__*/React.createElement(Icon, {
535
+ name: "close",
536
+ size: 24,
537
+ color: "#333"
538
+ }))), renderContent())));
539
+ };
540
+ const styles = StyleSheet.create({
541
+ modal: {
542
+ justifyContent: 'flex-end',
543
+ margin: 0
544
+ },
545
+ keyboardAvoidingView: {
546
+ width: '100%'
547
+ },
548
+ modalContent: {
549
+ backgroundColor: 'white',
550
+ borderTopLeftRadius: 20,
551
+ borderTopRightRadius: 20,
552
+ paddingHorizontal: 20,
553
+ paddingBottom: 20,
554
+ maxHeight: height * 0.8
555
+ },
556
+ modalHeader: {
557
+ flexDirection: 'row',
558
+ justifyContent: 'center',
559
+ alignItems: 'center',
560
+ paddingVertical: 10,
561
+ position: 'relative'
562
+ },
563
+ dragIndicator: {
564
+ width: 40,
565
+ height: 5,
566
+ backgroundColor: '#ccc',
567
+ borderRadius: 3
568
+ },
569
+ closeButton: {
570
+ position: 'absolute',
571
+ right: 0,
572
+ top: 10
573
+ },
574
+ // Login styles
575
+ loginContainer: {
576
+ padding: 16
577
+ },
578
+ loginTitle: {
579
+ fontSize: 24,
580
+ fontWeight: 'bold',
581
+ marginBottom: 20,
582
+ textAlign: 'center'
583
+ },
584
+ inputContainer: {
585
+ marginBottom: 16
586
+ },
587
+ inputLabel: {
588
+ fontSize: 16,
589
+ marginBottom: 8,
590
+ color: '#333'
591
+ },
592
+ input: {
593
+ borderWidth: 1,
594
+ borderColor: '#ccc',
595
+ borderRadius: 8,
596
+ padding: 12,
597
+ fontSize: 16
598
+ },
599
+ loginButton: {
600
+ backgroundColor: '#2196F3',
601
+ borderRadius: 8,
602
+ padding: 16,
603
+ alignItems: 'center',
604
+ marginTop: 8
605
+ },
606
+ loginButtonText: {
607
+ color: 'white',
608
+ fontSize: 16,
609
+ fontWeight: 'bold'
610
+ },
611
+ divider: {
612
+ flexDirection: 'row',
613
+ alignItems: 'center',
614
+ marginVertical: 20
615
+ },
616
+ dividerLine: {
617
+ flex: 1,
618
+ height: 1,
619
+ backgroundColor: '#ccc'
620
+ },
621
+ dividerText: {
622
+ marginHorizontal: 10,
623
+ color: '#666'
624
+ },
625
+ othentButton: {
626
+ flexDirection: 'row',
627
+ alignItems: 'center',
628
+ justifyContent: 'center',
629
+ backgroundColor: '#f5f5f5',
630
+ borderRadius: 8,
631
+ padding: 16,
632
+ borderWidth: 1,
633
+ borderColor: '#ddd'
634
+ },
635
+ othentLogo: {
636
+ width: 24,
637
+ height: 24,
638
+ marginRight: 10
639
+ },
640
+ othentButtonText: {
641
+ fontSize: 16,
642
+ color: '#333'
643
+ },
644
+ // Onboarding styles
645
+ onboardingContainer: {
646
+ padding: 16
647
+ },
648
+ onboardingTitle: {
649
+ fontSize: 24,
650
+ fontWeight: 'bold',
651
+ marginBottom: 8
652
+ },
653
+ onboardingSubtitle: {
654
+ fontSize: 16,
655
+ color: '#666',
656
+ marginBottom: 20
657
+ },
658
+ socialAccountsContainer: {
659
+ marginBottom: 20
660
+ },
661
+ socialAccount: {
662
+ flexDirection: 'row',
663
+ alignItems: 'center',
664
+ padding: 16,
665
+ borderWidth: 1,
666
+ borderColor: '#ddd',
667
+ borderRadius: 8,
668
+ marginBottom: 10
669
+ },
670
+ selectedSocialAccount: {
671
+ borderColor: '#4CAF50',
672
+ backgroundColor: 'rgba(76, 175, 80, 0.1)'
673
+ },
674
+ socialIcon: {
675
+ width: 24,
676
+ height: 24,
677
+ marginRight: 16
678
+ },
679
+ socialName: {
680
+ fontSize: 16,
681
+ flex: 1
682
+ },
683
+ checkIcon: {
684
+ marginLeft: 8
685
+ },
686
+ nextButton: {
687
+ backgroundColor: '#4CAF50',
688
+ borderRadius: 8,
689
+ padding: 16,
690
+ alignItems: 'center'
691
+ },
692
+ nextButtonText: {
693
+ color: 'white',
694
+ fontSize: 16,
695
+ fontWeight: 'bold'
696
+ },
697
+ disabledButton: {
698
+ backgroundColor: '#ccc'
699
+ },
700
+ // Training styles
701
+ trainingContainer: {
702
+ padding: 16,
703
+ alignItems: 'center'
704
+ },
705
+ trainingTitle: {
706
+ fontSize: 24,
707
+ fontWeight: 'bold',
708
+ marginBottom: 8
709
+ },
710
+ trainingSubtitle: {
711
+ fontSize: 16,
712
+ color: '#666',
713
+ marginBottom: 30,
714
+ textAlign: 'center'
715
+ },
716
+ progressBarContainer: {
717
+ width: '100%',
718
+ height: 12,
719
+ backgroundColor: '#e0e0e0',
720
+ borderRadius: 6,
721
+ overflow: 'hidden',
722
+ marginBottom: 16
723
+ },
724
+ progressBar: {
725
+ height: '100%',
726
+ backgroundColor: '#4CAF50'
727
+ },
728
+ progressText: {
729
+ fontSize: 16,
730
+ fontWeight: 'bold',
731
+ color: '#4CAF50'
732
+ },
733
+ // PIN styles
734
+ pinContainer: {
735
+ padding: 16
736
+ },
737
+ pinTitle: {
738
+ fontSize: 24,
739
+ fontWeight: 'bold',
740
+ marginBottom: 8
741
+ },
742
+ pinSubtitle: {
743
+ fontSize: 16,
744
+ color: '#666',
745
+ marginBottom: 20
746
+ },
747
+ errorText: {
748
+ color: 'red',
749
+ marginBottom: 16
750
+ },
751
+ // Data request styles
752
+ dataRequestContainer: {
753
+ padding: 16
754
+ },
755
+ dataRequestTitle: {
756
+ fontSize: 20,
757
+ fontWeight: 'bold',
758
+ marginBottom: 16
759
+ },
760
+ requestsScrollView: {
761
+ maxHeight: 300
762
+ },
763
+ requestSection: {
764
+ marginBottom: 20,
765
+ padding: 16,
766
+ borderWidth: 1,
767
+ borderColor: '#ddd',
768
+ borderRadius: 8
769
+ },
770
+ requestSectionTitle: {
771
+ fontSize: 18,
772
+ fontWeight: 'bold',
773
+ marginBottom: 8
774
+ },
775
+ requestDescription: {
776
+ fontSize: 14,
777
+ color: '#666',
778
+ marginBottom: 16
779
+ },
780
+ requestToggle: {
781
+ backgroundColor: '#f5f5f5',
782
+ padding: 12,
783
+ borderRadius: 8,
784
+ alignItems: 'center'
785
+ },
786
+ requestToggleSelected: {
787
+ backgroundColor: '#4CAF50'
788
+ },
789
+ requestToggleText: {
790
+ fontWeight: 'bold'
791
+ },
792
+ actionButtonsContainer: {
793
+ flexDirection: 'row',
794
+ justifyContent: 'space-between',
795
+ marginTop: 20
796
+ },
797
+ rejectButton: {
798
+ flex: 1,
799
+ backgroundColor: '#f5f5f5',
800
+ borderRadius: 8,
801
+ padding: 16,
802
+ alignItems: 'center',
803
+ marginRight: 8
804
+ },
805
+ rejectButtonText: {
806
+ color: '#333',
807
+ fontSize: 16,
808
+ fontWeight: 'bold'
809
+ },
810
+ approveButton: {
811
+ flex: 1,
812
+ backgroundColor: '#4CAF50',
813
+ borderRadius: 8,
814
+ padding: 16,
815
+ alignItems: 'center',
816
+ marginLeft: 8
817
+ },
818
+ approveButtonText: {
819
+ color: 'white',
820
+ fontSize: 16,
821
+ fontWeight: 'bold'
822
+ }
823
+ });
824
+ export default Overlay;
825
+ //# sourceMappingURL=Overlay.js.map