@oxyhq/services 5.12.11 → 5.13.1
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/lib/commonjs/core/OxyServices.js +86 -8
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/i18n/index.js +37 -1
- package/lib/commonjs/i18n/index.js.map +1 -1
- package/lib/commonjs/i18n/locales/ar-SA.json +128 -0
- package/lib/commonjs/i18n/locales/ca-ES.json +128 -0
- package/lib/commonjs/i18n/locales/de-DE.json +128 -0
- package/lib/commonjs/i18n/locales/en-US.json +85 -12
- package/lib/commonjs/i18n/locales/es-ES.json +58 -6
- package/lib/commonjs/i18n/locales/fr-FR.json +128 -0
- package/lib/commonjs/i18n/locales/it-IT.json +128 -0
- package/lib/commonjs/i18n/locales/ja-JP.json +127 -0
- package/lib/commonjs/i18n/locales/ko-KR.json +128 -0
- package/lib/commonjs/i18n/locales/pt-PT.json +128 -0
- package/lib/commonjs/i18n/locales/zh-CN.json +128 -0
- package/lib/commonjs/ui/components/FontLoader.js +22 -42
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +5 -8
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/StepBasedScreen.js +64 -44
- package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -35
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +2 -2
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +434 -321
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +56 -5
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +43 -39
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +139 -125
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +2 -4
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js +45 -25
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverResetPasswordStep.js +88 -53
- package/lib/commonjs/ui/screens/steps/RecoverResetPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js +79 -58
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js +61 -52
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js +220 -31
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignInTotpStep.js +77 -50
- package/lib/commonjs/ui/screens/steps/SignInTotpStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js +527 -66
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js +55 -30
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js +64 -46
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js +84 -146
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js +113 -34
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +16 -20
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/authStyles.js +2 -1
- package/lib/commonjs/ui/styles/authStyles.js.map +1 -1
- package/lib/commonjs/ui/styles/index.js +11 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -1
- package/lib/commonjs/ui/styles/spacing.js +51 -0
- package/lib/commonjs/ui/styles/spacing.js.map +1 -0
- package/lib/commonjs/utils/validationUtils.js +1 -1
- package/lib/module/core/OxyServices.js +86 -8
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/i18n/index.js +37 -1
- package/lib/module/i18n/index.js.map +1 -1
- package/lib/module/i18n/locales/ar-SA.json +128 -0
- package/lib/module/i18n/locales/ca-ES.json +128 -0
- package/lib/module/i18n/locales/de-DE.json +128 -0
- package/lib/module/i18n/locales/en-US.json +85 -12
- package/lib/module/i18n/locales/es-ES.json +58 -6
- package/lib/module/i18n/locales/fr-FR.json +128 -0
- package/lib/module/i18n/locales/it-IT.json +128 -0
- package/lib/module/i18n/locales/ja-JP.json +127 -0
- package/lib/module/i18n/locales/ko-KR.json +128 -0
- package/lib/module/i18n/locales/pt-PT.json +128 -0
- package/lib/module/i18n/locales/zh-CN.json +128 -0
- package/lib/module/ui/components/FontLoader.js +23 -43
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +6 -8
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/StepBasedScreen.js +65 -45
- package/lib/module/ui/components/StepBasedScreen.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +14 -35
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +2 -2
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +434 -321
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +56 -5
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +44 -40
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +138 -126
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +2 -4
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverRequestStep.js +45 -25
- package/lib/module/ui/screens/steps/RecoverRequestStep.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverResetPasswordStep.js +89 -54
- package/lib/module/ui/screens/steps/RecoverResetPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js +80 -59
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js +62 -53
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignInPasswordStep.js +221 -32
- package/lib/module/ui/screens/steps/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignInTotpStep.js +78 -51
- package/lib/module/ui/screens/steps/SignInTotpStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignInUsernameStep.js +530 -68
- package/lib/module/ui/screens/steps/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js +55 -30
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js +65 -47
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js +84 -146
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js.map +1 -1
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js +114 -35
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +16 -20
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/authStyles.js +2 -1
- package/lib/module/ui/styles/authStyles.js.map +1 -1
- package/lib/module/ui/styles/index.js +1 -0
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/module/ui/styles/spacing.js +48 -0
- package/lib/module/ui/styles/spacing.js.map +1 -0
- package/lib/module/utils/validationUtils.js +1 -1
- package/lib/typescript/core/OxyServices.d.ts +38 -2
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/i18n/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/FontLoader.d.ts +3 -3
- package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts +2 -2
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/StepBasedScreen.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +10 -0
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverResetPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts +2 -0
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignInTotpStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +7 -3
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/authStyles.d.ts +1 -0
- package/lib/typescript/ui/styles/authStyles.d.ts.map +1 -1
- package/lib/typescript/ui/styles/index.d.ts +1 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -1
- package/lib/typescript/ui/styles/spacing.d.ts +43 -0
- package/lib/typescript/ui/styles/spacing.d.ts.map +1 -0
- package/lib/typescript/utils/validationUtils.d.ts +1 -1
- package/package.json +1 -1
- package/src/core/OxyServices.ts +96 -10
- package/src/i18n/index.ts +36 -0
- package/src/i18n/locales/ar-SA.json +128 -0
- package/src/i18n/locales/ca-ES.json +128 -0
- package/src/i18n/locales/de-DE.json +128 -0
- package/src/i18n/locales/en-US.json +85 -12
- package/src/i18n/locales/es-ES.json +58 -6
- package/src/i18n/locales/fr-FR.json +128 -0
- package/src/i18n/locales/it-IT.json +128 -0
- package/src/i18n/locales/ja-JP.json +127 -0
- package/src/i18n/locales/ko-KR.json +128 -0
- package/src/i18n/locales/pt-PT.json +128 -0
- package/src/i18n/locales/zh-CN.json +128 -0
- package/src/ui/components/FontLoader.tsx +17 -37
- package/src/ui/components/OxyProvider.tsx +14 -13
- package/src/ui/components/StepBasedScreen.tsx +66 -43
- package/src/ui/components/internal/GroupedPillButtons.tsx +15 -31
- package/src/ui/components/internal/PinInput.tsx +2 -2
- package/src/ui/context/OxyContext.tsx +404 -285
- package/src/ui/screens/FileManagementScreen.tsx +81 -4
- package/src/ui/screens/SignInScreen.tsx +59 -36
- package/src/ui/screens/WelcomeNewUserScreen.tsx +102 -91
- package/src/ui/screens/internal/SignInUsernameStep.tsx +1 -1
- package/src/ui/screens/steps/RecoverRequestStep.tsx +34 -24
- package/src/ui/screens/steps/RecoverResetPasswordStep.tsx +65 -36
- package/src/ui/screens/steps/RecoverSuccessStep.tsx +71 -47
- package/src/ui/screens/steps/RecoverVerifyStep.tsx +60 -50
- package/src/ui/screens/steps/SignInPasswordStep.tsx +191 -29
- package/src/ui/screens/steps/SignInTotpStep.tsx +68 -34
- package/src/ui/screens/steps/SignInUsernameStep.tsx +586 -57
- package/src/ui/screens/steps/SignUpIdentityStep.tsx +49 -35
- package/src/ui/screens/steps/SignUpSecurityStep.tsx +56 -39
- package/src/ui/screens/steps/SignUpSummaryStep.tsx +99 -89
- package/src/ui/screens/steps/SignUpWelcomeStep.tsx +88 -20
- package/src/ui/stores/authStore.ts +15 -19
- package/src/ui/styles/authStyles.ts +2 -1
- package/src/ui/styles/index.ts +1 -0
- package/src/ui/styles/spacing.ts +46 -0
- package/src/utils/validationUtils.ts +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { RouteName } from '../../navigation/routes';
|
|
3
|
-
import { View, Text, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { View, Text, TouchableOpacity, Platform, StyleSheet, type ViewStyle, type TextStyle } from 'react-native';
|
|
4
4
|
import { Ionicons } from '@expo/vector-icons';
|
|
5
5
|
import HighFive from '../../../assets/illustrations/HighFive';
|
|
6
6
|
import { useI18n } from '../../hooks/useI18n';
|
|
7
|
+
import { STEP_GAP, STEP_INNER_GAP, stepStyles } from '../../styles/spacing';
|
|
7
8
|
|
|
8
9
|
interface SignUpWelcomeStepProps {
|
|
9
10
|
// Common props from StepBasedScreen
|
|
@@ -25,35 +26,102 @@ const SignUpWelcomeStep: React.FC<SignUpWelcomeStepProps> = ({
|
|
|
25
26
|
nextStep,
|
|
26
27
|
}) => {
|
|
27
28
|
const { t } = useI18n();
|
|
29
|
+
const localStyles = stylesheet;
|
|
30
|
+
const baseStyles = stepStyles;
|
|
31
|
+
const webShadowReset = Platform.OS === 'web' ? ({ boxShadow: 'none' } as any) : null;
|
|
32
|
+
|
|
28
33
|
return (
|
|
29
34
|
<>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
<Text style={[styles.modernTitle, { color: colors.text }]}>{t('signup.welcome.title')}</Text>
|
|
33
|
-
<Text style={[styles.modernSubtitle, { color: colors.secondaryText }]}>{t('signup.welcome.subtitle')}</Text>
|
|
34
|
-
</View>
|
|
35
|
-
|
|
36
|
-
<View style={styles.modernInputContainer}>
|
|
35
|
+
<View style={[baseStyles.container, baseStyles.sectionSpacing, { alignItems: 'flex-start', position: 'relative' }]}>
|
|
36
|
+
<HighFive width={100} height={100} />
|
|
37
37
|
<TouchableOpacity
|
|
38
|
-
style={[
|
|
39
|
-
onPress={
|
|
40
|
-
|
|
38
|
+
style={[localStyles.languageButton, { backgroundColor: colors.inputBackground }]}
|
|
39
|
+
onPress={() => navigate('LanguageSelector')}
|
|
40
|
+
activeOpacity={0.7}
|
|
41
41
|
>
|
|
42
|
-
<Ionicons name="
|
|
43
|
-
<Text style={[styles.buttonText, { color: colors.background }]}>{t('common.actions.getStarted')}</Text>
|
|
42
|
+
<Ionicons name="globe-outline" size={20} color={colors.primary} />
|
|
44
43
|
</TouchableOpacity>
|
|
44
|
+
</View>
|
|
45
|
+
<View style={[baseStyles.container, baseStyles.sectionSpacing, baseStyles.header]}>
|
|
46
|
+
<Text style={[styles.modernTitle, baseStyles.title, { color: colors.text, marginBottom: 0, marginTop: 0 }]}>{t('signup.welcome.title')}</Text>
|
|
47
|
+
<Text style={[styles.modernSubtitle, baseStyles.subtitle, { color: colors.secondaryText, marginBottom: 0, marginTop: 0 }]}>{t('signup.welcome.subtitle')}</Text>
|
|
48
|
+
</View>
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
<View style={[baseStyles.container, baseStyles.sectionSpacing]}>
|
|
51
|
+
<View
|
|
52
|
+
style={[
|
|
53
|
+
localStyles.actionCard,
|
|
54
|
+
{ backgroundColor: colors.inputBackground || colors.card || 'rgba(0,0,0,0.04)' },
|
|
55
|
+
webShadowReset,
|
|
56
|
+
]}
|
|
49
57
|
>
|
|
50
|
-
<
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
<TouchableOpacity
|
|
59
|
+
style={[
|
|
60
|
+
styles.button,
|
|
61
|
+
localStyles.primaryButton,
|
|
62
|
+
{ backgroundColor: colors.primary },
|
|
63
|
+
webShadowReset,
|
|
64
|
+
]}
|
|
65
|
+
onPress={nextStep}
|
|
66
|
+
testID="get-started-button"
|
|
67
|
+
>
|
|
68
|
+
<Text style={[styles.buttonText, localStyles.buttonText, { color: colors.background }]}>{t('common.actions.getStarted')}</Text>
|
|
69
|
+
</TouchableOpacity>
|
|
70
|
+
|
|
71
|
+
<TouchableOpacity
|
|
72
|
+
style={[styles.footerTextContainer, localStyles.footerLink, { marginTop: 0 }]}
|
|
73
|
+
onPress={() => navigate('SignIn')}
|
|
74
|
+
>
|
|
75
|
+
<Text style={[styles.footerText, { color: colors.secondaryText }]}>
|
|
76
|
+
{t('signup.welcome.haveAccount')}
|
|
77
|
+
<Text style={{ color: colors.primary, fontWeight: '600' }}> {t('signup.welcome.signInCta')}</Text>
|
|
78
|
+
</Text>
|
|
79
|
+
</TouchableOpacity>
|
|
80
|
+
</View>
|
|
54
81
|
</View>
|
|
55
82
|
</>
|
|
56
83
|
);
|
|
57
84
|
};
|
|
58
85
|
|
|
59
86
|
export default SignUpWelcomeStep;
|
|
87
|
+
|
|
88
|
+
const stylesheet = StyleSheet.create({
|
|
89
|
+
actionCard: {
|
|
90
|
+
width: '100%',
|
|
91
|
+
maxWidth: 420,
|
|
92
|
+
borderRadius: 28,
|
|
93
|
+
paddingHorizontal: 20,
|
|
94
|
+
paddingVertical: 18,
|
|
95
|
+
gap: STEP_INNER_GAP,
|
|
96
|
+
alignItems: 'stretch',
|
|
97
|
+
shadowColor: 'transparent',
|
|
98
|
+
},
|
|
99
|
+
primaryButton: {
|
|
100
|
+
borderRadius: 28,
|
|
101
|
+
width: '100%',
|
|
102
|
+
paddingVertical: 16,
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
shadowOpacity: 0,
|
|
105
|
+
shadowRadius: 0,
|
|
106
|
+
shadowOffset: { width: 0, height: 0 },
|
|
107
|
+
elevation: 0,
|
|
108
|
+
},
|
|
109
|
+
buttonText: {
|
|
110
|
+
fontSize: 16,
|
|
111
|
+
fontWeight: '600',
|
|
112
|
+
textAlign: 'center',
|
|
113
|
+
},
|
|
114
|
+
footerLink: {
|
|
115
|
+
alignSelf: 'center',
|
|
116
|
+
},
|
|
117
|
+
languageButton: {
|
|
118
|
+
position: 'absolute',
|
|
119
|
+
top: 0,
|
|
120
|
+
right: 0,
|
|
121
|
+
width: 40,
|
|
122
|
+
height: 40,
|
|
123
|
+
borderRadius: 20,
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
},
|
|
127
|
+
});
|
|
@@ -7,12 +7,11 @@ interface AuthState {
|
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
error: string | null;
|
|
9
9
|
lastUserFetch: number | null; // Timestamp of last user fetch for caching
|
|
10
|
-
loginStart: () => void;
|
|
11
10
|
loginSuccess: (user: User) => void;
|
|
12
11
|
loginFailure: (error: string) => void;
|
|
13
12
|
logout: () => void;
|
|
14
|
-
fetchUser: (oxyServices:
|
|
15
|
-
updateUser: (updates: Partial<User>, oxyServices:
|
|
13
|
+
fetchUser: (oxyServices: { getCurrentUser: () => Promise<User> }, forceRefresh?: boolean) => Promise<void>;
|
|
14
|
+
updateUser: (updates: Partial<User>, oxyServices: { updateProfile: (updates: Partial<User>) => Promise<User>; getCurrentUser: () => Promise<User> }) => Promise<void>;
|
|
16
15
|
setUser: (user: User) => void; // Direct user setter for caching
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -22,7 +21,6 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
22
21
|
isLoading: false,
|
|
23
22
|
error: null,
|
|
24
23
|
lastUserFetch: null,
|
|
25
|
-
loginStart: () => set({ isLoading: true, error: null }),
|
|
26
24
|
loginSuccess: (user: User) => set({ isLoading: false, isAuthenticated: true, user, lastUserFetch: Date.now() }),
|
|
27
25
|
loginFailure: (error: string) => set({ isLoading: false, error }),
|
|
28
26
|
logout: () => set({ user: null, isAuthenticated: false, lastUserFetch: null }),
|
|
@@ -35,38 +33,36 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
35
33
|
|
|
36
34
|
// Use cached data if available and not forcing refresh
|
|
37
35
|
if (!forceRefresh && state.user && cacheValid) {
|
|
36
|
+
if (__DEV__) {
|
|
38
37
|
console.log('AuthStore: Using cached user data (age:', cacheAge, 'ms)');
|
|
38
|
+
}
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
set({ isLoading: true, error: null });
|
|
43
43
|
try {
|
|
44
|
-
console.log('AuthStore: Fetching user data...');
|
|
45
44
|
const user = await oxyServices.getCurrentUser();
|
|
46
|
-
console.log('AuthStore: Received user data:', {
|
|
47
|
-
hasUser: !!user,
|
|
48
|
-
userLinksMetadata: user?.linksMetadata,
|
|
49
|
-
userLinks: user?.links,
|
|
50
|
-
userWebsite: user?.website
|
|
51
|
-
});
|
|
52
45
|
set({ user, isLoading: false, isAuthenticated: true, lastUserFetch: now });
|
|
53
|
-
} catch (error
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to fetch user';
|
|
48
|
+
if (__DEV__) {
|
|
54
49
|
console.error('AuthStore: Error fetching user:', error);
|
|
55
|
-
|
|
50
|
+
}
|
|
51
|
+
set({ error: errorMessage, isLoading: false });
|
|
56
52
|
}
|
|
57
53
|
},
|
|
58
54
|
updateUser: async (updates, oxyServices) => {
|
|
59
55
|
set({ isLoading: true, error: null });
|
|
60
56
|
try {
|
|
61
|
-
console.log('AuthStore: Updating user with:', updates);
|
|
62
57
|
await oxyServices.updateProfile(updates);
|
|
63
|
-
console.log('AuthStore: Profile updated successfully');
|
|
64
58
|
// Immediately fetch the latest user data after update
|
|
65
|
-
await useAuthStore.getState().fetchUser(oxyServices, true);
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
await useAuthStore.getState().fetchUser({ getCurrentUser: oxyServices.getCurrentUser }, true);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to update user';
|
|
62
|
+
if (__DEV__) {
|
|
68
63
|
console.error('AuthStore: Error updating user:', error);
|
|
69
|
-
|
|
64
|
+
}
|
|
65
|
+
set({ error: errorMessage, isLoading: false });
|
|
70
66
|
}
|
|
71
67
|
},
|
|
72
68
|
}));
|
package/src/ui/styles/index.ts
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared spacing constants for authentication screens
|
|
5
|
+
* These values ensure consistent vertical spacing across all step components
|
|
6
|
+
* All gaps between elements (illustration, title, description, textfield, buttons, etc.) use this value
|
|
7
|
+
*/
|
|
8
|
+
export const STEP_GAP = 12; // Vertical gap between ALL elements (illustration, title, description, textfield, buttons, etc.) - must be consistent everywhere
|
|
9
|
+
export const STEP_INNER_GAP = 12; // Gap within sections (headers, cards, etc.) - must match STEP_GAP for uniformity
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Reusable stylesheet for step components
|
|
13
|
+
* All step components should use these base styles for consistency
|
|
14
|
+
*/
|
|
15
|
+
export const stepStyles = StyleSheet.create({
|
|
16
|
+
container: {
|
|
17
|
+
width: '100%',
|
|
18
|
+
maxWidth: 420,
|
|
19
|
+
alignSelf: 'center',
|
|
20
|
+
},
|
|
21
|
+
sectionSpacing: {
|
|
22
|
+
marginBottom: STEP_GAP,
|
|
23
|
+
},
|
|
24
|
+
header: {
|
|
25
|
+
alignItems: 'flex-start',
|
|
26
|
+
width: '100%',
|
|
27
|
+
gap: STEP_INNER_GAP,
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
textAlign: 'left',
|
|
31
|
+
marginBottom: 0,
|
|
32
|
+
marginTop: 0,
|
|
33
|
+
},
|
|
34
|
+
subtitle: {
|
|
35
|
+
textAlign: 'left',
|
|
36
|
+
maxWidth: 320,
|
|
37
|
+
alignSelf: 'flex-start',
|
|
38
|
+
marginBottom: 0,
|
|
39
|
+
marginTop: 0,
|
|
40
|
+
},
|
|
41
|
+
buttonContainer: {
|
|
42
|
+
marginTop: 0,
|
|
43
|
+
marginBottom: 0,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Username validation regex (alphanumeric,
|
|
11
|
+
* Username validation regex (alphanumeric, underscores, and hyphens, 3-30 chars)
|
|
12
12
|
*/
|
|
13
13
|
export const USERNAME_REGEX = /^[a-zA-Z0-9_-]{3,30}$/;
|
|
14
14
|
|