@oxyhq/services 0.1.17 → 5.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -138
- package/UI_COMPONENTS.md +142 -0
- package/lib/commonjs/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/core/index.js +783 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/index.js +128 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/interfaces.js +2 -0
- package/lib/commonjs/models/interfaces.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/ui/components/FontLoader.js +181 -0
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -0
- package/lib/commonjs/ui/components/OxyLogo.js +56 -0
- package/lib/commonjs/ui/components/OxyLogo.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +464 -0
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -0
- package/lib/commonjs/ui/components/OxySignInButton.js +178 -0
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +37 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +296 -0
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -0
- package/lib/commonjs/ui/index.js +136 -0
- package/lib/commonjs/ui/index.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +140 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/commonjs/ui/navigation/types.js +6 -0
- package/lib/commonjs/ui/navigation/types.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +280 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +578 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignInScreen.js +230 -0
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js +673 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/commonjs/ui/styles/FONTS.md +126 -0
- package/lib/commonjs/ui/styles/fonts.js +84 -0
- package/lib/commonjs/ui/styles/fonts.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +28 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -0
- package/lib/commonjs/ui/styles/theme.js +122 -0
- package/lib/commonjs/ui/styles/theme.js.map +1 -0
- package/lib/module/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/core/index.js +777 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/interfaces.js +2 -0
- package/lib/module/models/interfaces.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ui/components/FontLoader.js +176 -0
- package/lib/module/ui/components/FontLoader.js.map +1 -0
- package/lib/module/ui/components/OxyLogo.js +49 -0
- package/lib/module/ui/components/OxyLogo.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +458 -0
- package/lib/module/ui/components/OxyProvider.js.map +1 -0
- package/lib/module/ui/components/OxySignInButton.js +172 -0
- package/lib/module/ui/components/OxySignInButton.js.map +1 -0
- package/lib/module/ui/components/bottomSheet/index.js +8 -0
- package/lib/module/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +291 -0
- package/lib/module/ui/context/OxyContext.js.map +1 -0
- package/lib/module/ui/index.js +25 -0
- package/lib/module/ui/index.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +133 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/module/ui/navigation/types.js +4 -0
- package/lib/module/ui/navigation/types.js.map +1 -0
- package/lib/module/ui/screens/AccountCenterScreen.js +275 -0
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js +573 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/module/ui/screens/SignInScreen.js +224 -0
- package/lib/module/ui/screens/SignInScreen.js.map +1 -0
- package/lib/module/ui/screens/SignUpScreen.js +668 -0
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/module/ui/styles/FONTS.md +126 -0
- package/lib/module/ui/styles/fonts.js +81 -0
- package/lib/module/ui/styles/fonts.js.map +1 -0
- package/lib/module/ui/styles/index.js +5 -0
- package/lib/module/ui/styles/index.js.map +1 -0
- package/lib/module/ui/styles/theme.js +115 -0
- package/lib/module/ui/styles/theme.js.map +1 -0
- package/lib/typescript/core/index.d.ts +304 -0
- package/lib/typescript/core/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +11 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/models/interfaces.d.ts +98 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -0
- package/lib/typescript/ui/components/FontLoader.d.ts +15 -0
- package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts +29 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts +12 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts +65 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +26 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +15 -0
- package/lib/typescript/ui/index.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts +5 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/types.d.ts +107 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -0
- package/lib/typescript/ui/styles/fonts.d.ts +21 -0
- package/lib/typescript/ui/styles/fonts.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +3 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -0
- package/lib/typescript/ui/styles/theme.d.ts +69 -0
- package/lib/typescript/ui/styles/theme.d.ts.map +1 -0
- package/package.json +95 -51
- package/src/assets/OxyLogo.svg +1 -0
- package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/src/core/index.ts +768 -0
- package/src/index.ts +46 -0
- package/src/models/interfaces.ts +128 -0
- package/src/ui/components/FontLoader.tsx +180 -0
- package/src/ui/components/OxyLogo.tsx +73 -0
- package/src/ui/components/OxyProvider.tsx +490 -0
- package/src/ui/components/OxySignInButton.tsx +207 -0
- package/src/ui/components/bottomSheet/index.tsx +12 -0
- package/src/ui/context/OxyContext.tsx +344 -0
- package/src/ui/index.ts +27 -0
- package/src/ui/navigation/OxyRouter.tsx +137 -0
- package/src/ui/navigation/types.ts +124 -0
- package/src/ui/screens/AccountCenterScreen.tsx +240 -0
- package/src/ui/screens/AccountOverviewScreen.tsx +519 -0
- package/src/ui/screens/SignInScreen.tsx +210 -0
- package/src/ui/screens/SignUpScreen.tsx +607 -0
- package/src/ui/styles/FONTS.md +126 -0
- package/src/ui/styles/fonts.ts +77 -0
- package/src/ui/styles/index.ts +2 -0
- package/src/ui/styles/theme.ts +142 -0
- package/dist/index.d.ts +0 -152
- package/dist/index.js +0 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TextInput,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
ActivityIndicator,
|
|
9
|
+
Platform,
|
|
10
|
+
KeyboardAvoidingView,
|
|
11
|
+
ScrollView,
|
|
12
|
+
TextStyle,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
import { BaseScreenProps } from '../navigation/types';
|
|
15
|
+
import { useOxy } from '../context/OxyContext';
|
|
16
|
+
import { fontFamilies, useThemeColors, createCommonStyles } from '../styles';
|
|
17
|
+
import OxyLogo from '../components/OxyLogo';
|
|
18
|
+
|
|
19
|
+
const SignInScreen: React.FC<BaseScreenProps> = ({
|
|
20
|
+
navigate,
|
|
21
|
+
theme,
|
|
22
|
+
}) => {
|
|
23
|
+
const [username, setUsername] = useState('');
|
|
24
|
+
const [password, setPassword] = useState('');
|
|
25
|
+
const [errorMessage, setErrorMessage] = useState('');
|
|
26
|
+
|
|
27
|
+
const { login, isLoading, user, isAuthenticated } = useOxy();
|
|
28
|
+
|
|
29
|
+
const colors = useThemeColors(theme);
|
|
30
|
+
const commonStyles = createCommonStyles(theme);
|
|
31
|
+
|
|
32
|
+
// If user is already authenticated, show user info instead of login form
|
|
33
|
+
if (user && isAuthenticated) {
|
|
34
|
+
return (
|
|
35
|
+
<View style={[commonStyles.container, { padding: 20 }]}>
|
|
36
|
+
<Text style={[
|
|
37
|
+
styles.title,
|
|
38
|
+
{ color: colors.text }
|
|
39
|
+
]}>Welcome, {user.username}!</Text>
|
|
40
|
+
|
|
41
|
+
<View style={[styles.userInfoContainer, { backgroundColor: colors.inputBackground }]}>
|
|
42
|
+
<Text style={[styles.userInfoText, { color: colors.text }]}>
|
|
43
|
+
You are already signed in.
|
|
44
|
+
</Text>
|
|
45
|
+
{user.email && (
|
|
46
|
+
<Text style={[styles.userInfoText, { color: colors.secondaryText }]}>
|
|
47
|
+
Email: {user.email}
|
|
48
|
+
</Text>
|
|
49
|
+
)}
|
|
50
|
+
</View>
|
|
51
|
+
|
|
52
|
+
<View style={styles.actionButtonsContainer}>
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
style={[commonStyles.button, { backgroundColor: colors.primary }]}
|
|
55
|
+
onPress={() => navigate('AccountCenter')}
|
|
56
|
+
>
|
|
57
|
+
<Text style={commonStyles.buttonText}>Go to Account Center</Text>
|
|
58
|
+
</TouchableOpacity>
|
|
59
|
+
</View>
|
|
60
|
+
</View>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleLogin = async () => {
|
|
65
|
+
if (!username || !password) {
|
|
66
|
+
setErrorMessage('Please enter both username and password');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
setErrorMessage('');
|
|
72
|
+
await login(username, password);
|
|
73
|
+
// The authentication state change will be handled through context
|
|
74
|
+
} catch (error: any) {
|
|
75
|
+
setErrorMessage(error.message || 'Login failed');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<KeyboardAvoidingView
|
|
81
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
82
|
+
style={[commonStyles.container]}
|
|
83
|
+
>
|
|
84
|
+
<ScrollView
|
|
85
|
+
contentContainerStyle={commonStyles.scrollContainer}
|
|
86
|
+
keyboardShouldPersistTaps="handled"
|
|
87
|
+
>
|
|
88
|
+
<OxyLogo
|
|
89
|
+
style={{ marginBottom: 24 }}
|
|
90
|
+
width={50}
|
|
91
|
+
height={50}
|
|
92
|
+
/>
|
|
93
|
+
<Text style={[
|
|
94
|
+
styles.title,
|
|
95
|
+
{ color: colors.text }
|
|
96
|
+
]}>Sign In</Text>
|
|
97
|
+
|
|
98
|
+
{errorMessage ? (
|
|
99
|
+
<View style={commonStyles.errorContainer}>
|
|
100
|
+
<Text style={commonStyles.errorText}>{errorMessage}</Text>
|
|
101
|
+
</View>
|
|
102
|
+
) : null}
|
|
103
|
+
|
|
104
|
+
<View style={styles.formContainer}>
|
|
105
|
+
<View style={styles.inputContainer}>
|
|
106
|
+
<Text style={[styles.label, { color: colors.text }]}>Username</Text>
|
|
107
|
+
<TextInput
|
|
108
|
+
style={commonStyles.input}
|
|
109
|
+
placeholder="Enter your username"
|
|
110
|
+
placeholderTextColor={colors.placeholder}
|
|
111
|
+
value={username}
|
|
112
|
+
onChangeText={setUsername}
|
|
113
|
+
autoCapitalize="none"
|
|
114
|
+
testID="username-input"
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
|
|
118
|
+
<View style={styles.inputContainer}>
|
|
119
|
+
<Text style={[styles.label, { color: colors.text }]}>Password</Text>
|
|
120
|
+
<TextInput
|
|
121
|
+
style={commonStyles.input}
|
|
122
|
+
placeholder="Enter your password"
|
|
123
|
+
placeholderTextColor={colors.placeholder}
|
|
124
|
+
value={password}
|
|
125
|
+
onChangeText={setPassword}
|
|
126
|
+
secureTextEntry
|
|
127
|
+
testID="password-input"
|
|
128
|
+
/>
|
|
129
|
+
</View>
|
|
130
|
+
|
|
131
|
+
<TouchableOpacity
|
|
132
|
+
style={[commonStyles.button, { opacity: isLoading ? 0.8 : 1 }]}
|
|
133
|
+
onPress={handleLogin}
|
|
134
|
+
disabled={isLoading}
|
|
135
|
+
testID="login-button"
|
|
136
|
+
>
|
|
137
|
+
{isLoading ? (
|
|
138
|
+
<ActivityIndicator color="#FFFFFF" size="small" />
|
|
139
|
+
) : (
|
|
140
|
+
<Text style={commonStyles.buttonText}>Sign In</Text>
|
|
141
|
+
)}
|
|
142
|
+
</TouchableOpacity>
|
|
143
|
+
|
|
144
|
+
<View style={styles.footerTextContainer}>
|
|
145
|
+
<Text style={[styles.footerText, { color: colors.text }]}>
|
|
146
|
+
Don't have an account?{' '}
|
|
147
|
+
</Text>
|
|
148
|
+
<TouchableOpacity onPress={() => navigate('SignUp')}>
|
|
149
|
+
<Text style={[styles.linkText, { color: colors.primary }]}>Sign Up</Text>
|
|
150
|
+
</TouchableOpacity>
|
|
151
|
+
</View>
|
|
152
|
+
</View>
|
|
153
|
+
</ScrollView>
|
|
154
|
+
</KeyboardAvoidingView>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const styles = StyleSheet.create({
|
|
159
|
+
// Local screen-specific styles
|
|
160
|
+
title: {
|
|
161
|
+
fontFamily: Platform.OS === 'web'
|
|
162
|
+
? 'Phudu' // Use CSS font name directly for web
|
|
163
|
+
: 'Phudu-Bold', // Use exact font name as registered with Font.loadAsync
|
|
164
|
+
fontWeight: Platform.OS === 'web' ? 'bold' : undefined, // Only apply fontWeight on web
|
|
165
|
+
fontSize: 44,
|
|
166
|
+
marginBottom: 24,
|
|
167
|
+
},
|
|
168
|
+
formContainer: {
|
|
169
|
+
width: '100%',
|
|
170
|
+
},
|
|
171
|
+
inputContainer: {
|
|
172
|
+
marginBottom: 16,
|
|
173
|
+
},
|
|
174
|
+
label: {
|
|
175
|
+
fontSize: 14,
|
|
176
|
+
fontWeight: '500' as TextStyle['fontWeight'],
|
|
177
|
+
marginBottom: 8,
|
|
178
|
+
},
|
|
179
|
+
footerTextContainer: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
justifyContent: 'center',
|
|
182
|
+
marginTop: 24,
|
|
183
|
+
},
|
|
184
|
+
footerText: {
|
|
185
|
+
fontSize: 14,
|
|
186
|
+
lineHeight: 20,
|
|
187
|
+
},
|
|
188
|
+
linkText: {
|
|
189
|
+
fontSize: 14,
|
|
190
|
+
lineHeight: 20,
|
|
191
|
+
fontWeight: '600',
|
|
192
|
+
},
|
|
193
|
+
// New styles for authenticated user view
|
|
194
|
+
userInfoContainer: {
|
|
195
|
+
padding: 20,
|
|
196
|
+
marginVertical: 20,
|
|
197
|
+
borderRadius: 35,
|
|
198
|
+
alignItems: 'center',
|
|
199
|
+
},
|
|
200
|
+
userInfoText: {
|
|
201
|
+
fontSize: 16,
|
|
202
|
+
lineHeight: 24,
|
|
203
|
+
textAlign: 'center',
|
|
204
|
+
},
|
|
205
|
+
actionButtonsContainer: {
|
|
206
|
+
marginTop: 20,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export default SignInScreen;
|