@onairos/react-native 3.0.17 → 3.0.19

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 (58) hide show
  1. package/lib/commonjs/assets/images/farcaster.png +0 -0
  2. package/lib/commonjs/assets/images/instagram.png +0 -0
  3. package/lib/commonjs/assets/images/linkedin.png +0 -0
  4. package/lib/commonjs/assets/images/pinterest.png +0 -0
  5. package/lib/commonjs/assets/images/reddit.png +0 -0
  6. package/lib/commonjs/assets/images/swerv_logo.png +0 -0
  7. package/lib/commonjs/assets/images/twitter.jpg +0 -0
  8. package/lib/commonjs/assets/images/youtube.png +0 -0
  9. package/lib/commonjs/components/Overlay.js +13 -0
  10. package/lib/commonjs/components/Overlay.js.map +1 -1
  11. package/lib/commonjs/components/PinInput.js +70 -11
  12. package/lib/commonjs/components/PinInput.js.map +1 -1
  13. package/lib/commonjs/components/TrainingModal.js +91 -14
  14. package/lib/commonjs/components/TrainingModal.js.map +1 -1
  15. package/lib/commonjs/components/UniversalOnboarding.js +19 -7
  16. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  17. package/lib/module/assets/images/farcaster.png +0 -0
  18. package/lib/module/assets/images/instagram.png +0 -0
  19. package/lib/module/assets/images/linkedin.png +0 -0
  20. package/lib/module/assets/images/pinterest.png +0 -0
  21. package/lib/module/assets/images/reddit.png +0 -0
  22. package/lib/module/assets/images/swerv_logo.png +0 -0
  23. package/lib/module/assets/images/twitter.jpg +0 -0
  24. package/lib/module/assets/images/youtube.png +0 -0
  25. package/lib/module/components/Overlay.js +13 -0
  26. package/lib/module/components/Overlay.js.map +1 -1
  27. package/lib/module/components/PinInput.js +71 -12
  28. package/lib/module/components/PinInput.js.map +1 -1
  29. package/lib/module/components/TrainingModal.js +92 -15
  30. package/lib/module/components/TrainingModal.js.map +1 -1
  31. package/lib/module/components/UniversalOnboarding.js +19 -7
  32. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  33. package/lib/typescript/components/Overlay.d.ts.map +1 -1
  34. package/lib/typescript/components/PinInput.d.ts.map +1 -1
  35. package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
  36. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
  37. package/lib/typescript/types/index.d.ts +5 -0
  38. package/lib/typescript/types/index.d.ts.map +1 -1
  39. package/lib/typescript/types.d.ts +7 -7
  40. package/lib/typescript/types.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/assets/images/farcaster.png +0 -0
  43. package/src/assets/images/instagram.png +0 -0
  44. package/src/assets/images/linkedin.png +0 -0
  45. package/src/assets/images/pinterest.png +0 -0
  46. package/src/assets/images/reddit.png +0 -0
  47. package/src/assets/images/swerv_logo.png +0 -0
  48. package/src/assets/images/twitter.jpg +0 -0
  49. package/src/assets/images/youtube.png +0 -0
  50. package/src/components/Overlay.tsx +4 -0
  51. package/src/components/PinInput.tsx +250 -189
  52. package/src/components/TrainingModal.tsx +222 -132
  53. package/src/components/UniversalOnboarding.tsx +8 -5
  54. package/src/types/index.ts +150 -145
  55. package/src/types.ts +149 -149
  56. package/lib/commonjs/components/Overlay.tsx.new +0 -516
  57. package/lib/module/components/Overlay.tsx.new +0 -516
  58. package/src/components/Overlay.tsx.new +0 -516
