@oxyhq/services 5.5.9 → 5.6.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/README.md +16 -2
- package/lib/commonjs/core/index.js +69 -82
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +24 -183
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/node/index.js +0 -2
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +100 -229
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxyPayButton.js +131 -0
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +41 -198
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +15 -2
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +66 -0
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -0
- package/lib/commonjs/ui/components/icon/index.js +7 -0
- package/lib/commonjs/ui/components/icon/index.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -7
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +108 -0
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -0
- package/lib/commonjs/ui/components/internal/TextField.js +20 -0
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +116 -84
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/index.js +2 -15
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollow.js +52 -136
- package/lib/commonjs/ui/hooks/useFollow.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +52 -0
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -0
- package/lib/commonjs/ui/index.js +8 -191
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +52 -60
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +18 -30
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +4 -22
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +90 -39
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +37 -66
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +21 -44
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +44 -23
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +59 -78
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +1588 -0
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +22 -36
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +269 -0
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +47 -69
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +99 -333
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +136 -340
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +192 -0
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +135 -0
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +108 -0
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +126 -0
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +84 -0
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +59 -0
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +15 -2
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +66 -0
- package/lib/commonjs/ui/stores/authStore.js.map +1 -0
- package/lib/commonjs/ui/stores/followStore.js +124 -0
- package/lib/commonjs/ui/stores/followStore.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +0 -11
- package/lib/commonjs/ui/styles/index.js.map +1 -1
- package/lib/commonjs/ui/utils/confirmAction.js +28 -0
- package/lib/commonjs/ui/utils/confirmAction.js.map +1 -0
- package/lib/module/core/index.js +69 -81
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +14 -17
- package/lib/module/index.js.map +1 -1
- package/lib/module/node/index.js +0 -3
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +100 -229
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/OxyPayButton.js +125 -0
- package/lib/module/ui/components/OxyPayButton.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +42 -199
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +15 -2
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/icon/FAIRWalletIcon.js +60 -0
- package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -0
- package/lib/module/ui/components/icon/index.js +1 -0
- package/lib/module/ui/components/icon/index.js.map +1 -1
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +15 -8
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +103 -0
- package/lib/module/ui/components/internal/PinInput.js.map +1 -0
- package/lib/module/ui/components/internal/TextField.js +20 -0
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +117 -85
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/index.js +1 -2
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/useFollow.js +52 -137
- package/lib/module/ui/hooks/useFollow.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +47 -0
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -0
- package/lib/module/ui/index.js +2 -13
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +53 -61
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +6 -18
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +5 -23
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +91 -40
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +38 -67
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +22 -45
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +44 -23
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +59 -78
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +1583 -0
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -0
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +23 -37
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +263 -0
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -0
- package/lib/module/ui/screens/SessionManagementScreen.js +47 -69
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +100 -334
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +137 -341
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +186 -0
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +129 -0
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js +102 -0
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js +120 -0
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js +79 -0
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +54 -0
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +16 -3
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +62 -0
- package/lib/module/ui/stores/authStore.js.map +1 -0
- package/lib/module/ui/stores/followStore.js +120 -0
- package/lib/module/ui/stores/followStore.js.map +1 -0
- package/lib/module/ui/styles/index.js +0 -1
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/module/ui/utils/confirmAction.js +25 -0
- package/lib/module/ui/utils/confirmAction.js.map +1 -0
- package/lib/typescript/core/index.d.ts +28 -10
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +5 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +6 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/secureSession.d.ts +0 -1
- package/lib/typescript/models/secureSession.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +0 -1
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/FollowButton.d.ts +1 -77
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyPayButton.d.ts +29 -0
- package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -0
- package/lib/typescript/ui/components/icon/index.d.ts +1 -0
- package/lib/typescript/ui/components/icon/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +1 -0
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts +12 -0
- package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -0
- package/lib/typescript/ui/components/internal/TextField.d.ts +1 -0
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +0 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/index.d.ts +1 -2
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useFollow.d.ts +14 -15
- package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts +11 -0
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +2 -5
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +5 -23
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.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/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +27 -0
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +8 -0
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SessionManagementScreen.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/internal/SignInPasswordStep.d.ts +27 -0
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +26 -0
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +20 -0
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +24 -0
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +15 -0
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +13 -0
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +16 -0
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -0
- package/lib/typescript/ui/stores/followStore.d.ts +15 -0
- package/lib/typescript/ui/stores/followStore.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +0 -1
- package/lib/typescript/ui/styles/index.d.ts.map +1 -1
- package/lib/typescript/ui/utils/confirmAction.d.ts +7 -0
- package/lib/typescript/ui/utils/confirmAction.d.ts.map +1 -0
- package/package.json +12 -7
- package/src/core/index.ts +78 -88
- package/src/index.ts +8 -45
- package/src/models/interfaces.ts +7 -1
- package/src/models/secureSession.ts +1 -2
- package/src/node/index.ts +0 -3
- package/src/ui/components/FollowButton.tsx +100 -322
- package/src/ui/components/OxyPayButton.tsx +133 -0
- package/src/ui/components/OxyProvider.tsx +39 -201
- package/src/ui/components/OxySignInButton.tsx +13 -2
- package/src/ui/components/icon/FAIRWalletIcon.tsx +49 -0
- package/src/ui/components/icon/index.ts +1 -0
- package/src/ui/components/index.ts +1 -0
- package/src/ui/components/internal/GroupedPillButtons.tsx +12 -8
- package/src/ui/components/internal/PinInput.tsx +102 -0
- package/src/ui/components/internal/TextField.tsx +9 -0
- package/src/ui/context/OxyContext.tsx +74 -91
- package/src/ui/hooks/index.ts +1 -2
- package/src/ui/hooks/useFollow.ts +58 -129
- package/src/ui/hooks/useSessionSocket.ts +50 -0
- package/src/ui/index.ts +2 -37
- package/src/ui/navigation/OxyRouter.tsx +47 -63
- package/src/ui/navigation/types.ts +5 -26
- package/src/ui/screens/AccountCenterScreen.tsx +12 -21
- package/src/ui/screens/AccountOverviewScreen.tsx +6 -30
- package/src/ui/screens/AccountSettingsScreen.tsx +75 -46
- package/src/ui/screens/AccountSwitcherScreen.tsx +46 -88
- package/src/ui/screens/AppInfoScreen.tsx +27 -47
- package/src/ui/screens/FeedbackScreen.tsx +34 -19
- package/src/ui/screens/FileManagementScreen.tsx +293 -321
- package/src/ui/screens/PaymentGatewayScreen.tsx +1315 -0
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +109 -124
- package/src/ui/screens/RecoverAccountScreen.tsx +260 -0
- package/src/ui/screens/SessionManagementScreen.tsx +65 -137
- package/src/ui/screens/SignInScreen.tsx +89 -283
- package/src/ui/screens/SignUpScreen.tsx +138 -291
- package/src/ui/screens/internal/SignInPasswordStep.tsx +179 -0
- package/src/ui/screens/internal/SignInUsernameStep.tsx +139 -0
- package/src/ui/screens/internal/SignUpIdentityStep.tsx +114 -0
- package/src/ui/screens/internal/SignUpSecurityStep.tsx +132 -0
- package/src/ui/screens/internal/SignUpSummaryStep.tsx +66 -0
- package/src/ui/screens/internal/SignUpWelcomeStep.tsx +52 -0
- package/src/ui/screens/karma/KarmaRewardsScreen.tsx +13 -3
- package/src/ui/stores/authStore.ts +45 -0
- package/src/ui/stores/followStore.ts +80 -0
- package/src/ui/styles/index.ts +0 -1
- package/src/ui/utils/confirmAction.ts +23 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAuthFetch.js +0 -217
- package/lib/commonjs/ui/hooks/useAuthFetch.js.map +0 -1
- package/lib/commonjs/ui/hooks/useOxyFollow.js +0 -190
- package/lib/commonjs/ui/hooks/useOxyFollow.js.map +0 -1
- package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
- package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/store/index.js +0 -67
- package/lib/commonjs/ui/store/index.js.map +0 -1
- package/lib/commonjs/ui/store/setupOxyStore.js +0 -63
- package/lib/commonjs/ui/store/setupOxyStore.js.map +0 -1
- package/lib/commonjs/ui/store/slices/authSlice.js +0 -56
- package/lib/commonjs/ui/store/slices/authSlice.js.map +0 -1
- package/lib/commonjs/ui/store/slices/followSlice.js +0 -238
- package/lib/commonjs/ui/store/slices/followSlice.js.map +0 -1
- package/lib/commonjs/ui/store/slices/index.js +0 -129
- package/lib/commonjs/ui/store/slices/index.js.map +0 -1
- package/lib/commonjs/ui/store/slices/types.js +0 -19
- package/lib/commonjs/ui/store/slices/types.js.map +0 -1
- package/lib/commonjs/ui/styles/shadows.js +0 -123
- package/lib/commonjs/ui/styles/shadows.js.map +0 -1
- package/lib/commonjs/utils/polyfills.js +0 -42
- package/lib/commonjs/utils/polyfills.js.map +0 -1
- package/lib/module/ui/components/bottomSheet/index.js +0 -5
- package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/module/ui/hooks/useAuthFetch.js +0 -212
- package/lib/module/ui/hooks/useAuthFetch.js.map +0 -1
- package/lib/module/ui/hooks/useOxyFollow.js +0 -186
- package/lib/module/ui/hooks/useOxyFollow.js.map +0 -1
- package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
- package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/module/ui/store/index.js +0 -33
- package/lib/module/ui/store/index.js.map +0 -1
- package/lib/module/ui/store/setupOxyStore.js +0 -59
- package/lib/module/ui/store/setupOxyStore.js.map +0 -1
- package/lib/module/ui/store/slices/authSlice.js +0 -48
- package/lib/module/ui/store/slices/authSlice.js.map +0 -1
- package/lib/module/ui/store/slices/followSlice.js +0 -232
- package/lib/module/ui/store/slices/followSlice.js.map +0 -1
- package/lib/module/ui/store/slices/index.js +0 -11
- package/lib/module/ui/store/slices/index.js.map +0 -1
- package/lib/module/ui/store/slices/types.js +0 -15
- package/lib/module/ui/store/slices/types.js.map +0 -1
- package/lib/module/ui/styles/shadows.js +0 -119
- package/lib/module/ui/styles/shadows.js.map +0 -1
- package/lib/module/utils/polyfills.js +0 -36
- package/lib/module/utils/polyfills.js.map +0 -1
- package/lib/typescript/types/react-redux.d.ts +0 -5
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAuthFetch.d.ts +0 -34
- package/lib/typescript/ui/hooks/useAuthFetch.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useOxyFollow.d.ts +0 -81
- package/lib/typescript/ui/hooks/useOxyFollow.d.ts.map +0 -1
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
- package/lib/typescript/ui/store/index.d.ts +0 -27
- package/lib/typescript/ui/store/index.d.ts.map +0 -1
- package/lib/typescript/ui/store/setupOxyStore.d.ts +0 -29
- package/lib/typescript/ui/store/setupOxyStore.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/authSlice.d.ts +0 -32
- package/lib/typescript/ui/store/slices/authSlice.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/followSlice.d.ts +0 -120
- package/lib/typescript/ui/store/slices/followSlice.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/index.d.ts +0 -9
- package/lib/typescript/ui/store/slices/index.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/types.d.ts +0 -16
- package/lib/typescript/ui/store/slices/types.d.ts.map +0 -1
- package/lib/typescript/ui/styles/shadows.d.ts +0 -233
- package/lib/typescript/ui/styles/shadows.d.ts.map +0 -1
- package/lib/typescript/utils/polyfills.d.ts +0 -6
- package/lib/typescript/utils/polyfills.d.ts.map +0 -1
- package/src/__tests__/backend-middleware.test.ts +0 -209
- package/src/__tests__/polyfills.test.ts +0 -30
- package/src/__tests__/setup.ts +0 -43
- package/src/__tests__/ui/hooks/authfetch-integration.test.ts +0 -197
- package/src/__tests__/ui/hooks/backward-compatibility.test.ts +0 -159
- package/src/__tests__/ui/hooks/real-world-scenarios.test.ts +0 -224
- package/src/__tests__/ui/hooks/url-resolution.test.ts +0 -129
- package/src/__tests__/ui/hooks/useAuthFetch-separation.test.ts +0 -69
- package/src/__tests__/ui/hooks/useAuthFetch.test.ts +0 -70
- package/src/__tests__/ui/hooks/useOxyFollow.test.tsx +0 -92
- package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +0 -112
- package/src/__tests__/ui/store/setupOxyStore.test.ts +0 -50
- package/src/__tests__/validate-structure.js +0 -91
- package/src/__tests__/validation.js +0 -42
- package/src/types/react-redux.d.ts +0 -5
- package/src/ui/components/bottomSheet/index.tsx +0 -14
- package/src/ui/hooks/useAuthFetch.ts +0 -238
- package/src/ui/hooks/useOxyFollow.ts +0 -188
- package/src/ui/screens/BillingManagementScreen.tsx +0 -589
- package/src/ui/store/index.ts +0 -36
- package/src/ui/store/setupOxyStore.ts +0 -58
- package/src/ui/store/slices/authSlice.ts +0 -43
- package/src/ui/store/slices/followSlice.ts +0 -207
- package/src/ui/store/slices/index.ts +0 -31
- package/src/ui/store/slices/types.ts +0 -33
- package/src/ui/styles/shadows.ts +0 -112
- package/src/utils/polyfills.ts +0 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, TouchableOpacity, Text, ActivityIndicator, StyleSheet } from 'react-native';
|
|
2
|
+
import { View, TouchableOpacity, Text, ActivityIndicator, StyleSheet, Platform } from 'react-native';
|
|
3
3
|
import { Ionicons } from '@expo/vector-icons';
|
|
4
4
|
|
|
5
5
|
interface ButtonConfig {
|
|
@@ -32,13 +32,17 @@ const GroupedPillButtons: React.FC<GroupedPillButtonsProps> = ({
|
|
|
32
32
|
gap: 6,
|
|
33
33
|
minWidth: 70,
|
|
34
34
|
borderWidth: 1,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
...Platform.select({
|
|
36
|
+
web: {
|
|
37
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
38
|
+
},
|
|
39
|
+
default: {
|
|
40
|
+
shadowOffset: { width: 0, height: 2 },
|
|
41
|
+
shadowOpacity: 0.1,
|
|
42
|
+
shadowRadius: 4,
|
|
43
|
+
elevation: 2,
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
// Determine border radius based on position
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { View, TextInput, StyleSheet, Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface PinInputProps {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (val: string) => void;
|
|
7
|
+
length?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
colors: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const PinInput: React.FC<PinInputProps> = ({ value, onChange, length = 6, disabled, autoFocus, colors }) => {
|
|
14
|
+
const inputs = useRef<Array<TextInput | null>>([]);
|
|
15
|
+
|
|
16
|
+
const handleChange = (text: string, idx: number) => {
|
|
17
|
+
if (!/^[0-9]*$/.test(text)) return;
|
|
18
|
+
let newValue = value.split('');
|
|
19
|
+
if (text.length > 1) {
|
|
20
|
+
// Paste or autofill
|
|
21
|
+
newValue = text.split('').slice(0, length);
|
|
22
|
+
onChange(newValue.join(''));
|
|
23
|
+
if (newValue.length < length) {
|
|
24
|
+
inputs.current[newValue.length]?.focus();
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
newValue[idx] = text;
|
|
29
|
+
const joined = newValue.join('').slice(0, length);
|
|
30
|
+
onChange(joined);
|
|
31
|
+
if (text && idx < length - 1) {
|
|
32
|
+
inputs.current[idx + 1]?.focus();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleKeyPress = (e: any, idx: number) => {
|
|
37
|
+
if (e.nativeEvent.key === 'Backspace' && !value[idx] && idx > 0) {
|
|
38
|
+
inputs.current[idx - 1]?.focus();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View style={styles.pinContainer}>
|
|
44
|
+
{Array.from({ length }).map((_, idx) => (
|
|
45
|
+
<TextInput
|
|
46
|
+
key={idx}
|
|
47
|
+
ref={ref => (inputs.current[idx] = ref)}
|
|
48
|
+
style={[
|
|
49
|
+
styles.pinInput,
|
|
50
|
+
{ borderColor: colors.primary, color: colors.text, backgroundColor: colors.inputBackground },
|
|
51
|
+
value[idx] ? { borderWidth: 2 } : { borderWidth: 1 },
|
|
52
|
+
]}
|
|
53
|
+
value={value[idx] || ''}
|
|
54
|
+
onChangeText={text => handleChange(text, idx)}
|
|
55
|
+
onKeyPress={e => handleKeyPress(e, idx)}
|
|
56
|
+
keyboardType={Platform.OS === 'ios' ? 'number-pad' : 'numeric'}
|
|
57
|
+
maxLength={1}
|
|
58
|
+
editable={!disabled}
|
|
59
|
+
autoFocus={autoFocus && idx === 0}
|
|
60
|
+
textAlign="center"
|
|
61
|
+
selectionColor={colors.primary}
|
|
62
|
+
returnKeyType="done"
|
|
63
|
+
/>
|
|
64
|
+
))}
|
|
65
|
+
</View>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const styles = StyleSheet.create({
|
|
70
|
+
pinContainer: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
gap: 12,
|
|
74
|
+
marginBottom: 24,
|
|
75
|
+
marginTop: 8,
|
|
76
|
+
},
|
|
77
|
+
pinInput: {
|
|
78
|
+
width: 44,
|
|
79
|
+
height: 54,
|
|
80
|
+
borderRadius: 12,
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
fontSize: 28,
|
|
83
|
+
fontWeight: '600',
|
|
84
|
+
backgroundColor: '#F5F5F5',
|
|
85
|
+
textAlign: 'center',
|
|
86
|
+
marginHorizontal: 2,
|
|
87
|
+
...Platform.select({
|
|
88
|
+
web: {
|
|
89
|
+
boxShadow: '0 1px 4px rgba(0,0,0,0.04)',
|
|
90
|
+
},
|
|
91
|
+
default: {
|
|
92
|
+
shadowColor: '#000',
|
|
93
|
+
shadowOpacity: 0.04,
|
|
94
|
+
shadowOffset: { width: 0, height: 1 },
|
|
95
|
+
shadowRadius: 4,
|
|
96
|
+
elevation: 1,
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export default PinInput;
|
|
@@ -34,6 +34,7 @@ export interface TextFieldProps extends Omit<TextInputProps, 'style'> {
|
|
|
34
34
|
onBlur?: () => void;
|
|
35
35
|
onChangeText?: (text: string) => void;
|
|
36
36
|
testID?: string;
|
|
37
|
+
validMessage?: string;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
const TextField = forwardRef<TextInput, TextFieldProps>(({
|
|
@@ -57,6 +58,7 @@ const TextField = forwardRef<TextInput, TextFieldProps>(({
|
|
|
57
58
|
testID,
|
|
58
59
|
secureTextEntry,
|
|
59
60
|
value = '',
|
|
61
|
+
validMessage,
|
|
60
62
|
...textInputProps
|
|
61
63
|
}, ref) => {
|
|
62
64
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -556,6 +558,13 @@ const TextField = forwardRef<TextInput, TextFieldProps>(({
|
|
|
556
558
|
</Text>
|
|
557
559
|
</View>
|
|
558
560
|
)}
|
|
561
|
+
{/* Valid Message */}
|
|
562
|
+
{!error && validMessage && (
|
|
563
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 4, gap: 6 }}>
|
|
564
|
+
<Ionicons name="checkmark-circle" size={16} color={colors?.success || '#2E7D32'} />
|
|
565
|
+
<Text style={{ fontSize: 13, fontWeight: '500', color: colors?.success || '#2E7D32' }}>{validMessage}</Text>
|
|
566
|
+
</View>
|
|
567
|
+
)}
|
|
559
568
|
</View>
|
|
560
569
|
);
|
|
561
570
|
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import React, { createContext, useContext,
|
|
1
|
+
import React, { createContext, useContext, useEffect, useCallback, ReactNode, useMemo } from 'react';
|
|
2
2
|
import { OxyServices } from '../../core';
|
|
3
3
|
import { User } from '../../models/interfaces';
|
|
4
4
|
import { SecureLoginResponse, SecureClientSession, MinimalUserData } from '../../models/secureSession';
|
|
5
5
|
import { DeviceManager } from '../../utils/deviceManager';
|
|
6
|
+
import { useSessionSocket } from '../hooks/useSessionSocket';
|
|
7
|
+
import { toast } from '../../lib/sonner';
|
|
8
|
+
import { useAuthStore } from '../stores/authStore';
|
|
6
9
|
|
|
7
10
|
// Define the context shape
|
|
8
11
|
export interface OxyContextState {
|
|
@@ -35,10 +38,6 @@ export interface OxyContextState {
|
|
|
35
38
|
oxyServices: OxyServices;
|
|
36
39
|
bottomSheetRef?: React.RefObject<any>;
|
|
37
40
|
|
|
38
|
-
// API configuration
|
|
39
|
-
setApiUrl: (url: string) => void;
|
|
40
|
-
getAppBaseURL: () => string;
|
|
41
|
-
|
|
42
41
|
// Methods to directly control the bottom sheet
|
|
43
42
|
showBottomSheet?: (screenOrConfig?: string | { screen: string; props?: Record<string, any> }) => void;
|
|
44
43
|
hideBottomSheet?: () => void;
|
|
@@ -122,15 +121,20 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
122
121
|
onAuthStateChange,
|
|
123
122
|
bottomSheetRef,
|
|
124
123
|
}) => {
|
|
125
|
-
//
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
124
|
+
// Zustand state
|
|
125
|
+
const user = useAuthStore((state) => state.user);
|
|
126
|
+
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
|
|
127
|
+
const isLoading = useAuthStore((state) => state.isLoading);
|
|
128
|
+
const error = useAuthStore((state) => state.error);
|
|
129
|
+
const loginSuccess = useAuthStore((state) => state.loginSuccess);
|
|
130
|
+
const loginFailure = useAuthStore((state) => state.loginFailure);
|
|
131
|
+
const logoutStore = useAuthStore((state) => state.logout);
|
|
132
|
+
|
|
133
|
+
// Local state for non-auth fields
|
|
134
|
+
const [minimalUser, setMinimalUser] = React.useState<MinimalUserData | null>(null);
|
|
135
|
+
const [sessions, setSessions] = React.useState<SecureClientSession[]>([]);
|
|
136
|
+
const [activeSessionId, setActiveSessionId] = React.useState<string | null>(null);
|
|
137
|
+
const [storage, setStorage] = React.useState<StorageInterface | null>(null);
|
|
134
138
|
|
|
135
139
|
// Storage keys (memoized to prevent infinite loops)
|
|
136
140
|
const keys = useMemo(() => getSecureStorageKeys(storageKeyPrefix), [storageKeyPrefix]);
|
|
@@ -143,7 +147,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
143
147
|
setStorage(platformStorage);
|
|
144
148
|
} catch (error) {
|
|
145
149
|
console.error('Failed to initialize storage:', error);
|
|
146
|
-
|
|
150
|
+
useAuthStore.setState({ error: 'Failed to initialize storage' });
|
|
147
151
|
}
|
|
148
152
|
};
|
|
149
153
|
|
|
@@ -155,7 +159,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
155
159
|
const initAuth = async () => {
|
|
156
160
|
if (!storage) return;
|
|
157
161
|
|
|
158
|
-
|
|
162
|
+
useAuthStore.setState({ isLoading: true });
|
|
159
163
|
try {
|
|
160
164
|
// Load stored sessions
|
|
161
165
|
const sessionsData = await storage.getItem(keys.sessions);
|
|
@@ -172,17 +176,16 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
172
176
|
let shouldUpdateStorage = false;
|
|
173
177
|
|
|
174
178
|
for (const session of parsedSessions) {
|
|
175
|
-
if (!session.userId
|
|
179
|
+
if (!session.userId) {
|
|
176
180
|
// Session is missing user info, try to fetch it
|
|
177
181
|
try {
|
|
178
182
|
const sessionUser = await oxyServices.getUserBySession(session.sessionId);
|
|
179
183
|
migratedSessions.push({
|
|
180
184
|
...session,
|
|
181
|
-
userId: sessionUser.id
|
|
182
|
-
username: sessionUser.username
|
|
185
|
+
userId: sessionUser.id
|
|
183
186
|
});
|
|
184
187
|
shouldUpdateStorage = true;
|
|
185
|
-
console.log(`Migrated session ${session.sessionId} for user ${sessionUser.
|
|
188
|
+
console.log(`Migrated session ${session.sessionId} for user ${sessionUser.id}`);
|
|
186
189
|
} catch (error) {
|
|
187
190
|
// Session might be invalid, skip it
|
|
188
191
|
console.log(`Removing invalid session ${session.sessionId}:`, error);
|
|
@@ -220,7 +223,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
220
223
|
|
|
221
224
|
// Load full user data
|
|
222
225
|
const fullUser = await oxyServices.getUserBySession(activeSession.sessionId);
|
|
223
|
-
|
|
226
|
+
loginSuccess(fullUser);
|
|
224
227
|
setMinimalUser({
|
|
225
228
|
id: fullUser.id,
|
|
226
229
|
username: fullUser.username,
|
|
@@ -245,7 +248,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
245
248
|
console.error('Secure auth initialization error:', err);
|
|
246
249
|
await clearAllStorage();
|
|
247
250
|
} finally {
|
|
248
|
-
|
|
251
|
+
useAuthStore.setState({ isLoading: false });
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
254
|
|
|
@@ -266,7 +269,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
266
269
|
} else {
|
|
267
270
|
// No valid sessions left
|
|
268
271
|
setActiveSessionId(null);
|
|
269
|
-
|
|
272
|
+
logoutStore();
|
|
270
273
|
setMinimalUser(null);
|
|
271
274
|
await storage?.removeItem(keys.activeSessionId);
|
|
272
275
|
|
|
@@ -274,7 +277,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
274
277
|
onAuthStateChange(null);
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
|
-
}, [sessions, storage, keys, onAuthStateChange]);
|
|
280
|
+
}, [sessions, storage, keys, onAuthStateChange, logoutStore]);
|
|
278
281
|
|
|
279
282
|
// Save sessions to storage
|
|
280
283
|
const saveSessionsToStorage = useCallback(async (sessionsList: SecureClientSession[]): Promise<void> => {
|
|
@@ -302,7 +305,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
302
305
|
// Switch to a different session
|
|
303
306
|
const switchToSession = useCallback(async (sessionId: string): Promise<void> => {
|
|
304
307
|
try {
|
|
305
|
-
|
|
308
|
+
useAuthStore.setState({ isLoading: true });
|
|
306
309
|
|
|
307
310
|
// Get access token for this session
|
|
308
311
|
await oxyServices.getTokenBySession(sessionId);
|
|
@@ -311,7 +314,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
311
314
|
const fullUser = await oxyServices.getUserBySession(sessionId);
|
|
312
315
|
|
|
313
316
|
setActiveSessionId(sessionId);
|
|
314
|
-
|
|
317
|
+
loginSuccess(fullUser);
|
|
315
318
|
setMinimalUser({
|
|
316
319
|
id: fullUser.id,
|
|
317
320
|
username: fullUser.username,
|
|
@@ -325,18 +328,16 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
325
328
|
}
|
|
326
329
|
} catch (error) {
|
|
327
330
|
console.error('Switch session error:', error);
|
|
328
|
-
|
|
331
|
+
useAuthStore.setState({ error: 'Failed to switch session' });
|
|
329
332
|
} finally {
|
|
330
|
-
|
|
333
|
+
useAuthStore.setState({ isLoading: false });
|
|
331
334
|
}
|
|
332
|
-
}, [oxyServices, onAuthStateChange, saveActiveSessionId]);
|
|
335
|
+
}, [oxyServices, onAuthStateChange, loginSuccess, saveActiveSessionId]);
|
|
333
336
|
|
|
334
337
|
// Secure login method
|
|
335
338
|
const login = async (username: string, password: string, deviceName?: string): Promise<User> => {
|
|
336
339
|
if (!storage) throw new Error('Storage not initialized');
|
|
337
|
-
|
|
338
|
-
setIsLoading(true);
|
|
339
|
-
setError(null);
|
|
340
|
+
useAuthStore.setState({ isLoading: true, error: null });
|
|
340
341
|
|
|
341
342
|
try {
|
|
342
343
|
// Get device fingerprint for enhanced device identification
|
|
@@ -361,13 +362,12 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
361
362
|
deviceId: response.deviceId,
|
|
362
363
|
expiresAt: response.expiresAt,
|
|
363
364
|
lastActive: new Date().toISOString(),
|
|
364
|
-
userId: response.user.id
|
|
365
|
-
username: response.user.username
|
|
365
|
+
userId: response.user.id
|
|
366
366
|
};
|
|
367
367
|
|
|
368
368
|
// Check if this user already has a session (prevent duplicate accounts)
|
|
369
369
|
const existingUserSessionIndex = sessions.findIndex(s =>
|
|
370
|
-
s.userId === response.user.id
|
|
370
|
+
s.userId === response.user.id
|
|
371
371
|
);
|
|
372
372
|
|
|
373
373
|
let updatedSessions: SecureClientSession[];
|
|
@@ -378,7 +378,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
378
378
|
updatedSessions = [...sessions];
|
|
379
379
|
updatedSessions[existingUserSessionIndex] = clientSession;
|
|
380
380
|
|
|
381
|
-
console.log(`Reusing/updating existing session for user ${response.user.
|
|
381
|
+
console.log(`Reusing/updating existing session for user ${response.user.id}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
|
|
382
382
|
|
|
383
383
|
// If the replaced session was the active one, update active session
|
|
384
384
|
if (activeSessionId === existingSession.sessionId) {
|
|
@@ -388,7 +388,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
388
388
|
} else {
|
|
389
389
|
// Add new session for new user
|
|
390
390
|
updatedSessions = [...sessions, clientSession];
|
|
391
|
-
console.log(`Added new session for user ${response.user.
|
|
391
|
+
console.log(`Added new session for user ${response.user.id} on device ${response.deviceId}`);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
setSessions(updatedSessions);
|
|
@@ -403,7 +403,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
403
403
|
|
|
404
404
|
// Load full user data
|
|
405
405
|
const fullUser = await oxyServices.getUserBySession(response.sessionId);
|
|
406
|
-
|
|
406
|
+
loginSuccess(fullUser);
|
|
407
407
|
setMinimalUser(response.user);
|
|
408
408
|
|
|
409
409
|
if (onAuthStateChange) {
|
|
@@ -412,10 +412,10 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
412
412
|
|
|
413
413
|
return fullUser;
|
|
414
414
|
} catch (error: any) {
|
|
415
|
-
|
|
415
|
+
loginFailure(error.message || 'Login failed');
|
|
416
416
|
throw error;
|
|
417
417
|
} finally {
|
|
418
|
-
|
|
418
|
+
useAuthStore.setState({ isLoading: false });
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
|
|
@@ -440,7 +440,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
440
440
|
} else {
|
|
441
441
|
// No sessions left
|
|
442
442
|
setActiveSessionId(null);
|
|
443
|
-
|
|
443
|
+
logoutStore();
|
|
444
444
|
setMinimalUser(null);
|
|
445
445
|
await storage?.removeItem(keys.activeSessionId);
|
|
446
446
|
|
|
@@ -451,7 +451,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
451
451
|
}
|
|
452
452
|
} catch (error) {
|
|
453
453
|
console.error('Logout error:', error);
|
|
454
|
-
|
|
454
|
+
useAuthStore.setState({ error: 'Logout failed' });
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
|
|
@@ -461,13 +461,13 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
461
461
|
|
|
462
462
|
if (!activeSessionId) {
|
|
463
463
|
console.error('No active session ID found, cannot logout all');
|
|
464
|
-
|
|
464
|
+
useAuthStore.setState({ error: 'No active session found' });
|
|
465
465
|
throw new Error('No active session found');
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
if (!oxyServices) {
|
|
469
469
|
console.error('OxyServices not initialized');
|
|
470
|
-
|
|
470
|
+
useAuthStore.setState({ error: 'Service not available' });
|
|
471
471
|
throw new Error('Service not available');
|
|
472
472
|
}
|
|
473
473
|
|
|
@@ -479,7 +479,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
479
479
|
// Clear all local data
|
|
480
480
|
setSessions([]);
|
|
481
481
|
setActiveSessionId(null);
|
|
482
|
-
|
|
482
|
+
logoutStore();
|
|
483
483
|
setMinimalUser(null);
|
|
484
484
|
await clearAllStorage();
|
|
485
485
|
console.log('Local storage cleared');
|
|
@@ -490,7 +490,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
490
490
|
}
|
|
491
491
|
} catch (error) {
|
|
492
492
|
console.error('Logout all error:', error);
|
|
493
|
-
|
|
493
|
+
useAuthStore.setState({ error: `Logout all failed: ${error instanceof Error ? error.message : 'Unknown error'}` });
|
|
494
494
|
throw error;
|
|
495
495
|
}
|
|
496
496
|
};
|
|
@@ -499,8 +499,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
499
499
|
const signUp = async (username: string, email: string, password: string): Promise<User> => {
|
|
500
500
|
if (!storage) throw new Error('Storage not initialized');
|
|
501
501
|
|
|
502
|
-
|
|
503
|
-
setError(null);
|
|
502
|
+
useAuthStore.setState({ isLoading: true, error: null });
|
|
504
503
|
|
|
505
504
|
try {
|
|
506
505
|
// Create new account using the OxyServices signUp method
|
|
@@ -514,10 +513,10 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
514
513
|
|
|
515
514
|
return user;
|
|
516
515
|
} catch (error: any) {
|
|
517
|
-
|
|
516
|
+
loginFailure(error.message || 'Sign up failed');
|
|
518
517
|
throw error;
|
|
519
518
|
} finally {
|
|
520
|
-
|
|
519
|
+
useAuthStore.setState({ isLoading: false });
|
|
521
520
|
}
|
|
522
521
|
};
|
|
523
522
|
|
|
@@ -574,7 +573,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
574
573
|
// Clear all local sessions since we logged out from all devices
|
|
575
574
|
setSessions([]);
|
|
576
575
|
setActiveSessionId(null);
|
|
577
|
-
|
|
576
|
+
logoutStore();
|
|
578
577
|
setMinimalUser(null);
|
|
579
578
|
await clearAllStorage();
|
|
580
579
|
|
|
@@ -645,36 +644,19 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
645
644
|
}
|
|
646
645
|
}, [bottomSheetRef]);
|
|
647
646
|
|
|
648
|
-
//
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
}, []);
|
|
663
|
-
|
|
664
|
-
// Get current app base URL
|
|
665
|
-
const getAppBaseURL = useCallback(() => {
|
|
666
|
-
return appBaseURL;
|
|
667
|
-
}, [appBaseURL]);
|
|
668
|
-
|
|
669
|
-
// Compute comprehensive authentication status
|
|
670
|
-
// This is the single source of truth for authentication across the entire app
|
|
671
|
-
const isAuthenticated = useMemo(() => {
|
|
672
|
-
// User is authenticated if:
|
|
673
|
-
// 1. We have a full user object loaded, OR
|
|
674
|
-
// 2. We have an active session (token will be fetched on-demand)
|
|
675
|
-
// This covers both the loaded state and the loading-but-authenticated state
|
|
676
|
-
return !!user || !!activeSessionId;
|
|
677
|
-
}, [user, activeSessionId]);
|
|
647
|
+
// Integrate socket for real-time session updates
|
|
648
|
+
console.log('OxyContextProvider: userId', user?.id, 'baseURL', oxyServices.getBaseURL());
|
|
649
|
+
useSessionSocket({
|
|
650
|
+
userId: user?.id,
|
|
651
|
+
activeSessionId,
|
|
652
|
+
refreshSessions,
|
|
653
|
+
logout: () => logout(),
|
|
654
|
+
baseURL: oxyServices.getBaseURL(),
|
|
655
|
+
onRemoteSignOut: () => {
|
|
656
|
+
toast.info('You have been signed out remotely.');
|
|
657
|
+
logout();
|
|
658
|
+
},
|
|
659
|
+
});
|
|
678
660
|
|
|
679
661
|
// Context value
|
|
680
662
|
const contextValue: OxyContextState = {
|
|
@@ -687,17 +669,18 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
687
669
|
error,
|
|
688
670
|
login,
|
|
689
671
|
logout,
|
|
690
|
-
logoutAll,
|
|
691
|
-
signUp,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
672
|
+
logoutAll: async () => { await logout(); },
|
|
673
|
+
signUp: async (username, email, password) => {
|
|
674
|
+
await signUp(username, email, password);
|
|
675
|
+
return user as User; // Return the latest user from Zustand
|
|
676
|
+
},
|
|
677
|
+
switchSession: async (sessionId) => { await switchToSession(sessionId); },
|
|
678
|
+
removeSession: async (sessionId) => { await removeSession(sessionId); },
|
|
679
|
+
refreshSessions: async () => { await refreshSessions(); },
|
|
680
|
+
getDeviceSessions: async () => { return await getDeviceSessions(); },
|
|
681
|
+
logoutAllDeviceSessions: async () => { await logoutAllDeviceSessions(); },
|
|
682
|
+
updateDeviceName: async (deviceName) => { await updateDeviceName(deviceName); },
|
|
698
683
|
oxyServices,
|
|
699
|
-
setApiUrl,
|
|
700
|
-
getAppBaseURL,
|
|
701
684
|
bottomSheetRef,
|
|
702
685
|
showBottomSheet,
|
|
703
686
|
hideBottomSheet,
|
package/src/ui/hooks/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { useAuthFetch } from './useAuthFetch';
|
|
1
|
+
export { useFollow } from './useFollow';
|