@oxyhq/services 5.5.8 → 5.6.0
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 +26 -23
- 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 +6 -14
- 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 +31 -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 +26 -23
- 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 +7 -15
- 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 +27 -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/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 -1
- 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 +14 -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/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 +26 -26
- 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 +7 -22
- 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 +24 -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 -216
- 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 -211
- 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/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,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView, Platform } from 'react-native';
|
|
3
3
|
import { BaseScreenProps } from '../../navigation/types';
|
|
4
|
-
import { shadows } from '../../styles';
|
|
5
4
|
|
|
6
5
|
const KarmaRewardsScreen: React.FC<BaseScreenProps> = ({ goBack, theme }) => {
|
|
7
6
|
const isDarkTheme = theme === 'dark';
|
|
@@ -42,7 +41,18 @@ const styles = StyleSheet.create({
|
|
|
42
41
|
borderRadius: 16,
|
|
43
42
|
padding: 18,
|
|
44
43
|
marginBottom: 18,
|
|
45
|
-
...
|
|
44
|
+
...Platform.select({
|
|
45
|
+
web: {
|
|
46
|
+
boxShadow: '0 1px 4px rgba(0,0,0,0.04)',
|
|
47
|
+
},
|
|
48
|
+
default: {
|
|
49
|
+
shadowColor: '#000',
|
|
50
|
+
shadowOpacity: 0.04,
|
|
51
|
+
shadowOffset: { width: 0, height: 1 },
|
|
52
|
+
shadowRadius: 4,
|
|
53
|
+
elevation: 1,
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
46
56
|
},
|
|
47
57
|
rewardTitle: { fontSize: 18, fontWeight: 'bold', marginBottom: 6 },
|
|
48
58
|
rewardDesc: { fontSize: 15 },
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import type { User } from '../../models/interfaces';
|
|
3
|
+
|
|
4
|
+
interface AuthState {
|
|
5
|
+
user: User | null;
|
|
6
|
+
isAuthenticated: boolean;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
loginStart: () => void;
|
|
10
|
+
loginSuccess: (user: User) => void;
|
|
11
|
+
loginFailure: (error: string) => void;
|
|
12
|
+
logout: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>) => void) => ({
|
|
16
|
+
user: null,
|
|
17
|
+
isAuthenticated: false,
|
|
18
|
+
isLoading: false,
|
|
19
|
+
error: null,
|
|
20
|
+
loginStart: () => set({ isLoading: true, error: null }),
|
|
21
|
+
loginSuccess: (user: User) => set({ isLoading: false, isAuthenticated: true, user }),
|
|
22
|
+
loginFailure: (error: string) => set({ isLoading: false, error }),
|
|
23
|
+
logout: () => set({ user: null, isAuthenticated: false }),
|
|
24
|
+
}));
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { OxyServices } from '../../core';
|
|
3
|
+
|
|
4
|
+
interface FollowState {
|
|
5
|
+
followingUsers: Record<string, boolean>;
|
|
6
|
+
loadingUsers: Record<string, boolean>;
|
|
7
|
+
fetchingUsers: Record<string, boolean>;
|
|
8
|
+
errors: Record<string, string | null>;
|
|
9
|
+
setFollowingStatus: (userId: string, isFollowing: boolean) => void;
|
|
10
|
+
clearFollowError: (userId: string) => void;
|
|
11
|
+
resetFollowState: () => void;
|
|
12
|
+
fetchFollowStatus: (userId: string, oxyServices: OxyServices) => Promise<void>;
|
|
13
|
+
toggleFollowUser: (userId: string, oxyServices: OxyServices, isCurrentlyFollowing: boolean) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useFollowStore = create<FollowState>((set: any, get: any) => ({
|
|
17
|
+
followingUsers: {},
|
|
18
|
+
loadingUsers: {},
|
|
19
|
+
fetchingUsers: {},
|
|
20
|
+
errors: {},
|
|
21
|
+
setFollowingStatus: (userId: string, isFollowing: boolean) => set((state: FollowState) => ({
|
|
22
|
+
followingUsers: { ...state.followingUsers, [userId]: isFollowing },
|
|
23
|
+
errors: { ...state.errors, [userId]: null },
|
|
24
|
+
})),
|
|
25
|
+
clearFollowError: (userId: string) => set((state: FollowState) => ({
|
|
26
|
+
errors: { ...state.errors, [userId]: null },
|
|
27
|
+
})),
|
|
28
|
+
resetFollowState: () => set({
|
|
29
|
+
followingUsers: {},
|
|
30
|
+
loadingUsers: {},
|
|
31
|
+
fetchingUsers: {},
|
|
32
|
+
errors: {},
|
|
33
|
+
}),
|
|
34
|
+
fetchFollowStatus: async (userId: string, oxyServices: OxyServices) => {
|
|
35
|
+
set((state: FollowState) => ({
|
|
36
|
+
fetchingUsers: { ...state.fetchingUsers, [userId]: true },
|
|
37
|
+
errors: { ...state.errors, [userId]: null },
|
|
38
|
+
}));
|
|
39
|
+
try {
|
|
40
|
+
const response = await oxyServices.getFollowStatus(userId);
|
|
41
|
+
set((state: FollowState) => ({
|
|
42
|
+
followingUsers: { ...state.followingUsers, [userId]: response.isFollowing },
|
|
43
|
+
fetchingUsers: { ...state.fetchingUsers, [userId]: false },
|
|
44
|
+
errors: { ...state.errors, [userId]: null },
|
|
45
|
+
}));
|
|
46
|
+
} catch (error: any) {
|
|
47
|
+
set((state: FollowState) => ({
|
|
48
|
+
fetchingUsers: { ...state.fetchingUsers, [userId]: false },
|
|
49
|
+
errors: { ...state.errors, [userId]: error?.message || 'Failed to fetch follow status' },
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
toggleFollowUser: async (userId: string, oxyServices: OxyServices, isCurrentlyFollowing: boolean) => {
|
|
54
|
+
set((state: FollowState) => ({
|
|
55
|
+
loadingUsers: { ...state.loadingUsers, [userId]: true },
|
|
56
|
+
errors: { ...state.errors, [userId]: null },
|
|
57
|
+
}));
|
|
58
|
+
try {
|
|
59
|
+
let response;
|
|
60
|
+
let newFollowState;
|
|
61
|
+
if (isCurrentlyFollowing) {
|
|
62
|
+
response = await oxyServices.unfollowUser(userId);
|
|
63
|
+
newFollowState = false;
|
|
64
|
+
} else {
|
|
65
|
+
response = await oxyServices.followUser(userId);
|
|
66
|
+
newFollowState = true;
|
|
67
|
+
}
|
|
68
|
+
set((state: FollowState) => ({
|
|
69
|
+
followingUsers: { ...state.followingUsers, [userId]: newFollowState },
|
|
70
|
+
loadingUsers: { ...state.loadingUsers, [userId]: false },
|
|
71
|
+
errors: { ...state.errors, [userId]: null },
|
|
72
|
+
}));
|
|
73
|
+
} catch (error: any) {
|
|
74
|
+
set((state: FollowState) => ({
|
|
75
|
+
loadingUsers: { ...state.loadingUsers, [userId]: false },
|
|
76
|
+
errors: { ...state.errors, [userId]: error?.message || 'Failed to update follow status' },
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
}));
|
package/src/ui/styles/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Platform, Alert } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cross-platform confirm dialog. Uses window.confirm on web, Alert.alert on native.
|
|
5
|
+
* @param message The message to display
|
|
6
|
+
* @param onConfirm Callback if user confirms
|
|
7
|
+
*/
|
|
8
|
+
export function confirmAction(message: string, onConfirm: () => void) {
|
|
9
|
+
if (Platform.OS === 'web') {
|
|
10
|
+
if (window.confirm(message)) {
|
|
11
|
+
onConfirm();
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
Alert.alert(
|
|
15
|
+
'Confirm',
|
|
16
|
+
message,
|
|
17
|
+
[
|
|
18
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
19
|
+
{ text: 'OK', onPress: onConfirm },
|
|
20
|
+
]
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BottomSheetBackdrop", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _bottomSheet.BottomSheetBackdrop;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "BottomSheetModal", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _bottomSheet.BottomSheetModal;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "BottomSheetModalProvider", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _bottomSheet.BottomSheetModalProvider;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "BottomSheetScrollView", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _bottomSheet.BottomSheetScrollView;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "BottomSheetView", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _bottomSheet.BottomSheetView;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_bottomSheet","require"],"sourceRoot":"../../../../../src","sources":["ui/components/bottomSheet/index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.useAuthFetch = useAuthFetch;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _OxyContext = require("../context/OxyContext");
|
|
10
|
-
/**
|
|
11
|
-
* Zero Config Authenticated Fetch Hook
|
|
12
|
-
*
|
|
13
|
-
* Simple hook that provides fetch-like API with automatic authentication
|
|
14
|
-
* Leverages the existing useOxy hook and OxyProvider infrastructure
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* const authFetch = useAuthFetch();
|
|
18
|
-
* const response = await authFetch('/api/protected');
|
|
19
|
-
* const data = await authFetch.get('/api/users');
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Hook that provides authenticated fetch functionality
|
|
24
|
-
* Uses the existing OxyServices instance from useOxy context
|
|
25
|
-
*/
|
|
26
|
-
function useAuthFetch() {
|
|
27
|
-
const {
|
|
28
|
-
oxyServices,
|
|
29
|
-
isAuthenticated,
|
|
30
|
-
user,
|
|
31
|
-
login,
|
|
32
|
-
logout,
|
|
33
|
-
signUp,
|
|
34
|
-
activeSessionId,
|
|
35
|
-
setApiUrl
|
|
36
|
-
} = (0, _OxyContext.useOxy)();
|
|
37
|
-
|
|
38
|
-
// Validate that we have the required dependencies
|
|
39
|
-
if (!oxyServices) {
|
|
40
|
-
throw new Error('useAuthFetch requires OxyServices to be initialized. Make sure your app is wrapped with OxyProvider.');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Main fetch function with automatic auth headers
|
|
44
|
-
const authFetch = (0, _react.useCallback)(async (input, init) => {
|
|
45
|
-
if (!oxyServices) {
|
|
46
|
-
throw new Error('OxyServices not initialized. Make sure to wrap your app in OxyProvider.');
|
|
47
|
-
}
|
|
48
|
-
const url = resolveURL(input, oxyServices.getBaseURL());
|
|
49
|
-
const options = await addAuthHeaders(init, oxyServices, activeSessionId || undefined, isAuthenticated);
|
|
50
|
-
try {
|
|
51
|
-
let response = await fetch(url, options);
|
|
52
|
-
|
|
53
|
-
// Handle token expiry and automatic refresh
|
|
54
|
-
if (response.status === 401 && isAuthenticated) {
|
|
55
|
-
// Try to refresh token if we have refresh capability
|
|
56
|
-
if (oxyServices.refreshTokens) {
|
|
57
|
-
try {
|
|
58
|
-
await oxyServices.refreshTokens();
|
|
59
|
-
const retryOptions = await addAuthHeaders(init, oxyServices, activeSessionId || undefined, isAuthenticated);
|
|
60
|
-
response = await fetch(url, retryOptions);
|
|
61
|
-
} catch (refreshError) {
|
|
62
|
-
// Refresh failed, throw authentication error
|
|
63
|
-
const error = new Error('Authentication expired. Please login again.');
|
|
64
|
-
error.status = 401;
|
|
65
|
-
error.code = 'AUTH_EXPIRED';
|
|
66
|
-
throw error;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return response;
|
|
71
|
-
} catch (error) {
|
|
72
|
-
// Re-throw with additional context if needed
|
|
73
|
-
if (error instanceof Error) {
|
|
74
|
-
throw error;
|
|
75
|
-
}
|
|
76
|
-
throw new Error('Request failed');
|
|
77
|
-
}
|
|
78
|
-
}, [oxyServices, activeSessionId, isAuthenticated]);
|
|
79
|
-
|
|
80
|
-
// JSON convenience methods
|
|
81
|
-
const get = (0, _react.useCallback)(async (endpoint, options) => {
|
|
82
|
-
const response = await authFetch(endpoint, {
|
|
83
|
-
...options,
|
|
84
|
-
method: 'GET'
|
|
85
|
-
});
|
|
86
|
-
return handleJsonResponse(response);
|
|
87
|
-
}, [authFetch]);
|
|
88
|
-
const post = (0, _react.useCallback)(async (endpoint, data, options) => {
|
|
89
|
-
const response = await authFetch(endpoint, {
|
|
90
|
-
...options,
|
|
91
|
-
method: 'POST',
|
|
92
|
-
headers: {
|
|
93
|
-
'Content-Type': 'application/json',
|
|
94
|
-
...options?.headers
|
|
95
|
-
},
|
|
96
|
-
body: data ? JSON.stringify(data) : undefined
|
|
97
|
-
});
|
|
98
|
-
return handleJsonResponse(response);
|
|
99
|
-
}, [authFetch]);
|
|
100
|
-
const put = (0, _react.useCallback)(async (endpoint, data, options) => {
|
|
101
|
-
const response = await authFetch(endpoint, {
|
|
102
|
-
...options,
|
|
103
|
-
method: 'PUT',
|
|
104
|
-
headers: {
|
|
105
|
-
'Content-Type': 'application/json',
|
|
106
|
-
...options?.headers
|
|
107
|
-
},
|
|
108
|
-
body: data ? JSON.stringify(data) : undefined
|
|
109
|
-
});
|
|
110
|
-
return handleJsonResponse(response);
|
|
111
|
-
}, [authFetch]);
|
|
112
|
-
const del = (0, _react.useCallback)(async (endpoint, options) => {
|
|
113
|
-
const response = await authFetch(endpoint, {
|
|
114
|
-
...options,
|
|
115
|
-
method: 'DELETE'
|
|
116
|
-
});
|
|
117
|
-
return handleJsonResponse(response);
|
|
118
|
-
}, [authFetch]);
|
|
119
|
-
|
|
120
|
-
// Attach convenience methods and auth state to the main function
|
|
121
|
-
const fetchWithMethods = authFetch;
|
|
122
|
-
fetchWithMethods.get = get;
|
|
123
|
-
fetchWithMethods.post = post;
|
|
124
|
-
fetchWithMethods.put = put;
|
|
125
|
-
fetchWithMethods.delete = del;
|
|
126
|
-
fetchWithMethods.isAuthenticated = isAuthenticated;
|
|
127
|
-
fetchWithMethods.user = user;
|
|
128
|
-
fetchWithMethods.login = login;
|
|
129
|
-
fetchWithMethods.logout = logout;
|
|
130
|
-
fetchWithMethods.signUp = signUp;
|
|
131
|
-
fetchWithMethods.setApiUrl = setApiUrl;
|
|
132
|
-
return fetchWithMethods;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Helper functions
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
function resolveURL(input, baseURL) {
|
|
140
|
-
if (!baseURL) {
|
|
141
|
-
throw new Error('Base URL not configured. Please provide a baseURL in OxyServices configuration.');
|
|
142
|
-
}
|
|
143
|
-
const url = input.toString();
|
|
144
|
-
|
|
145
|
-
// If it's already a full URL (http/https), return as is
|
|
146
|
-
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
147
|
-
return url;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Normalize base URL (remove trailing slash)
|
|
151
|
-
const normalizedBaseURL = baseURL.replace(/\/$/, '');
|
|
152
|
-
|
|
153
|
-
// If URL starts with /, it's relative to base URL
|
|
154
|
-
if (url.startsWith('/')) {
|
|
155
|
-
return `${normalizedBaseURL}${url}`;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Otherwise, append to base URL with /
|
|
159
|
-
return `${normalizedBaseURL}/${url}`;
|
|
160
|
-
}
|
|
161
|
-
async function addAuthHeaders(init, oxyServices, activeSessionId, isAuthenticated) {
|
|
162
|
-
const headers = new Headers(init?.headers);
|
|
163
|
-
|
|
164
|
-
// Add auth header if user is authenticated
|
|
165
|
-
if (isAuthenticated && oxyServices && !headers.has('Authorization')) {
|
|
166
|
-
try {
|
|
167
|
-
// First try to get regular JWT access token
|
|
168
|
-
let accessToken = oxyServices.getAccessToken?.();
|
|
169
|
-
|
|
170
|
-
// If no JWT token but we have a secure session, try to get token from session
|
|
171
|
-
if (!accessToken && activeSessionId) {
|
|
172
|
-
try {
|
|
173
|
-
const tokenData = await oxyServices.getTokenBySession(activeSessionId);
|
|
174
|
-
accessToken = tokenData.accessToken;
|
|
175
|
-
} catch (error) {
|
|
176
|
-
// Silent fail - will attempt request without token
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (accessToken) {
|
|
180
|
-
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
181
|
-
}
|
|
182
|
-
} catch (error) {
|
|
183
|
-
// Silent fail - will attempt request without token
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const body = init?.body;
|
|
187
|
-
const processedBody = body && typeof body === 'object' && !(body instanceof FormData) && !(body instanceof URLSearchParams) ? JSON.stringify(body) : body;
|
|
188
|
-
return {
|
|
189
|
-
...init,
|
|
190
|
-
headers,
|
|
191
|
-
body: processedBody
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
async function handleJsonResponse(response) {
|
|
195
|
-
if (!response.ok) {
|
|
196
|
-
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
197
|
-
try {
|
|
198
|
-
const errorData = await response.json();
|
|
199
|
-
errorMessage = errorData.message || errorData.error || errorMessage;
|
|
200
|
-
} catch {
|
|
201
|
-
// Ignore JSON parsing errors
|
|
202
|
-
}
|
|
203
|
-
const error = new Error(errorMessage);
|
|
204
|
-
error.status = response.status;
|
|
205
|
-
error.response = response;
|
|
206
|
-
throw error;
|
|
207
|
-
}
|
|
208
|
-
try {
|
|
209
|
-
return await response.json();
|
|
210
|
-
} catch {
|
|
211
|
-
// If response isn't JSON, return the response itself
|
|
212
|
-
return response;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
var _default = exports.default = useAuthFetch;
|
|
216
|
-
//# sourceMappingURL=useAuthFetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_OxyContext","useAuthFetch","oxyServices","isAuthenticated","user","login","logout","signUp","activeSessionId","setApiUrl","useOxy","Error","authFetch","useCallback","input","init","url","resolveURL","getBaseURL","options","addAuthHeaders","undefined","response","fetch","status","refreshTokens","retryOptions","refreshError","error","code","get","endpoint","method","handleJsonResponse","post","data","headers","body","JSON","stringify","put","del","fetchWithMethods","delete","baseURL","toString","startsWith","normalizedBaseURL","replace","Headers","has","accessToken","getAccessToken","tokenData","getTokenBySession","set","processedBody","FormData","URLSearchParams","ok","errorMessage","statusText","errorData","json","message","_default","exports","default"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAuthFetch.ts"],"mappings":";;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAAA,EAAiB;EAC3C,MAAM;IAAEC,WAAW;IAAEC,eAAe;IAAEC,IAAI;IAAEC,KAAK;IAAEC,MAAM;IAAEC,MAAM;IAAEC,eAAe;IAAEC;EAAU,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;;EAE1G;EACA,IAAI,CAACR,WAAW,EAAE;IAChB,MAAM,IAAIS,KAAK,CAAC,sGAAsG,CAAC;EACzH;;EAEA;EACA,MAAMC,SAAS,GAAG,IAAAC,kBAAW,EAAC,OAAOC,KAAwB,EAAEC,IAAuB,KAAwB;IAC5G,IAAI,CAACb,WAAW,EAAE;MAChB,MAAM,IAAIS,KAAK,CAAC,yEAAyE,CAAC;IAC5F;IAEA,MAAMK,GAAG,GAAGC,UAAU,CAACH,KAAK,EAAEZ,WAAW,CAACgB,UAAU,CAAC,CAAC,CAAC;IACvD,MAAMC,OAAO,GAAG,MAAMC,cAAc,CAACL,IAAI,EAAEb,WAAW,EAAEM,eAAe,IAAIa,SAAS,EAAElB,eAAe,CAAC;IAEtG,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CAAC,MAAM;MACN;IAAA;IAGF,MAAMhC,KAAK,GAAG,IAAIjB,KAAK,CAACiD,YAAY,CAAQ;IAC5ChC,KAAK,CAACJ,MAAM,GAAGF,QAAQ,CAACE,MAAM;IAC9BI,KAAK,CAACN,QAAQ,GAAGA,QAAQ;IACzB,MAAMM,KAAK;EACb;EAEA,IAAI;IACF,OAAO,MAAMN,QAAQ,CAACyC,IAAI,CAAC,CAAC;EAC9B,CAAC,CAAC,MAAM;IACN;IACA,OAAOzC,QAAQ;EACjB;AACF;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclE,YAAY","ignoreList":[]}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useOxyFollow = exports.useFollow = void 0;
|
|
7
|
-
var _reactRedux = require("react-redux");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _followSlice = require("../store/slices/followSlice");
|
|
10
|
-
var _OxyContext = require("../context/OxyContext");
|
|
11
|
-
// Generic type for state that includes follow slice
|
|
12
|
-
|
|
13
|
-
// Memoized selector to prevent unnecessary re-renders
|
|
14
|
-
const createFollowSelector = userId => state => ({
|
|
15
|
-
isFollowing: _followSlice.followSelectors.selectIsUserFollowed(state, userId),
|
|
16
|
-
isLoading: _followSlice.followSelectors.selectIsUserLoading(state, userId),
|
|
17
|
-
error: _followSlice.followSelectors.selectUserError(state, userId)
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Memoized selector for multiple users
|
|
21
|
-
const createMultipleFollowSelector = userIds => state => {
|
|
22
|
-
const followData = {};
|
|
23
|
-
for (const userId of userIds) {
|
|
24
|
-
followData[userId] = {
|
|
25
|
-
isFollowing: _followSlice.followSelectors.selectIsUserFollowed(state, userId),
|
|
26
|
-
isLoading: _followSlice.followSelectors.selectIsUserLoading(state, userId),
|
|
27
|
-
error: _followSlice.followSelectors.selectUserError(state, userId)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const followState = state.follow;
|
|
31
|
-
return {
|
|
32
|
-
followData,
|
|
33
|
-
isAnyLoading: userIds.some(uid => followState.loadingUsers[uid]),
|
|
34
|
-
hasAnyError: userIds.some(uid => followState.errors[uid]),
|
|
35
|
-
allFollowing: userIds.every(uid => followState.followingUsers[uid]),
|
|
36
|
-
allNotFollowing: userIds.every(uid => !followState.followingUsers[uid])
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Custom hook for managing follow/unfollow functionality
|
|
42
|
-
* Works with any Redux store that includes the Oxy follow reducer
|
|
43
|
-
* Optimized to prevent unnecessary re-renders
|
|
44
|
-
* Can handle both single user and multiple users
|
|
45
|
-
*/
|
|
46
|
-
const useOxyFollow = userId => {
|
|
47
|
-
const dispatch = (0, _reactRedux.useDispatch)();
|
|
48
|
-
const {
|
|
49
|
-
oxyServices
|
|
50
|
-
} = (0, _OxyContext.useOxy)();
|
|
51
|
-
|
|
52
|
-
// Memoize user IDs to prevent recreation on every render
|
|
53
|
-
const userIds = (0, _react.useMemo)(() => {
|
|
54
|
-
return Array.isArray(userId) ? userId : userId ? [userId] : [];
|
|
55
|
-
}, [userId]);
|
|
56
|
-
const isSingleUser = typeof userId === 'string';
|
|
57
|
-
|
|
58
|
-
// Memoize selectors to prevent recreation
|
|
59
|
-
const singleUserSelector = (0, _react.useMemo)(() => {
|
|
60
|
-
return isSingleUser && userId ? createFollowSelector(userId) : null;
|
|
61
|
-
}, [isSingleUser, userId]);
|
|
62
|
-
const multipleUserSelector = (0, _react.useMemo)(() => {
|
|
63
|
-
return !isSingleUser ? createMultipleFollowSelector(userIds) : null;
|
|
64
|
-
}, [isSingleUser, userIds]);
|
|
65
|
-
|
|
66
|
-
// Use appropriate selector based on mode
|
|
67
|
-
const singleUserData = (0, _reactRedux.useSelector)(singleUserSelector || (() => ({
|
|
68
|
-
isFollowing: false,
|
|
69
|
-
isLoading: false,
|
|
70
|
-
error: null
|
|
71
|
-
})));
|
|
72
|
-
const multipleUserData = (0, _reactRedux.useSelector)(multipleUserSelector || (() => ({
|
|
73
|
-
followData: {},
|
|
74
|
-
isAnyLoading: false,
|
|
75
|
-
hasAnyError: false,
|
|
76
|
-
allFollowing: false,
|
|
77
|
-
allNotFollowing: true
|
|
78
|
-
})));
|
|
79
|
-
|
|
80
|
-
// Memoized callbacks to prevent recreation on every render
|
|
81
|
-
const toggleFollow = (0, _react.useCallback)(async () => {
|
|
82
|
-
if (!isSingleUser || !userId) throw new Error('toggleFollow is only available for single user mode');
|
|
83
|
-
try {
|
|
84
|
-
const result = await dispatch((0, _followSlice.toggleFollowUser)({
|
|
85
|
-
userId,
|
|
86
|
-
oxyServices,
|
|
87
|
-
isCurrentlyFollowing: singleUserData.isFollowing
|
|
88
|
-
})).unwrap();
|
|
89
|
-
return result;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
}, [dispatch, userId, oxyServices, singleUserData.isFollowing, isSingleUser]);
|
|
94
|
-
const setFollowStatus = (0, _react.useCallback)(following => {
|
|
95
|
-
if (!isSingleUser || !userId) throw new Error('setFollowStatus is only available for single user mode');
|
|
96
|
-
dispatch((0, _followSlice.setFollowingStatus)({
|
|
97
|
-
userId,
|
|
98
|
-
isFollowing: following
|
|
99
|
-
}));
|
|
100
|
-
}, [dispatch, userId, isSingleUser]);
|
|
101
|
-
const fetchStatus = (0, _react.useCallback)(async () => {
|
|
102
|
-
if (!isSingleUser || !userId) throw new Error('fetchStatus is only available for single user mode');
|
|
103
|
-
try {
|
|
104
|
-
await dispatch((0, _followSlice.fetchFollowStatus)({
|
|
105
|
-
userId,
|
|
106
|
-
oxyServices
|
|
107
|
-
})).unwrap();
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.warn(`Failed to fetch follow status for user ${userId}:`, error);
|
|
110
|
-
}
|
|
111
|
-
}, [dispatch, userId, oxyServices, isSingleUser]);
|
|
112
|
-
const clearError = (0, _react.useCallback)(() => {
|
|
113
|
-
if (!isSingleUser || !userId) throw new Error('clearError is only available for single user mode');
|
|
114
|
-
dispatch((0, _followSlice.clearFollowError)(userId));
|
|
115
|
-
}, [dispatch, userId, isSingleUser]);
|
|
116
|
-
|
|
117
|
-
// Multiple user callbacks
|
|
118
|
-
const toggleFollowForUser = (0, _react.useCallback)(async targetUserId => {
|
|
119
|
-
const currentState = multipleUserData.followData[targetUserId]?.isFollowing ?? false;
|
|
120
|
-
try {
|
|
121
|
-
const result = await dispatch((0, _followSlice.toggleFollowUser)({
|
|
122
|
-
userId: targetUserId,
|
|
123
|
-
oxyServices,
|
|
124
|
-
isCurrentlyFollowing: currentState
|
|
125
|
-
})).unwrap();
|
|
126
|
-
return result;
|
|
127
|
-
} catch (error) {
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
|
-
}, [dispatch, oxyServices, multipleUserData.followData]);
|
|
131
|
-
const setFollowStatusForUser = (0, _react.useCallback)((targetUserId, following) => {
|
|
132
|
-
dispatch((0, _followSlice.setFollowingStatus)({
|
|
133
|
-
userId: targetUserId,
|
|
134
|
-
isFollowing: following
|
|
135
|
-
}));
|
|
136
|
-
}, [dispatch]);
|
|
137
|
-
const fetchStatusForUser = (0, _react.useCallback)(async targetUserId => {
|
|
138
|
-
try {
|
|
139
|
-
await dispatch((0, _followSlice.fetchFollowStatus)({
|
|
140
|
-
userId: targetUserId,
|
|
141
|
-
oxyServices
|
|
142
|
-
})).unwrap();
|
|
143
|
-
} catch (error) {
|
|
144
|
-
console.warn(`Failed to fetch follow status for user ${targetUserId}:`, error);
|
|
145
|
-
}
|
|
146
|
-
}, [dispatch, oxyServices]);
|
|
147
|
-
const fetchAllStatuses = (0, _react.useCallback)(async () => {
|
|
148
|
-
const promises = userIds.map(uid => dispatch((0, _followSlice.fetchFollowStatus)({
|
|
149
|
-
userId: uid,
|
|
150
|
-
oxyServices
|
|
151
|
-
})).unwrap().catch(error => {
|
|
152
|
-
console.warn(`Failed to fetch follow status for user ${uid}:`, error);
|
|
153
|
-
}));
|
|
154
|
-
await Promise.all(promises);
|
|
155
|
-
}, [dispatch, userIds, oxyServices]);
|
|
156
|
-
const clearErrorForUser = (0, _react.useCallback)(targetUserId => {
|
|
157
|
-
dispatch((0, _followSlice.clearFollowError)(targetUserId));
|
|
158
|
-
}, [dispatch]);
|
|
159
|
-
|
|
160
|
-
// Return appropriate interface based on mode
|
|
161
|
-
if (isSingleUser && userId) {
|
|
162
|
-
return {
|
|
163
|
-
isFollowing: singleUserData.isFollowing,
|
|
164
|
-
isLoading: singleUserData.isLoading,
|
|
165
|
-
error: singleUserData.error,
|
|
166
|
-
toggleFollow,
|
|
167
|
-
setFollowStatus,
|
|
168
|
-
fetchStatus,
|
|
169
|
-
clearError
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
followData: multipleUserData.followData,
|
|
174
|
-
toggleFollowForUser,
|
|
175
|
-
setFollowStatusForUser,
|
|
176
|
-
fetchStatusForUser,
|
|
177
|
-
fetchAllStatuses,
|
|
178
|
-
clearErrorForUser,
|
|
179
|
-
// Helper methods
|
|
180
|
-
isAnyLoading: multipleUserData.isAnyLoading,
|
|
181
|
-
hasAnyError: multipleUserData.hasAnyError,
|
|
182
|
-
allFollowing: multipleUserData.allFollowing,
|
|
183
|
-
allNotFollowing: multipleUserData.allNotFollowing
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// Backward compatibility alias
|
|
188
|
-
exports.useOxyFollow = useOxyFollow;
|
|
189
|
-
const useFollow = exports.useFollow = useOxyFollow;
|
|
190
|
-
//# sourceMappingURL=useOxyFollow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactRedux","require","_react","_followSlice","_OxyContext","createFollowSelector","userId","state","isFollowing","followSelectors","selectIsUserFollowed","isLoading","selectIsUserLoading","error","selectUserError","createMultipleFollowSelector","userIds","followData","followState","follow","isAnyLoading","some","uid","loadingUsers","hasAnyError","errors","allFollowing","every","followingUsers","allNotFollowing","useOxyFollow","dispatch","useDispatch","oxyServices","useOxy","useMemo","Array","isArray","isSingleUser","singleUserSelector","multipleUserSelector","singleUserData","useSelector","multipleUserData","toggleFollow","useCallback","Error","result","toggleFollowUser","isCurrentlyFollowing","unwrap","setFollowStatus","following","setFollowingStatus","fetchStatus","fetchFollowStatus","console","warn","clearError","clearFollowError","toggleFollowForUser","targetUserId","currentState","setFollowStatusForUser","fetchStatusForUser","fetchAllStatuses","promises","map","catch","Promise","all","clearErrorForUser","exports","useFollow"],"sourceRoot":"../../../../src","sources":["ui/hooks/useOxyFollow.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAQA,IAAAG,WAAA,GAAAH,OAAA;AAEA;;AAKA;AACA,MAAMI,oBAAoB,GAAIC,MAAc,IAAMC,KAAsB,KAAM;EAC5EC,WAAW,EAAEC,4BAAe,CAACC,oBAAoB,CAACH,KAAK,EAAED,MAAM,CAAC;EAChEK,SAAS,EAAEF,4BAAe,CAACG,mBAAmB,CAACL,KAAK,EAAED,MAAM,CAAC;EAC7DO,KAAK,EAAEJ,4BAAe,CAACK,eAAe,CAACP,KAAK,EAAED,MAAM;AACtD,CAAC,CAAC;;AAEF;AACA,MAAMS,4BAA4B,GAAIC,OAAiB,IAAMT,KAAsB,IAAK;EACtF,MAAMU,UAA8F,GAAG,CAAC,CAAC;EAEzG,KAAK,MAAMX,MAAM,IAAIU,OAAO,EAAE;IAC5BC,UAAU,CAACX,MAAM,CAAC,GAAG;MACnBE,WAAW,EAAEC,4BAAe,CAACC,oBAAoB,CAACH,KAAK,EAAED,MAAM,CAAC;MAChEK,SAAS,EAAEF,4BAAe,CAACG,mBAAmB,CAACL,KAAK,EAAED,MAAM,CAAC;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