@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.
Files changed (183) hide show
  1. package/README.md +17 -138
  2. package/UI_COMPONENTS.md +142 -0
  3. package/lib/commonjs/assets/OxyLogo.svg +1 -0
  4. package/lib/commonjs/assets/assets/OxyLogo.svg +1 -0
  5. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  6. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  7. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  8. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  9. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  10. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  11. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  12. package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  13. package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  14. package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  15. package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  16. package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  17. package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  18. package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  19. package/lib/commonjs/core/index.js +783 -0
  20. package/lib/commonjs/core/index.js.map +1 -0
  21. package/lib/commonjs/index.js +128 -0
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/models/interfaces.js +2 -0
  24. package/lib/commonjs/models/interfaces.js.map +1 -0
  25. package/lib/commonjs/package.json +1 -0
  26. package/lib/commonjs/ui/components/FontLoader.js +181 -0
  27. package/lib/commonjs/ui/components/FontLoader.js.map +1 -0
  28. package/lib/commonjs/ui/components/OxyLogo.js +56 -0
  29. package/lib/commonjs/ui/components/OxyLogo.js.map +1 -0
  30. package/lib/commonjs/ui/components/OxyProvider.js +464 -0
  31. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -0
  32. package/lib/commonjs/ui/components/OxySignInButton.js +178 -0
  33. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -0
  34. package/lib/commonjs/ui/components/bottomSheet/index.js +37 -0
  35. package/lib/commonjs/ui/components/bottomSheet/index.js.map +1 -0
  36. package/lib/commonjs/ui/context/OxyContext.js +296 -0
  37. package/lib/commonjs/ui/context/OxyContext.js.map +1 -0
  38. package/lib/commonjs/ui/index.js +136 -0
  39. package/lib/commonjs/ui/index.js.map +1 -0
  40. package/lib/commonjs/ui/navigation/OxyRouter.js +140 -0
  41. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -0
  42. package/lib/commonjs/ui/navigation/types.js +6 -0
  43. package/lib/commonjs/ui/navigation/types.js.map +1 -0
  44. package/lib/commonjs/ui/screens/AccountCenterScreen.js +280 -0
  45. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -0
  46. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +578 -0
  47. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -0
  48. package/lib/commonjs/ui/screens/SignInScreen.js +230 -0
  49. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -0
  50. package/lib/commonjs/ui/screens/SignUpScreen.js +673 -0
  51. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -0
  52. package/lib/commonjs/ui/styles/FONTS.md +126 -0
  53. package/lib/commonjs/ui/styles/fonts.js +84 -0
  54. package/lib/commonjs/ui/styles/fonts.js.map +1 -0
  55. package/lib/commonjs/ui/styles/index.js +28 -0
  56. package/lib/commonjs/ui/styles/index.js.map +1 -0
  57. package/lib/commonjs/ui/styles/theme.js +122 -0
  58. package/lib/commonjs/ui/styles/theme.js.map +1 -0
  59. package/lib/module/assets/OxyLogo.svg +1 -0
  60. package/lib/module/assets/assets/OxyLogo.svg +1 -0
  61. package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  62. package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  63. package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  64. package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  65. package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  66. package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  67. package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  68. package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  69. package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  70. package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  71. package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  72. package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  73. package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  74. package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  75. package/lib/module/core/index.js +777 -0
  76. package/lib/module/core/index.js.map +1 -0
  77. package/lib/module/index.js +29 -0
  78. package/lib/module/index.js.map +1 -0
  79. package/lib/module/models/interfaces.js +2 -0
  80. package/lib/module/models/interfaces.js.map +1 -0
  81. package/lib/module/package.json +1 -0
  82. package/lib/module/ui/components/FontLoader.js +176 -0
  83. package/lib/module/ui/components/FontLoader.js.map +1 -0
  84. package/lib/module/ui/components/OxyLogo.js +49 -0
  85. package/lib/module/ui/components/OxyLogo.js.map +1 -0
  86. package/lib/module/ui/components/OxyProvider.js +458 -0
  87. package/lib/module/ui/components/OxyProvider.js.map +1 -0
  88. package/lib/module/ui/components/OxySignInButton.js +172 -0
  89. package/lib/module/ui/components/OxySignInButton.js.map +1 -0
  90. package/lib/module/ui/components/bottomSheet/index.js +8 -0
  91. package/lib/module/ui/components/bottomSheet/index.js.map +1 -0
  92. package/lib/module/ui/context/OxyContext.js +291 -0
  93. package/lib/module/ui/context/OxyContext.js.map +1 -0
  94. package/lib/module/ui/index.js +25 -0
  95. package/lib/module/ui/index.js.map +1 -0
  96. package/lib/module/ui/navigation/OxyRouter.js +133 -0
  97. package/lib/module/ui/navigation/OxyRouter.js.map +1 -0
  98. package/lib/module/ui/navigation/types.js +4 -0
  99. package/lib/module/ui/navigation/types.js.map +1 -0
  100. package/lib/module/ui/screens/AccountCenterScreen.js +275 -0
  101. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -0
  102. package/lib/module/ui/screens/AccountOverviewScreen.js +573 -0
  103. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -0
  104. package/lib/module/ui/screens/SignInScreen.js +224 -0
  105. package/lib/module/ui/screens/SignInScreen.js.map +1 -0
  106. package/lib/module/ui/screens/SignUpScreen.js +668 -0
  107. package/lib/module/ui/screens/SignUpScreen.js.map +1 -0
  108. package/lib/module/ui/styles/FONTS.md +126 -0
  109. package/lib/module/ui/styles/fonts.js +81 -0
  110. package/lib/module/ui/styles/fonts.js.map +1 -0
  111. package/lib/module/ui/styles/index.js +5 -0
  112. package/lib/module/ui/styles/index.js.map +1 -0
  113. package/lib/module/ui/styles/theme.js +115 -0
  114. package/lib/module/ui/styles/theme.js.map +1 -0
  115. package/lib/typescript/core/index.d.ts +304 -0
  116. package/lib/typescript/core/index.d.ts.map +1 -0
  117. package/lib/typescript/index.d.ts +11 -0
  118. package/lib/typescript/index.d.ts.map +1 -0
  119. package/lib/typescript/models/interfaces.d.ts +98 -0
  120. package/lib/typescript/models/interfaces.d.ts.map +1 -0
  121. package/lib/typescript/ui/components/FontLoader.d.ts +15 -0
  122. package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -0
  123. package/lib/typescript/ui/components/OxyLogo.d.ts +29 -0
  124. package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -0
  125. package/lib/typescript/ui/components/OxyProvider.d.ts +12 -0
  126. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -0
  127. package/lib/typescript/ui/components/OxySignInButton.d.ts +65 -0
  128. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -0
  129. package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -0
  130. package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -0
  131. package/lib/typescript/ui/context/OxyContext.d.ts +26 -0
  132. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -0
  133. package/lib/typescript/ui/index.d.ts +15 -0
  134. package/lib/typescript/ui/index.d.ts.map +1 -0
  135. package/lib/typescript/ui/navigation/OxyRouter.d.ts +5 -0
  136. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -0
  137. package/lib/typescript/ui/navigation/types.d.ts +107 -0
  138. package/lib/typescript/ui/navigation/types.d.ts.map +1 -0
  139. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +5 -0
  140. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -0
  141. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +5 -0
  142. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -0
  143. package/lib/typescript/ui/screens/SignInScreen.d.ts +5 -0
  144. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -0
  145. package/lib/typescript/ui/screens/SignUpScreen.d.ts +5 -0
  146. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -0
  147. package/lib/typescript/ui/styles/fonts.d.ts +21 -0
  148. package/lib/typescript/ui/styles/fonts.d.ts.map +1 -0
  149. package/lib/typescript/ui/styles/index.d.ts +3 -0
  150. package/lib/typescript/ui/styles/index.d.ts.map +1 -0
  151. package/lib/typescript/ui/styles/theme.d.ts +69 -0
  152. package/lib/typescript/ui/styles/theme.d.ts.map +1 -0
  153. package/package.json +95 -51
  154. package/src/assets/OxyLogo.svg +1 -0
  155. package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  156. package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  157. package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  158. package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  159. package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  160. package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  161. package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  162. package/src/core/index.ts +768 -0
  163. package/src/index.ts +46 -0
  164. package/src/models/interfaces.ts +128 -0
  165. package/src/ui/components/FontLoader.tsx +180 -0
  166. package/src/ui/components/OxyLogo.tsx +73 -0
  167. package/src/ui/components/OxyProvider.tsx +490 -0
  168. package/src/ui/components/OxySignInButton.tsx +207 -0
  169. package/src/ui/components/bottomSheet/index.tsx +12 -0
  170. package/src/ui/context/OxyContext.tsx +344 -0
  171. package/src/ui/index.ts +27 -0
  172. package/src/ui/navigation/OxyRouter.tsx +137 -0
  173. package/src/ui/navigation/types.ts +124 -0
  174. package/src/ui/screens/AccountCenterScreen.tsx +240 -0
  175. package/src/ui/screens/AccountOverviewScreen.tsx +519 -0
  176. package/src/ui/screens/SignInScreen.tsx +210 -0
  177. package/src/ui/screens/SignUpScreen.tsx +607 -0
  178. package/src/ui/styles/FONTS.md +126 -0
  179. package/src/ui/styles/fonts.ts +77 -0
  180. package/src/ui/styles/index.ts +2 -0
  181. package/src/ui/styles/theme.ts +142 -0
  182. package/dist/index.d.ts +0 -152
  183. 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;