@oxyhq/services 5.13.0 → 5.13.2
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 +71 -0
- package/lib/commonjs/core/HttpClient.js +238 -0
- package/lib/commonjs/core/HttpClient.js.map +1 -0
- package/lib/commonjs/core/OxyServices.js +530 -332
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/RequestManager.js +199 -0
- package/lib/commonjs/core/RequestManager.js.map +1 -0
- package/lib/commonjs/core/index.js +38 -1
- package/lib/commonjs/core/index.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/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/Avatar.js +94 -27
- package/lib/commonjs/ui/components/Avatar.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +1 -0
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- 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/components/internal/TextField.js +13 -8
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +443 -371
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +80 -22
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/index.js +4 -1
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +32 -2
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +101 -59
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +3 -2
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +75 -117
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +43 -50
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +14 -16
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +188 -142
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +10 -10
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.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 +218 -39
- 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 +424 -71
- 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/accountStore.js +237 -0
- package/lib/commonjs/ui/stores/accountStore.js.map +1 -0
- package/lib/commonjs/ui/stores/authStore.js +17 -20
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/authStyles.js +16 -8
- 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/asyncUtils.js +9 -22
- package/lib/commonjs/utils/asyncUtils.js.map +1 -1
- package/lib/commonjs/utils/cache.js +259 -0
- package/lib/commonjs/utils/cache.js.map +1 -0
- package/lib/commonjs/utils/index.js +99 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/languageUtils.js +159 -0
- package/lib/commonjs/utils/languageUtils.js.map +1 -0
- package/lib/commonjs/utils/requestUtils.js +217 -0
- package/lib/commonjs/utils/requestUtils.js.map +1 -0
- package/lib/commonjs/utils/sessionUtils.js +191 -0
- package/lib/commonjs/utils/sessionUtils.js.map +1 -0
- package/lib/commonjs/utils/validationUtils.js +1 -1
- package/lib/module/core/HttpClient.js +232 -0
- package/lib/module/core/HttpClient.js.map +1 -0
- package/lib/module/core/OxyServices.js +528 -326
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/RequestManager.js +194 -0
- package/lib/module/core/RequestManager.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.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/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/Avatar.js +94 -27
- package/lib/module/ui/components/Avatar.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +1 -0
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- 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/components/internal/TextField.js +13 -8
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +442 -370
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +80 -22
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/index.js +4 -2
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +33 -2
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +102 -60
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +3 -2
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +73 -117
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +44 -51
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +14 -16
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +187 -143
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +10 -10
- package/lib/module/ui/screens/internal/SignInPasswordStep.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 +219 -40
- 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 +426 -73
- 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/accountStore.js +229 -0
- package/lib/module/ui/stores/accountStore.js.map +1 -0
- package/lib/module/ui/stores/authStore.js +17 -20
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/authStyles.js +16 -8
- 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/asyncUtils.js +10 -22
- package/lib/module/utils/asyncUtils.js.map +1 -1
- package/lib/module/utils/cache.js +250 -0
- package/lib/module/utils/cache.js.map +1 -0
- package/lib/module/utils/index.js +7 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/languageUtils.js +151 -0
- package/lib/module/utils/languageUtils.js.map +1 -0
- package/lib/module/utils/requestUtils.js +210 -0
- package/lib/module/utils/requestUtils.js.map +1 -0
- package/lib/module/utils/sessionUtils.js +180 -0
- package/lib/module/utils/sessionUtils.js.map +1 -0
- package/lib/module/utils/validationUtils.js +1 -1
- package/lib/typescript/core/HttpClient.d.ts +64 -0
- package/lib/typescript/core/HttpClient.d.ts.map +1 -0
- package/lib/typescript/core/OxyServices.d.ts +86 -73
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/RequestManager.d.ts +67 -0
- package/lib/typescript/core/RequestManager.d.ts.map +1 -0
- package/lib/typescript/core/index.d.ts +2 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/i18n/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +15 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +1 -0
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/ui/components/Avatar.d.ts +6 -7
- package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
- package/lib/typescript/ui/components/FollowButton.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/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +5 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +2 -2
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts +3 -3
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.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/accountStore.d.ts +34 -0
- package/lib/typescript/ui/stores/accountStore.d.ts.map +1 -0
- 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 +19 -2
- 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/asyncUtils.d.ts +2 -0
- package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
- package/lib/typescript/utils/cache.d.ts +128 -0
- package/lib/typescript/utils/cache.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +4 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/languageUtils.d.ts +38 -0
- package/lib/typescript/utils/languageUtils.d.ts.map +1 -0
- package/lib/typescript/utils/requestUtils.d.ts +122 -0
- package/lib/typescript/utils/requestUtils.d.ts.map +1 -0
- package/lib/typescript/utils/sessionUtils.d.ts +55 -0
- package/lib/typescript/utils/sessionUtils.d.ts.map +1 -0
- package/lib/typescript/utils/validationUtils.d.ts +1 -1
- package/package.json +1 -1
- package/src/core/HttpClient.ts +277 -0
- package/src/core/OxyServices.ts +461 -352
- package/src/core/RequestManager.ts +240 -0
- package/src/core/index.ts +10 -0
- 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/index.ts +10 -0
- package/src/models/interfaces.ts +19 -0
- package/src/models/session.ts +1 -1
- package/src/ui/components/Avatar.tsx +151 -35
- package/src/ui/components/FollowButton.tsx +1 -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/components/internal/TextField.tsx +7 -6
- package/src/ui/context/OxyContext.tsx +441 -326
- package/src/ui/hooks/useSessionSocket.ts +72 -18
- package/src/ui/index.ts +4 -1
- package/src/ui/screens/AccountSettingsScreen.tsx +34 -2
- package/src/ui/screens/AccountSwitcherScreen.tsx +102 -68
- package/src/ui/screens/FileManagementScreen.tsx +16 -16
- package/src/ui/screens/LanguageSelectorScreen.tsx +86 -143
- package/src/ui/screens/SignInScreen.tsx +59 -43
- package/src/ui/screens/SignUpScreen.tsx +14 -15
- package/src/ui/screens/WelcomeNewUserScreen.tsx +153 -105
- package/src/ui/screens/internal/SignInPasswordStep.tsx +4 -6
- 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 +190 -32
- package/src/ui/screens/steps/SignInTotpStep.tsx +68 -34
- package/src/ui/screens/steps/SignInUsernameStep.tsx +446 -63
- 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/accountStore.ts +285 -0
- package/src/ui/stores/authStore.ts +16 -19
- package/src/ui/styles/authStyles.ts +16 -8
- package/src/ui/styles/index.ts +1 -0
- package/src/ui/styles/spacing.ts +46 -0
- package/src/utils/asyncUtils.ts +10 -24
- package/src/utils/cache.ts +264 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/languageUtils.ts +174 -0
- package/src/utils/requestUtils.ts +234 -0
- package/src/utils/sessionUtils.ts +206 -0
- package/src/utils/validationUtils.ts +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
2
3
|
import { View, Text, Image, StyleSheet, type StyleProp, type ViewStyle, type ImageStyle, type TextStyle, ActivityIndicator, Platform } from 'react-native';
|
|
3
4
|
import { useThemeColors } from '../styles';
|
|
4
5
|
import { fontFamilies } from '../styles/fonts';
|
|
@@ -16,7 +17,10 @@ export interface AvatarProps {
|
|
|
16
17
|
text?: string;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
|
-
* Full name to derive the initials from
|
|
20
|
+
* Full name to derive the initials from
|
|
21
|
+
* For single word: takes first letter
|
|
22
|
+
* For multiple words: takes first letter of first and last word (e.g., "John Doe" -> "JD")
|
|
23
|
+
* For usernames starting with @: takes first two letters after @
|
|
20
24
|
*/
|
|
21
25
|
name?: string;
|
|
22
26
|
|
|
@@ -67,9 +71,68 @@ export interface AvatarProps {
|
|
|
67
71
|
isLoading?: boolean;
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Extracts initials from a name string
|
|
76
|
+
* - Single word: first letter (e.g., "John" -> "J")
|
|
77
|
+
* - Multiple words: first letter of first and last word (e.g., "John Doe" -> "JD")
|
|
78
|
+
* - Username starting with @: first two letters after @ (e.g., "@johndoe" -> "JO")
|
|
79
|
+
*/
|
|
80
|
+
const getInitials = (nameStr: string): string => {
|
|
81
|
+
if (!nameStr?.trim()) return '';
|
|
82
|
+
|
|
83
|
+
const trimmed = nameStr.trim();
|
|
84
|
+
const parts = trimmed.split(/\s+/).filter(part => part.length > 0);
|
|
85
|
+
|
|
86
|
+
if (parts.length === 0) return '';
|
|
87
|
+
|
|
88
|
+
if (parts.length === 1) {
|
|
89
|
+
const firstPart = parts[0];
|
|
90
|
+
// Handle username format (@username)
|
|
91
|
+
if (firstPart.length >= 2 && firstPart.startsWith('@')) {
|
|
92
|
+
return firstPart.substring(1, 3).toUpperCase();
|
|
93
|
+
}
|
|
94
|
+
return firstPart.charAt(0).toUpperCase();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Multiple words: first letter of first and last word
|
|
98
|
+
return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Generates a consistent color from a string (name)
|
|
103
|
+
* Uses a simple hash function to create a deterministic color
|
|
104
|
+
*/
|
|
105
|
+
const generateColorFromString = (str: string): string => {
|
|
106
|
+
let hash = 0;
|
|
107
|
+
for (let i = 0; i < str.length; i++) {
|
|
108
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Generate a vibrant color with good contrast
|
|
112
|
+
const hue = Math.abs(hash) % 360;
|
|
113
|
+
// Use high saturation and medium lightness for vibrant, readable colors
|
|
114
|
+
return `hsl(${hue}, 65%, 55%)`;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Calculates font size based on avatar size for letter avatars
|
|
119
|
+
* Uses a larger ratio for better visibility
|
|
120
|
+
*/
|
|
121
|
+
const calculateFontSize = (size: number): number => {
|
|
122
|
+
// Use larger font size for letter avatars (50-55% of size)
|
|
123
|
+
return size <= 40
|
|
124
|
+
? Math.floor(size * 0.5)
|
|
125
|
+
: Math.floor(size * 0.45);
|
|
126
|
+
};
|
|
127
|
+
|
|
70
128
|
/**
|
|
71
129
|
* Avatar component that displays either an image or text avatar
|
|
72
|
-
* Falls back to displaying
|
|
130
|
+
* Falls back to displaying initials (1-2 letters) derived from the name if no image is provided
|
|
131
|
+
* Supports flexible sizing via the size prop (default: 40px)
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* <Avatar name="John Doe" size={100} theme="light" />
|
|
135
|
+
* <Avatar uri="https://example.com/avatar.jpg" size={50} />
|
|
73
136
|
*/
|
|
74
137
|
const Avatar: React.FC<AvatarProps> = ({
|
|
75
138
|
uri,
|
|
@@ -84,58 +147,111 @@ const Avatar: React.FC<AvatarProps> = ({
|
|
|
84
147
|
textStyle,
|
|
85
148
|
isLoading = false,
|
|
86
149
|
}) => {
|
|
87
|
-
// Get theme colors
|
|
88
150
|
const colors = useThemeColors(theme);
|
|
89
151
|
|
|
90
|
-
|
|
91
|
-
|
|
152
|
+
const displayText = useMemo(
|
|
153
|
+
() => text || (name ? getInitials(name) : ''),
|
|
154
|
+
[text, name]
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Generate a color from the name for letter avatars (only when no backgroundColor is provided and no uri)
|
|
158
|
+
const generatedBgColor = useMemo(
|
|
159
|
+
() => {
|
|
160
|
+
if (backgroundColor) return backgroundColor;
|
|
161
|
+
if (uri) return colors.primary; // Use primary for image avatars as fallback
|
|
162
|
+
// Generate color from name for letter avatars
|
|
163
|
+
const nameForColor = name || text || 'User';
|
|
164
|
+
return generateColorFromString(nameForColor);
|
|
165
|
+
},
|
|
166
|
+
[backgroundColor, uri, name, text, colors.primary]
|
|
167
|
+
);
|
|
92
168
|
|
|
93
|
-
//
|
|
94
|
-
const
|
|
169
|
+
// Memoize computed values to avoid recalculation on every render
|
|
170
|
+
const bgColor = useMemo(
|
|
171
|
+
() => generatedBgColor,
|
|
172
|
+
[generatedBgColor]
|
|
173
|
+
);
|
|
95
174
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
175
|
+
const fontSize = useMemo(
|
|
176
|
+
() => calculateFontSize(size),
|
|
177
|
+
[size]
|
|
178
|
+
);
|
|
99
179
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
180
|
+
const containerStyle = useMemo(
|
|
181
|
+
() => ({
|
|
182
|
+
width: size,
|
|
183
|
+
height: size,
|
|
184
|
+
borderRadius: size / 2,
|
|
185
|
+
}),
|
|
186
|
+
[size]
|
|
187
|
+
);
|
|
106
188
|
|
|
189
|
+
const textStyleComputed = useMemo(
|
|
190
|
+
() => [
|
|
191
|
+
styles.text,
|
|
192
|
+
{
|
|
193
|
+
fontSize,
|
|
194
|
+
fontFamily: fontFamilies.phuduBold,
|
|
195
|
+
color: textColor,
|
|
196
|
+
textAlign: 'center' as const,
|
|
197
|
+
lineHeight: size, // Match line height to size for perfect vertical centering
|
|
198
|
+
...(Platform.OS === 'android' && { includeFontPadding: false }), // Remove extra padding for better centering (Android only)
|
|
199
|
+
},
|
|
200
|
+
textStyle,
|
|
201
|
+
],
|
|
202
|
+
[fontSize, textColor, textStyle, size]
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
// Early return for loading state
|
|
107
206
|
if (isLoading) {
|
|
108
207
|
return (
|
|
109
|
-
<View
|
|
110
|
-
|
|
208
|
+
<View
|
|
209
|
+
style={[
|
|
210
|
+
styles.container,
|
|
211
|
+
containerStyle,
|
|
212
|
+
{ backgroundColor: colors.inputBackground },
|
|
213
|
+
style
|
|
214
|
+
]}
|
|
215
|
+
>
|
|
216
|
+
<ActivityIndicator
|
|
217
|
+
color={colors.primary}
|
|
218
|
+
size={size > 50 ? 'large' : 'small'}
|
|
219
|
+
/>
|
|
111
220
|
</View>
|
|
112
221
|
);
|
|
113
222
|
}
|
|
114
223
|
|
|
115
|
-
//
|
|
224
|
+
// Image avatar
|
|
116
225
|
if (uri) {
|
|
117
226
|
return (
|
|
118
|
-
<View
|
|
227
|
+
<View
|
|
228
|
+
style={[
|
|
229
|
+
styles.container,
|
|
230
|
+
containerStyle,
|
|
231
|
+
{ backgroundColor: bgColor },
|
|
232
|
+
style
|
|
233
|
+
]}
|
|
234
|
+
>
|
|
119
235
|
<Image
|
|
120
|
-
source={{ uri
|
|
236
|
+
source={{ uri }}
|
|
121
237
|
style={[styles.image, containerStyle, imageStyle]}
|
|
238
|
+
resizeMode="cover"
|
|
122
239
|
/>
|
|
123
240
|
</View>
|
|
124
241
|
);
|
|
125
242
|
}
|
|
126
243
|
|
|
127
|
-
//
|
|
244
|
+
// Text avatar with initials
|
|
128
245
|
return (
|
|
129
|
-
<View
|
|
130
|
-
|
|
131
|
-
styles.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
]}>
|
|
246
|
+
<View
|
|
247
|
+
style={[
|
|
248
|
+
styles.container,
|
|
249
|
+
containerStyle,
|
|
250
|
+
{ backgroundColor: bgColor },
|
|
251
|
+
style
|
|
252
|
+
]}
|
|
253
|
+
>
|
|
254
|
+
<Text style={textStyleComputed}>
|
|
139
255
|
{displayText}
|
|
140
256
|
</Text>
|
|
141
257
|
</View>
|
|
@@ -153,9 +269,9 @@ const styles = StyleSheet.create({
|
|
|
153
269
|
height: '100%',
|
|
154
270
|
},
|
|
155
271
|
text: {
|
|
156
|
-
|
|
157
|
-
fontWeight: Platform.OS === 'web' ? 'bold' : undefined, // Only apply fontWeight on web
|
|
272
|
+
fontWeight: Platform.OS === 'web' ? 'bold' : undefined,
|
|
158
273
|
},
|
|
159
274
|
});
|
|
160
275
|
|
|
161
|
-
|
|
276
|
+
// Memoize component to prevent unnecessary re-renders when props haven't changed
|
|
277
|
+
export default memo(Avatar);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
4
|
import * as Font from 'expo-font';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -21,21 +21,22 @@ const getPhuduFonts = () => {
|
|
|
21
21
|
'Phudu-Black': require('../../assets/fonts/Phudu/Phudu-Black.ttf'),
|
|
22
22
|
};
|
|
23
23
|
} catch (error) {
|
|
24
|
+
if (__DEV__) {
|
|
24
25
|
console.warn('Failed to load Phudu fonts:', error);
|
|
26
|
+
}
|
|
25
27
|
return null;
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* FontLoader component that loads custom fonts
|
|
32
|
+
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
31
33
|
* This works in both the package development and when consumed as an npm package
|
|
34
|
+
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
32
35
|
*/
|
|
33
36
|
export const FontLoader = ({
|
|
34
37
|
children,
|
|
35
|
-
fallbackContent,
|
|
36
38
|
}: {
|
|
37
39
|
children: React.ReactNode;
|
|
38
|
-
fallbackContent?: React.ReactNode;
|
|
39
40
|
}) => {
|
|
40
41
|
const [fontState, setFontState] = useState<'loading' | 'loaded' | 'error'>('loading');
|
|
41
42
|
|
|
@@ -54,8 +55,9 @@ export const FontLoader = ({
|
|
|
54
55
|
|
|
55
56
|
setFontState('loaded');
|
|
56
57
|
} catch (error) {
|
|
58
|
+
if (__DEV__) {
|
|
57
59
|
console.error('Error loading fonts:', error);
|
|
58
|
-
|
|
60
|
+
}
|
|
59
61
|
setFontState('error');
|
|
60
62
|
}
|
|
61
63
|
};
|
|
@@ -63,23 +65,14 @@ export const FontLoader = ({
|
|
|
63
65
|
loadFonts();
|
|
64
66
|
}, []);
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return <>{fallbackContent}</>;
|
|
70
|
-
}
|
|
71
|
-
return (
|
|
72
|
-
<View style={styles.loaderContainer}>
|
|
73
|
-
<ActivityIndicator size="small" color="#d169e5" />
|
|
74
|
-
</View>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (fontState === 'error') {
|
|
68
|
+
// Always render children immediately - fonts will load in background
|
|
69
|
+
// If fonts aren't loaded yet, the app will use system fonts as fallback
|
|
70
|
+
if (fontState === 'error' && __DEV__) {
|
|
79
71
|
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
80
72
|
}
|
|
81
73
|
|
|
82
|
-
//
|
|
74
|
+
// Render children immediately, even while fonts are loading
|
|
75
|
+
// Fonts will apply when they're ready, otherwise system fonts are used
|
|
83
76
|
return <>{children}</>;
|
|
84
77
|
};
|
|
85
78
|
|
|
@@ -148,35 +141,22 @@ export const setupFonts = async () => {
|
|
|
148
141
|
`;
|
|
149
142
|
|
|
150
143
|
style.textContent = fontFaceRules;
|
|
151
|
-
// Append to the document head
|
|
152
144
|
document.head.appendChild(style);
|
|
145
|
+
if (__DEV__) {
|
|
153
146
|
console.info('All Phudu web fonts have been dynamically loaded');
|
|
147
|
+
}
|
|
154
148
|
}
|
|
155
149
|
} else {
|
|
156
|
-
// For native platforms, guidance for the package users
|
|
157
|
-
console.info('Fonts should be linked in native projects to use Phudu fonts');
|
|
158
|
-
|
|
159
150
|
// Attempt to load the fonts anyway (this works if the consumer has linked the assets)
|
|
160
151
|
await Font.loadAsync(phuduFonts);
|
|
161
152
|
}
|
|
162
153
|
|
|
163
154
|
return true;
|
|
164
155
|
} catch (error: unknown) {
|
|
156
|
+
if (__DEV__) {
|
|
165
157
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
166
158
|
console.warn('Error setting up fonts:', errorMessage);
|
|
159
|
+
}
|
|
167
160
|
return false;
|
|
168
161
|
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const styles = StyleSheet.create({
|
|
172
|
-
loaderContainer: {
|
|
173
|
-
position: 'absolute',
|
|
174
|
-
top: 0,
|
|
175
|
-
left: 0,
|
|
176
|
-
right: 0,
|
|
177
|
-
bottom: 0,
|
|
178
|
-
justifyContent: 'center',
|
|
179
|
-
alignItems: 'center',
|
|
180
|
-
backgroundColor: 'transparent',
|
|
181
|
-
},
|
|
182
|
-
});
|
|
162
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useRef, useState, useEffect, useMemo, forwardRef, useImperativeHandle, type FC } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, Platform, Animated, StatusBar, Keyboard, KeyboardEvent, AppState } from 'react-native';
|
|
3
3
|
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
@@ -10,7 +10,7 @@ import { Toaster } from '../../lib/sonner';
|
|
|
10
10
|
import { QueryClient, QueryClientProvider, focusManager } from '@tanstack/react-query';
|
|
11
11
|
|
|
12
12
|
// Import bottom sheet components directly - no longer a peer dependency
|
|
13
|
-
import { BottomSheetModal, BottomSheetBackdrop, type BottomSheetBackdropProps, BottomSheetModalProvider, BottomSheetView
|
|
13
|
+
import { BottomSheetModal, BottomSheetBackdrop, type BottomSheetBackdropProps, BottomSheetModalProvider, BottomSheetView } from '@gorhom/bottom-sheet';
|
|
14
14
|
import type { BottomSheetModalMethods as BottomSheetModalRef } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
15
15
|
|
|
16
16
|
// Initialize fonts automatically
|
|
@@ -23,7 +23,7 @@ setupFonts();
|
|
|
23
23
|
* 1. As a context provider for authentication and session management across the app
|
|
24
24
|
* 2. As a UI component for authentication and account management using a bottom sheet
|
|
25
25
|
*/
|
|
26
|
-
const OxyProvider:
|
|
26
|
+
const OxyProvider: FC<OxyProviderProps> = (props) => {
|
|
27
27
|
const {
|
|
28
28
|
oxyServices,
|
|
29
29
|
children,
|
|
@@ -335,18 +335,19 @@ const OxyBottomSheet = forwardRef<BottomSheetController, OxyBottomSheetProps>(({
|
|
|
335
335
|
onChange={(index) => { isOpenRef.current = index !== -1; }}
|
|
336
336
|
onDismiss={() => { isOpenRef.current = false; }}
|
|
337
337
|
>
|
|
338
|
-
<
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
338
|
+
<BottomSheetView style={[styles.contentContainer]}>
|
|
339
|
+
<View
|
|
340
|
+
style={[
|
|
341
|
+
styles.centeredContentWrapper,
|
|
342
|
+
{ paddingBottom: (insets?.bottom ?? 0) + (appInsets?.bottom ?? 0) }
|
|
343
|
+
]}
|
|
344
|
+
>
|
|
344
345
|
<Animated.View
|
|
345
346
|
style={[
|
|
346
347
|
styles.animatedContent,
|
|
347
|
-
Platform.OS === 'android'
|
|
348
|
-
{ opacity: 1 }
|
|
349
|
-
{ opacity: fadeAnim, transform: [{ translateY: slideAnim }] }
|
|
348
|
+
Platform.OS === 'android'
|
|
349
|
+
? { opacity: 1 }
|
|
350
|
+
: { opacity: fadeAnim, transform: [{ translateY: slideAnim }] }
|
|
350
351
|
]}
|
|
351
352
|
>
|
|
352
353
|
{oxyServices ? (
|
|
@@ -366,7 +367,7 @@ const OxyBottomSheet = forwardRef<BottomSheetController, OxyBottomSheetProps>(({
|
|
|
366
367
|
)}
|
|
367
368
|
</Animated.View>
|
|
368
369
|
</View>
|
|
369
|
-
</
|
|
370
|
+
</BottomSheetView>
|
|
370
371
|
{showInternalToaster && (
|
|
371
372
|
<View style={styles.toasterContainer}>
|
|
372
373
|
<Toaster position="top-center" swipeToDismissDirection="left" />
|
|
@@ -13,11 +13,7 @@ import Animated, {
|
|
|
13
13
|
useSharedValue,
|
|
14
14
|
useAnimatedStyle,
|
|
15
15
|
withTiming,
|
|
16
|
-
withSequence,
|
|
17
|
-
withDelay,
|
|
18
|
-
withSpring,
|
|
19
16
|
runOnJS,
|
|
20
|
-
interpolate,
|
|
21
17
|
type SharedValue,
|
|
22
18
|
} from 'react-native-reanimated';
|
|
23
19
|
import { useThemeColors, createAuthStyles } from '../styles';
|
|
@@ -51,6 +47,38 @@ interface StepBasedScreenState {
|
|
|
51
47
|
isTransitioning: boolean;
|
|
52
48
|
}
|
|
53
49
|
|
|
50
|
+
// Individual animated progress dot
|
|
51
|
+
const AnimatedProgressDot: React.FC<{
|
|
52
|
+
isActive: boolean;
|
|
53
|
+
colors: any;
|
|
54
|
+
styles: any;
|
|
55
|
+
}> = ({ isActive, colors, styles }) => {
|
|
56
|
+
const width = useSharedValue(isActive ? 12 : 6);
|
|
57
|
+
const backgroundColor = useSharedValue(isActive ? colors.primary : colors.border);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
width.value = withTiming(isActive ? 12 : 6, { duration: 300 });
|
|
61
|
+
backgroundColor.value = withTiming(
|
|
62
|
+
isActive ? colors.primary : colors.border,
|
|
63
|
+
{ duration: 300 }
|
|
64
|
+
);
|
|
65
|
+
}, [isActive, colors.primary, colors.border, width, backgroundColor]);
|
|
66
|
+
|
|
67
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
68
|
+
width: width.value,
|
|
69
|
+
backgroundColor: backgroundColor.value,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Animated.View
|
|
74
|
+
style={[
|
|
75
|
+
styles.progressDot,
|
|
76
|
+
animatedStyle,
|
|
77
|
+
]}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
54
82
|
// Progress indicator component
|
|
55
83
|
const ProgressIndicator: React.FC<{
|
|
56
84
|
currentStep: number;
|
|
@@ -60,14 +88,11 @@ const ProgressIndicator: React.FC<{
|
|
|
60
88
|
}> = ({ currentStep, totalSteps, colors, styles }) => (
|
|
61
89
|
<View style={styles.progressContainer}>
|
|
62
90
|
{Array.from({ length: totalSteps }, (_, index) => (
|
|
63
|
-
<
|
|
91
|
+
<AnimatedProgressDot
|
|
64
92
|
key={index}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
? { backgroundColor: colors.primary, width: 24 }
|
|
69
|
-
: { backgroundColor: colors.border }
|
|
70
|
-
]}
|
|
93
|
+
isActive={currentStep === index}
|
|
94
|
+
colors={colors}
|
|
95
|
+
styles={styles}
|
|
71
96
|
/>
|
|
72
97
|
))}
|
|
73
98
|
</View>
|
|
@@ -183,6 +208,20 @@ const StepBasedScreen: React.FC<StepBasedScreenProps> = ({
|
|
|
183
208
|
fontWeight: '600' as const,
|
|
184
209
|
textDecorationLine: 'underline' as const,
|
|
185
210
|
},
|
|
211
|
+
progressContainer: {
|
|
212
|
+
flexDirection: 'row' as const,
|
|
213
|
+
width: '100%',
|
|
214
|
+
justifyContent: 'center' as const,
|
|
215
|
+
marginTop: 24, // Space for bottom sheet handle (~20px) + small buffer
|
|
216
|
+
marginBottom: 24, // Equal spacing below dots
|
|
217
|
+
},
|
|
218
|
+
progressDot: {
|
|
219
|
+
height: 6,
|
|
220
|
+
width: 6,
|
|
221
|
+
borderRadius: 3,
|
|
222
|
+
marginHorizontal: 3,
|
|
223
|
+
backgroundColor: colors.border,
|
|
224
|
+
},
|
|
186
225
|
}), [colors, theme]);
|
|
187
226
|
|
|
188
227
|
// State management
|
|
@@ -231,13 +270,6 @@ const StepBasedScreen: React.FC<StepBasedScreenProps> = ({
|
|
|
231
270
|
|
|
232
271
|
setState(prev => ({ ...prev, isTransitioning: true }));
|
|
233
272
|
|
|
234
|
-
// Scale down current content
|
|
235
|
-
scaleAnim.value = withSequence(
|
|
236
|
-
withTiming(0.95, { duration: 150 }),
|
|
237
|
-
withTiming(0.95, { duration: 50 })
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
// Define a JS function for runOnJS to avoid inline closures
|
|
241
273
|
const applyStepChange = (targetStep: number, totalSteps: number) => {
|
|
242
274
|
setState(prev => ({
|
|
243
275
|
...prev,
|
|
@@ -245,33 +277,24 @@ const StepBasedScreen: React.FC<StepBasedScreenProps> = ({
|
|
|
245
277
|
isTransitioning: false,
|
|
246
278
|
}));
|
|
247
279
|
onStepChangeRef.current?.(targetStep, totalSteps);
|
|
280
|
+
|
|
281
|
+
// Prepare next step animation
|
|
282
|
+
fadeAnim.value = 0;
|
|
283
|
+
scaleAnim.value = 0.98;
|
|
284
|
+
slideAnim.value = 0;
|
|
285
|
+
|
|
286
|
+
fadeAnim.value = withTiming(1, { duration: 220 });
|
|
287
|
+
scaleAnim.value = withTiming(1, { duration: 220 });
|
|
248
288
|
};
|
|
249
289
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
slideAnim.value = withDelay(16, withTiming(-50, { duration: 0 }));
|
|
259
|
-
scaleAnim.value = withDelay(16, withTiming(0.95, { duration: 0 }));
|
|
260
|
-
|
|
261
|
-
// Animate in new content
|
|
262
|
-
fadeAnim.value = withDelay(16, withTiming(1, { duration: 300 }));
|
|
263
|
-
slideAnim.value = withDelay(16, withSpring(0, {
|
|
264
|
-
damping: 15,
|
|
265
|
-
stiffness: 200,
|
|
266
|
-
}));
|
|
267
|
-
scaleAnim.value = withDelay(16, withSpring(1, {
|
|
268
|
-
damping: 15,
|
|
269
|
-
stiffness: 200,
|
|
270
|
-
}));
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
);
|
|
274
|
-
}, [enableAnimations, steps.length]);
|
|
290
|
+
// Animate current step out
|
|
291
|
+
scaleAnim.value = withTiming(0.98, { duration: 180 });
|
|
292
|
+
fadeAnim.value = withTiming(0, { duration: 180 }, (finished) => {
|
|
293
|
+
if (finished) {
|
|
294
|
+
runOnJS(applyStepChange)(nextStep, steps.length);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}, [enableAnimations, steps.length, fadeAnim, scaleAnim, slideAnim]);
|
|
275
298
|
|
|
276
299
|
// Navigation functions
|
|
277
300
|
const nextStep = useCallback(() => {
|