@@ -1,189 +1,250 @@
1
- import React, { useState, useCallback } from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- TextInput,
7
- TouchableOpacity,
8
- Keyboard,
9
- } from 'react-native';
10
- import Icon from 'react-native-vector-icons/MaterialIcons';
11
- import { COLORS } from '../constants';
12
- import type { PinInputProps } from '../types';
13
-
14
- export const PinInput: React.FC<PinInputProps> = ({
15
- onSubmit,
16
- minLength = 8,
17
- requireSpecialChar = true,
18
- requireNumber = true,
19
- }) => {
20
- const [pin, setPin] = useState('');
21
- const [error, setError] = useState<string | null>(null);
22
- const [showPin, setShowPin] = useState(false);
23
-
24
- const validatePin = useCallback((value: string) => {
25
- if (value.length < minLength) {
26
- return `PIN must be at least ${minLength} characters`;
27
- }
28
- if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
29
- return 'PIN must include a special character';
30
- }
31
- if (requireNumber && !/\d/.test(value)) {
32
- return 'PIN must include a number';
33
- }
34
- return null;
35
- }, [minLength, requireSpecialChar, requireNumber]);
36
-
37
- const handleSubmit = useCallback(() => {
38
- const validationError = validatePin(pin);
39
- if (validationError) {
40
- setError(validationError);
41
- return;
42
- }
43
- onSubmit(pin);
44
- }, [pin, validatePin, onSubmit]);
45
-
46
- const handlePinChange = useCallback((value: string) => {
47
- setPin(value);
48
- setError(null);
49
- }, []);
50
-
51
- return (
52
- <View style={styles.container}>
53
- <Text style={styles.title}>Create your PIN</Text>
54
- <Text style={styles.subtitle}>
55
- This PIN will be used to secure your account
56
- </Text>
57
-
58
- <View style={styles.inputContainer}>
59
- <TextInput
60
- style={styles.input}
61
- value={pin}
62
- onChangeText={handlePinChange}
63
- secureTextEntry={!showPin}
64
- placeholder="Enter PIN"
65
- keyboardType="numeric"
66
- maxLength={20}
67
- autoCapitalize="none"
68
- autoCorrect={false}
69
- />
70
- <TouchableOpacity
71
- style={styles.visibilityButton}
72
- onPress={() => setShowPin(!showPin)}
73
- >
74
- <Icon
75
- name={showPin ? 'visibility-off' : 'visibility'}
76
- size={24}
77
- color={COLORS.text.secondary}
78
- />
79
- </TouchableOpacity>
80
- </View>
81
-
82
- {error && <Text style={styles.error}>{error}</Text>}
83
-
84
- <View style={styles.requirements}>
85
- <Text style={styles.requirementTitle}>PIN Requirements:</Text>
86
- <Text style={[styles.requirement, pin.length >= minLength && styles.requirementMet]}>
87
- • At least {minLength} characters
88
- </Text>
89
- {requireSpecialChar && (
90
- <Text
91
- style={[
92
- styles.requirement,
93
- /[!@#$%^&*(),.?":{}|<>]/.test(pin) && styles.requirementMet,
94
- ]}
95
- >
96
- • Include a special character
97
- </Text>
98
- )}
99
- {requireNumber && (
100
- <Text
101
- style={[
102
- styles.requirement,
103
- /\d/.test(pin) && styles.requirementMet,
104
- ]}
105
- >
106
- Include a number
107
- </Text>
108
- )}
109
- </View>
110
-
111
- <TouchableOpacity
112
- style={[styles.submitButton, !pin && styles.submitButtonDisabled]}
113
- onPress={handleSubmit}
114
- disabled={!pin}
115
- >
116
- <Text style={styles.submitButtonText}>Continue</Text>
117
- </TouchableOpacity>
118
- </View>
119
- );
120
- };
121
-
122
- const styles = StyleSheet.create({
123
- container: {
124
- flex: 1,
125
- padding: 16,
126
- },
127
- title: {
128
- fontSize: 20,
129
- fontWeight: '600',
130
- marginBottom: 8,
131
- color: COLORS.text.primary,
132
- },
133
- subtitle: {
134
- fontSize: 14,
135
- color: COLORS.text.secondary,
136
- marginBottom: 24,
137
- },
138
- inputContainer: {
139
- flexDirection: 'row',
140
- alignItems: 'center',
141
- borderWidth: 1,
142
- borderColor: COLORS.border,
143
- borderRadius: 8,
144
- marginBottom: 16,
145
- },
146
- input: {
147
- flex: 1,
148
- padding: 12,
149
- fontSize: 16,
150
- },
151
- visibilityButton: {
152
- padding: 12,
153
- },
154
- error: {
155
- color: COLORS.error,
156
- marginBottom: 16,
157
- },
158
- requirements: {
159
- marginBottom: 24,
160
- },
161
- requirementTitle: {
162
- fontSize: 14,
163
- fontWeight: '600',
164
- marginBottom: 8,
165
- color: COLORS.text.primary,
166
- },
167
- requirement: {
168
- fontSize: 14,
169
- color: COLORS.text.secondary,
170
- marginBottom: 4,
171
- },
172
- requirementMet: {
173
- color: COLORS.success,
174
- },
175
- submitButton: {
176
- backgroundColor: COLORS.primary,
177
- paddingVertical: 16,
178
- borderRadius: 12,
179
- alignItems: 'center',
180
- },
181
- submitButtonDisabled: {
182
- opacity: 0.5,
183
- },
184
- submitButtonText: {
185
- color: '#fff',
186
- fontSize: 16,
187
- fontWeight: '600',
188
- },
189
- });
1
+ import React, { useState, useCallback } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TextInput,
7
+ TouchableOpacity,
8
+ Keyboard,
9
+ Dimensions,
10
+ } from 'react-native';
11
+ import Icon from 'react-native-vector-icons/MaterialIcons';
12
+ import { COLORS } from '../constants';
13
+ import type { PinInputProps } from '../types';
14
+
15
+ const { width } = Dimensions.get('window');
16
+
17
+ export const PinInput: React.FC<PinInputProps> = ({
18
+ onSubmit,
19
+ minLength = 8,
20
+ requireSpecialChar = true,
21
+ requireNumber = true,
22
+ onBack,
23
+ }) => {
24
+ const [pin, setPin] = useState('');
25
+ const [error, setError] = useState<string | null>(null);
26
+ const [showPin, setShowPin] = useState(false);
27
+
28
+ const validatePin = useCallback((value: string) => {
29
+ if (value.length < minLength) {
30
+ return `PIN must be at least ${minLength} characters`;
31
+ }
32
+ if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
33
+ return 'PIN must include a special character';
34
+ }
35
+ if (requireNumber && !/\d/.test(value)) {
36
+ return 'PIN must include a number';
37
+ }
38
+ return null;
39
+ }, [minLength, requireSpecialChar, requireNumber]);
40
+
41
+ const handleSubmit = useCallback(() => {
42
+ const validationError = validatePin(pin);
43
+ if (validationError) {
44
+ setError(validationError);
45
+ return;
46
+ }
47
+ onSubmit(pin);
48
+ }, [pin, validatePin, onSubmit]);
49
+
50
+ const handlePinChange = useCallback((value: string) => {
51
+ setPin(value);
52
+ setError(null);
53
+ }, []);
54
+
55
+ return (
56
+ <View style={styles.container}>
57
+ <View style={styles.header}>
58
+ {onBack && (
59
+ <TouchableOpacity style={styles.backButton} onPress={onBack}>
60
+ <Icon name="arrow_back" size={24} color={COLORS.text.primary} />
61
+ </TouchableOpacity>
62
+ )}
63
+ <Text style={styles.title}>Create your PIN</Text>
64
+ <View style={styles.headerSpacer} />
65
+ </View>
66
+
67
+ <Text style={styles.subtitle}>
68
+ This PIN will be used to secure your account
69
+ </Text>
70
+
71
+ <View style={styles.inputContainer}>
72
+ <TextInput
73
+ style={styles.input}
74
+ value={pin}
75
+ onChangeText={handlePinChange}
76
+ secureTextEntry={!showPin}
77
+ placeholder="Enter PIN"
78
+ keyboardType="numeric"
79
+ maxLength={20}
80
+ autoCapitalize="none"
81
+ autoCorrect={false}
82
+ />
83
+ <TouchableOpacity
84
+ style={styles.visibilityButton}
85
+ onPress={() => setShowPin(!showPin)}
86
+ >
87
+ <Icon
88
+ name={showPin ? 'visibility-off' : 'visibility'}
89
+ size={24}
90
+ color={COLORS.text.secondary}
91
+ />
92
+ </TouchableOpacity>
93
+ </View>
94
+
95
+ {error && <Text style={styles.error}>{error}</Text>}
96
+
97
+ <View style={styles.requirements}>
98
+ <Text style={styles.requirementTitle}>PIN Requirements:</Text>
99
+ <Text style={[styles.requirement, pin.length >= minLength && styles.requirementMet]}>
100
+ • At least {minLength} characters
101
+ </Text>
102
+ {requireSpecialChar && (
103
+ <Text
104
+ style={[
105
+ styles.requirement,
106
+ /[!@#$%^&*(),.?":{}|<>]/.test(pin) && styles.requirementMet,
107
+ ]}
108
+ >
109
+ • Include a special character
110
+ </Text>
111
+ )}
112
+ {requireNumber && (
113
+ <Text
114
+ style={[
115
+ styles.requirement,
116
+ /\d/.test(pin) && styles.requirementMet,
117
+ ]}
118
+ >
119
+ • Include a number
120
+ </Text>
121
+ )}
122
+ </View>
123
+
124
+ <View style={styles.footer}>
125
+ {onBack && (
126
+ <TouchableOpacity
127
+ style={styles.cancelButton}
128
+ onPress={onBack}
129
+ >
130
+ <Text style={styles.cancelButtonText}>Back</Text>
131
+ </TouchableOpacity>
132
+ )}
133
+
134
+ <TouchableOpacity
135
+ style={[styles.submitButton, !pin && styles.submitButtonDisabled]}
136
+ onPress={handleSubmit}
137
+ disabled={!pin}
138
+ >
139
+ <Text style={styles.submitButtonText}>Continue</Text>
140
+ </TouchableOpacity>
141
+ </View>
142
+ </View>
143
+ );
144
+ };
145
+
146
+ const styles = StyleSheet.create({
147
+ container: {
148
+ flex: 1,
149
+ padding: 16,
150
+ width: width,
151
+ backgroundColor: '#fff',
152
+ },
153
+ header: {
154
+ flexDirection: 'row',
155
+ alignItems: 'center',
156
+ justifyContent: 'space-between',
157
+ marginBottom: 16,
158
+ paddingVertical: 8,
159
+ },
160
+ backButton: {
161
+ padding: 8,
162
+ },
163
+ headerSpacer: {
164
+ width: 40, // Same width as backButton for alignment
165
+ },
166
+ title: {
167
+ fontSize: 20,
168
+ fontWeight: '600',
169
+ color: COLORS.text.primary,
170
+ textAlign: 'center',
171
+ flex: 1,
172
+ },
173
+ subtitle: {
174
+ fontSize: 14,
175
+ color: COLORS.text.secondary,
176
+ marginBottom: 24,
177
+ textAlign: 'center',
178
+ },
179
+ inputContainer: {
180
+ flexDirection: 'row',
181
+ alignItems: 'center',
182
+ borderWidth: 1,
183
+ borderColor: COLORS.border,
184
+ borderRadius: 8,
185
+ marginBottom: 16,
186
+ },
187
+ input: {
188
+ flex: 1,
189
+ padding: 12,
190
+ fontSize: 16,
191
+ },
192
+ visibilityButton: {
193
+ padding: 12,
194
+ },
195
+ error: {
196
+ color: COLORS.error,
197
+ marginBottom: 16,
198
+ },
199
+ requirements: {
200
+ marginBottom: 24,
201
+ },
202
+ requirementTitle: {
203
+ fontSize: 14,
204
+ fontWeight: '600',
205
+ marginBottom: 8,
206
+ color: COLORS.text.primary,
207
+ },
208
+ requirement: {
209
+ fontSize: 14,
210
+ color: COLORS.text.secondary,
211
+ marginBottom: 4,
212
+ },
213
+ requirementMet: {
214
+ color: COLORS.success,
215
+ },
216
+ footer: {
217
+ flexDirection: 'row',
218
+ alignItems: 'center',
219
+ justifyContent: 'space-between',
220
+ marginTop: 24,
221
+ borderTopWidth: 1,
222
+ borderTopColor: '#eee',
223
+ paddingTop: 16,
224
+ },
225
+ cancelButton: {
226
+ paddingVertical: 8,
227
+ paddingHorizontal: 16,
228
+ },
229
+ cancelButtonText: {
230
+ color: '#666',
231
+ fontSize: 16,
232
+ },
233
+ submitButton: {
234
+ paddingVertical: 16,
235
+ paddingHorizontal: 32,
236
+ borderRadius: 16,
237
+ backgroundColor: COLORS.primary,
238
+ borderWidth: 1,
239
+ borderColor: COLORS.primary,
240
+ alignItems: 'center',
241
+ },
242
+ submitButtonDisabled: {
243
+ opacity: 0.5,
244
+ },
245
+ submitButtonText: {
246
+ color: '#fff',
247
+ fontSize: 16,
248
+ fontWeight: '600',
249
+ },
250
+ });