@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
|
@@ -17,116 +17,23 @@ import Animated, {
|
|
|
17
17
|
Easing,
|
|
18
18
|
withTiming
|
|
19
19
|
} from 'react-native-reanimated';
|
|
20
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
21
20
|
import { useOxy } from '../context/OxyContext';
|
|
22
21
|
import { fontFamilies } from '../styles/fonts';
|
|
23
22
|
import { toast } from '../../lib/sonner';
|
|
24
|
-
import {
|
|
25
|
-
toggleFollowUser,
|
|
26
|
-
setFollowingStatus,
|
|
27
|
-
clearFollowError,
|
|
28
|
-
fetchFollowStatus
|
|
29
|
-
} from '../store';
|
|
30
|
-
import type { RootState, AppDispatch } from '../store';
|
|
23
|
+
import { useFollow } from '../hooks/useFollow';
|
|
31
24
|
|
|
32
25
|
export interface FollowButtonProps {
|
|
33
|
-
/**
|
|
34
|
-
* The user ID to follow/unfollow
|
|
35
|
-
*/
|
|
36
26
|
userId: string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Initial follow state, if known
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
27
|
initiallyFollowing?: boolean;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Button size
|
|
46
|
-
* @default 'medium'
|
|
47
|
-
*/
|
|
48
28
|
size?: 'small' | 'medium' | 'large';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Custom callback when follow/unfollow action happens
|
|
52
|
-
*/
|
|
53
29
|
onFollowChange?: (isFollowing: boolean) => void;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Additional styles for the button container
|
|
57
|
-
*/
|
|
58
30
|
style?: StyleProp<ViewStyle>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Additional styles for the button text
|
|
62
|
-
*/
|
|
63
31
|
textStyle?: StyleProp<TextStyle>;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Whether to disable the button
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
32
|
disabled?: boolean;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Whether to show loading indicator during API calls
|
|
73
|
-
* @default true
|
|
74
|
-
*/
|
|
75
33
|
showLoadingState?: boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Whether to prevent default action and stop event propagation
|
|
79
|
-
* Useful when the button is inside links or other pressable containers
|
|
80
|
-
* @default true
|
|
81
|
-
*/
|
|
82
34
|
preventParentActions?: boolean;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Custom onPress handler - if provided, will override default follow/unfollow behavior
|
|
86
|
-
* Event object is passed to allow for preventDefault/stopPropagation
|
|
87
|
-
*/
|
|
88
|
-
onPress?: (event: any) => void;
|
|
89
35
|
}
|
|
90
36
|
|
|
91
|
-
/**
|
|
92
|
-
* An animated follow button with interactive state changes and preventDefault support
|
|
93
|
-
* Uses Redux for state management to ensure all buttons with the same user ID stay synchronized
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```tsx
|
|
97
|
-
* // Basic usage
|
|
98
|
-
* <FollowButton userId="123" />
|
|
99
|
-
*
|
|
100
|
-
* // With custom styling
|
|
101
|
-
* <FollowButton
|
|
102
|
-
* userId="123"
|
|
103
|
-
* initiallyFollowing={true}
|
|
104
|
-
* size="large"
|
|
105
|
-
* style={{ borderRadius: 12 }}
|
|
106
|
-
* onFollowChange={(isFollowing) => console.log(`User is now ${isFollowing ? 'followed' : 'unfollowed'}`)}
|
|
107
|
-
* />
|
|
108
|
-
*
|
|
109
|
-
* // Inside a pressable container (prevents parent actions)
|
|
110
|
-
* <TouchableOpacity onPress={() => navigateToProfile()}>
|
|
111
|
-
* <View>
|
|
112
|
-
* <Text>User Profile</Text>
|
|
113
|
-
* <FollowButton
|
|
114
|
-
* userId="123"
|
|
115
|
-
* preventParentActions={true} // Default: true
|
|
116
|
-
* />
|
|
117
|
-
* </View>
|
|
118
|
-
* </TouchableOpacity>
|
|
119
|
-
*
|
|
120
|
-
* // Custom onPress handler
|
|
121
|
-
* <FollowButton
|
|
122
|
-
* userId="123"
|
|
123
|
-
* onPress={(event) => {
|
|
124
|
-
* event.preventDefault(); // Custom preventDefault
|
|
125
|
-
* // Custom logic here
|
|
126
|
-
* }}
|
|
127
|
-
* />
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
37
|
const FollowButton: React.FC<FollowButtonProps> = ({
|
|
131
38
|
userId,
|
|
132
39
|
initiallyFollowing = false,
|
|
@@ -137,270 +44,141 @@ const FollowButton: React.FC<FollowButtonProps> = ({
|
|
|
137
44
|
disabled = false,
|
|
138
45
|
showLoadingState = true,
|
|
139
46
|
preventParentActions = true,
|
|
140
|
-
onPress,
|
|
141
47
|
}) => {
|
|
142
|
-
const dispatch = useDispatch();
|
|
143
48
|
const { oxyServices, isAuthenticated } = useOxy();
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const isStatusKnown = useSelector((state: RootState) =>
|
|
154
|
-
Object.prototype.hasOwnProperty.call(state.follow.followingUsers, userId)
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const { isFollowing, isLoading, error } = followState;
|
|
49
|
+
const {
|
|
50
|
+
isFollowing,
|
|
51
|
+
isLoading,
|
|
52
|
+
error,
|
|
53
|
+
toggleFollow,
|
|
54
|
+
setFollowStatus,
|
|
55
|
+
fetchStatus,
|
|
56
|
+
clearError,
|
|
57
|
+
} = useFollow(userId);
|
|
158
58
|
|
|
159
59
|
// Animation values
|
|
160
60
|
const animationProgress = useSharedValue(isFollowing ? 1 : 0);
|
|
161
61
|
const scale = useSharedValue(1);
|
|
162
62
|
|
|
163
|
-
// Initialize
|
|
63
|
+
// Initialize Zustand state with initial value if not already set
|
|
164
64
|
useEffect(() => {
|
|
165
|
-
if (userId && !
|
|
166
|
-
|
|
167
|
-
const initialState = initiallyFollowing ?? false;
|
|
168
|
-
dispatch(setFollowingStatus({ userId, isFollowing: initialState }));
|
|
65
|
+
if (userId && !isFollowing && initiallyFollowing) {
|
|
66
|
+
setFollowStatus?.(initiallyFollowing);
|
|
169
67
|
}
|
|
170
|
-
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [userId, initiallyFollowing]);
|
|
171
70
|
|
|
172
71
|
// Fetch latest follow status from backend on mount if authenticated
|
|
173
|
-
// This runs separately and will overwrite the initial state with actual data
|
|
174
72
|
useEffect(() => {
|
|
175
73
|
if (userId && isAuthenticated) {
|
|
176
|
-
|
|
74
|
+
fetchStatus?.();
|
|
177
75
|
}
|
|
178
|
-
|
|
76
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
+
}, [userId, oxyServices, isAuthenticated]);
|
|
179
78
|
|
|
180
|
-
//
|
|
79
|
+
// Animate button on follow/unfollow
|
|
181
80
|
useEffect(() => {
|
|
182
|
-
animationProgress.value = withTiming(isFollowing ? 1 : 0, {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (error) {
|
|
191
|
-
toast.error(error);
|
|
192
|
-
dispatch(clearFollowError(userId));
|
|
81
|
+
animationProgress.value = withTiming(isFollowing ? 1 : 0, { duration: 300, easing: Easing.inOut(Easing.ease) });
|
|
82
|
+
}, [isFollowing, animationProgress]);
|
|
83
|
+
|
|
84
|
+
// Button press handler
|
|
85
|
+
const handlePress = useCallback(async (event: any) => {
|
|
86
|
+
if (preventParentActions && event && event.preventDefault) {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.stopPropagation();
|
|
193
89
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
// The button press handler with preventDefault support - memoized to prevent recreation
|
|
197
|
-
const handlePress = useCallback(async (event?: any) => {
|
|
198
|
-
// Prevent parent actions if enabled (e.g., if inside a link or pressable container)
|
|
199
|
-
if (preventParentActions && event) {
|
|
200
|
-
// For React Native Web compatibility
|
|
201
|
-
if (Platform.OS === 'web' && event.preventDefault) {
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Stop event propagation to prevent parent TouchableOpacity/Pressable actions
|
|
206
|
-
if (event.stopPropagation) {
|
|
207
|
-
event.stopPropagation();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// For React Native, prevent gesture bubbling
|
|
211
|
-
if (event.nativeEvent && event.nativeEvent.stopPropagation) {
|
|
212
|
-
event.nativeEvent.stopPropagation();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// If custom onPress is provided, use it instead of default behavior
|
|
217
|
-
if (onPress) {
|
|
218
|
-
onPress(event);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (disabled || followState.isLoading) return;
|
|
223
|
-
|
|
224
|
-
// Check if user is authenticated - show toast instead of disabling
|
|
225
|
-
if (!isAuthenticated) {
|
|
226
|
-
toast.error('Please sign in to follow users');
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Touch feedback animation
|
|
231
|
-
scale.value = withSpring(0.95, { damping: 10 }, () => {
|
|
232
|
-
scale.value = withSpring(1);
|
|
233
|
-
});
|
|
234
|
-
|
|
90
|
+
if (disabled || isLoading) return;
|
|
235
91
|
try {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
isCurrentlyFollowing: followState.isFollowing
|
|
241
|
-
})).unwrap();
|
|
242
|
-
|
|
243
|
-
// Call the callback if provided
|
|
244
|
-
if (onFollowChange) {
|
|
245
|
-
onFollowChange(result.isFollowing);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Show success toast
|
|
249
|
-
toast.success(result.isFollowing ? 'Following user!' : 'Unfollowed user');
|
|
250
|
-
} catch (error: any) {
|
|
251
|
-
console.error('Follow action failed:', error);
|
|
252
|
-
|
|
253
|
-
// Show user-friendly error messages for state mismatches
|
|
254
|
-
const errorMessage = error?.toString() || 'Unknown error';
|
|
255
|
-
if (errorMessage.includes('State synced with backend')) {
|
|
256
|
-
toast.info('Status updated. Please try again.');
|
|
257
|
-
} else {
|
|
258
|
-
toast.error(`Failed to ${followState.isFollowing ? 'unfollow' : 'follow'} user. Please try again.`);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}, [
|
|
262
|
-
preventParentActions,
|
|
263
|
-
onPress,
|
|
264
|
-
disabled,
|
|
265
|
-
followState.isLoading,
|
|
266
|
-
followState.isFollowing,
|
|
267
|
-
isAuthenticated,
|
|
268
|
-
scale,
|
|
269
|
-
dispatch,
|
|
270
|
-
userId,
|
|
271
|
-
oxyServices,
|
|
272
|
-
onFollowChange
|
|
273
|
-
]);
|
|
274
|
-
|
|
275
|
-
// Animated styles for the button
|
|
276
|
-
const animatedButtonStyle = useAnimatedStyle(() => {
|
|
277
|
-
const backgroundColor = interpolateColor(
|
|
278
|
-
animationProgress.value,
|
|
279
|
-
[0, 1],
|
|
280
|
-
['#d169e5', '#FFFFFF']
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const borderColor = interpolateColor(
|
|
284
|
-
animationProgress.value,
|
|
285
|
-
[0, 1],
|
|
286
|
-
['#d169e5', '#d169e5']
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
// Add a slight scaling effect during the transition
|
|
290
|
-
const transitionScale = 1 + 0.05 * Math.sin(animationProgress.value * Math.PI);
|
|
291
|
-
|
|
292
|
-
return {
|
|
293
|
-
backgroundColor,
|
|
294
|
-
borderColor,
|
|
295
|
-
borderWidth: 1,
|
|
296
|
-
transform: [
|
|
297
|
-
{ scale: scale.value * transitionScale },
|
|
298
|
-
],
|
|
299
|
-
};
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// Animated styles for the text
|
|
303
|
-
const animatedTextStyle = useAnimatedStyle(() => {
|
|
304
|
-
const color = interpolateColor(
|
|
305
|
-
animationProgress.value,
|
|
306
|
-
[0, 1],
|
|
307
|
-
['#FFFFFF', '#d169e5']
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
color,
|
|
312
|
-
};
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
// Get size-specific styles
|
|
316
|
-
const getSizeStyles = () => {
|
|
317
|
-
switch (size) {
|
|
318
|
-
case 'small':
|
|
319
|
-
return {
|
|
320
|
-
button: {
|
|
321
|
-
paddingVertical: 6,
|
|
322
|
-
paddingHorizontal: 12,
|
|
323
|
-
} as ViewStyle,
|
|
324
|
-
text: {
|
|
325
|
-
fontSize: 12,
|
|
326
|
-
} as TextStyle,
|
|
327
|
-
};
|
|
328
|
-
case 'large':
|
|
329
|
-
return {
|
|
330
|
-
button: {
|
|
331
|
-
paddingVertical: 12,
|
|
332
|
-
paddingHorizontal: 24,
|
|
333
|
-
} as ViewStyle,
|
|
334
|
-
text: {
|
|
335
|
-
fontSize: 18,
|
|
336
|
-
} as TextStyle,
|
|
337
|
-
};
|
|
338
|
-
default: // medium
|
|
339
|
-
return {
|
|
340
|
-
button: {
|
|
341
|
-
paddingVertical: 8,
|
|
342
|
-
paddingHorizontal: 16,
|
|
343
|
-
} as ViewStyle,
|
|
344
|
-
text: {
|
|
345
|
-
fontSize: 14,
|
|
346
|
-
} as TextStyle,
|
|
347
|
-
};
|
|
92
|
+
await toggleFollow?.();
|
|
93
|
+
if (onFollowChange) onFollowChange(!isFollowing);
|
|
94
|
+
} catch (err: any) {
|
|
95
|
+
toast.error(err?.message || 'Failed to update follow status');
|
|
348
96
|
}
|
|
97
|
+
}, [disabled, isLoading, toggleFollow, onFollowChange, isFollowing, preventParentActions]);
|
|
98
|
+
|
|
99
|
+
// Button styles
|
|
100
|
+
const getButtonStyle = (): StyleProp<ViewStyle> => {
|
|
101
|
+
let baseStyle = styles.buttonMedium;
|
|
102
|
+
if (size === 'small') baseStyle = styles.buttonSmall;
|
|
103
|
+
if (size === 'large') baseStyle = styles.buttonLarge;
|
|
104
|
+
return [baseStyle, isFollowing ? styles.following : styles.notFollowing, style];
|
|
349
105
|
};
|
|
350
106
|
|
|
351
|
-
const
|
|
107
|
+
const getTextStyle = (): StyleProp<TextStyle> => {
|
|
108
|
+
let baseStyle = styles.textMedium;
|
|
109
|
+
if (size === 'small') baseStyle = styles.textSmall;
|
|
110
|
+
if (size === 'large') baseStyle = styles.textLarge;
|
|
111
|
+
return [baseStyle, isFollowing ? styles.textFollowing : styles.textNotFollowing, textStyle];
|
|
112
|
+
};
|
|
352
113
|
|
|
353
114
|
return (
|
|
354
115
|
<TouchableOpacity
|
|
355
|
-
|
|
116
|
+
style={getButtonStyle()}
|
|
356
117
|
onPress={handlePress}
|
|
357
118
|
disabled={disabled || isLoading}
|
|
119
|
+
activeOpacity={0.8}
|
|
358
120
|
>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
style,
|
|
365
|
-
]}
|
|
366
|
-
>
|
|
367
|
-
{isLoading && showLoadingState ? (
|
|
368
|
-
<ActivityIndicator
|
|
369
|
-
size="small"
|
|
370
|
-
color={isFollowing ? '#d169e5' : '#FFFFFF'}
|
|
371
|
-
/>
|
|
372
|
-
) : (
|
|
373
|
-
<Animated.Text
|
|
374
|
-
style={[
|
|
375
|
-
styles.text,
|
|
376
|
-
sizeStyles.text,
|
|
377
|
-
animatedTextStyle,
|
|
378
|
-
textStyle,
|
|
379
|
-
]}
|
|
380
|
-
>
|
|
381
|
-
{isFollowing ? 'Following' : 'Follow'}
|
|
382
|
-
</Animated.Text>
|
|
383
|
-
)}
|
|
384
|
-
</Animated.View>
|
|
121
|
+
{showLoadingState && isLoading ? (
|
|
122
|
+
<ActivityIndicator size={size === 'small' ? 'small' : 'large'} color={isFollowing ? '#fff' : '#007AFF'} />
|
|
123
|
+
) : (
|
|
124
|
+
<Text style={getTextStyle()}>{isFollowing ? 'Following' : 'Follow'}</Text>
|
|
125
|
+
)}
|
|
385
126
|
</TouchableOpacity>
|
|
386
127
|
);
|
|
387
128
|
};
|
|
388
129
|
|
|
389
130
|
const styles = StyleSheet.create({
|
|
390
|
-
|
|
131
|
+
buttonSmall: {
|
|
132
|
+
paddingVertical: 4,
|
|
133
|
+
paddingHorizontal: 12,
|
|
134
|
+
borderRadius: 16,
|
|
135
|
+
minWidth: 60,
|
|
136
|
+
alignItems: 'center',
|
|
391
137
|
justifyContent: 'center',
|
|
138
|
+
},
|
|
139
|
+
buttonMedium: {
|
|
140
|
+
paddingVertical: 8,
|
|
141
|
+
paddingHorizontal: 20,
|
|
142
|
+
borderRadius: 20,
|
|
143
|
+
minWidth: 90,
|
|
392
144
|
alignItems: 'center',
|
|
393
|
-
|
|
394
|
-
|
|
145
|
+
justifyContent: 'center',
|
|
146
|
+
},
|
|
147
|
+
buttonLarge: {
|
|
148
|
+
paddingVertical: 12,
|
|
149
|
+
paddingHorizontal: 32,
|
|
150
|
+
borderRadius: 24,
|
|
151
|
+
minWidth: 120,
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
justifyContent: 'center',
|
|
154
|
+
},
|
|
155
|
+
following: {
|
|
156
|
+
backgroundColor: '#007AFF',
|
|
157
|
+
},
|
|
158
|
+
notFollowing: {
|
|
159
|
+
backgroundColor: '#fff',
|
|
160
|
+
borderWidth: 1,
|
|
161
|
+
borderColor: '#007AFF',
|
|
162
|
+
},
|
|
163
|
+
textSmall: {
|
|
164
|
+
fontSize: 13,
|
|
165
|
+
fontFamily: fontFamilies.phuduMedium,
|
|
166
|
+
},
|
|
167
|
+
textMedium: {
|
|
168
|
+
fontSize: 15,
|
|
169
|
+
fontFamily: fontFamilies.phuduMedium,
|
|
170
|
+
},
|
|
171
|
+
textLarge: {
|
|
172
|
+
fontSize: 18,
|
|
173
|
+
fontFamily: fontFamilies.phuduMedium,
|
|
174
|
+
},
|
|
175
|
+
textFollowing: {
|
|
176
|
+
color: '#fff',
|
|
395
177
|
},
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
web: 'Phudu',
|
|
399
|
-
default: fontFamilies.phuduSemiBold,
|
|
400
|
-
}),
|
|
401
|
-
fontWeight: Platform.OS === 'web' ? '600' : undefined,
|
|
402
|
-
textAlign: 'center',
|
|
178
|
+
textNotFollowing: {
|
|
179
|
+
color: '#007AFF',
|
|
403
180
|
},
|
|
404
181
|
});
|
|
405
182
|
|
|
183
|
+
export { FollowButton };
|
|
406
184
|
export default FollowButton;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, View, StyleSheet, ViewStyle, TextStyle, StyleProp, LayoutChangeEvent } from 'react-native';
|
|
3
|
+
import { fontFamilies } from '../styles/fonts';
|
|
4
|
+
import { useOxy } from '../context/OxyContext';
|
|
5
|
+
import type { PaymentItem } from '../screens/PaymentGatewayScreen';
|
|
6
|
+
import OxyLogo from './OxyLogo';
|
|
7
|
+
|
|
8
|
+
export interface OxyPayButtonProps {
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
textStyle?: StyleProp<TextStyle>;
|
|
11
|
+
text?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
amount: number | string;
|
|
14
|
+
currency?: string;
|
|
15
|
+
paymentItems?: PaymentItem[];
|
|
16
|
+
description?: string;
|
|
17
|
+
onPaymentResult?: (result: any) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Button background color. If not provided, uses variant ('white' or 'black').
|
|
20
|
+
*/
|
|
21
|
+
color?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Button color variant: 'white' (default) or 'black'. Ignored if color is set.
|
|
24
|
+
*/
|
|
25
|
+
variant?: 'white' | 'black';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A pre-styled button for OxyPay payments that opens the Payment Gateway
|
|
30
|
+
* - Only black or white by default, but can be customized with the color prop.
|
|
31
|
+
*/
|
|
32
|
+
const OxyPayButton: React.FC<OxyPayButtonProps> = ({
|
|
33
|
+
style,
|
|
34
|
+
textStyle,
|
|
35
|
+
text = 'Pay',
|
|
36
|
+
disabled = false,
|
|
37
|
+
amount,
|
|
38
|
+
currency = 'FAIR',
|
|
39
|
+
paymentItems,
|
|
40
|
+
description,
|
|
41
|
+
onPaymentResult,
|
|
42
|
+
color,
|
|
43
|
+
variant = 'white',
|
|
44
|
+
}) => {
|
|
45
|
+
const { showBottomSheet } = useOxy();
|
|
46
|
+
const [buttonHeight, setButtonHeight] = useState<number>(52);
|
|
47
|
+
const handlePress = () => {
|
|
48
|
+
showBottomSheet?.({
|
|
49
|
+
screen: 'PaymentGateway',
|
|
50
|
+
props: {
|
|
51
|
+
amount,
|
|
52
|
+
currency,
|
|
53
|
+
paymentItems,
|
|
54
|
+
description,
|
|
55
|
+
onPaymentResult,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
// Determine background and text color
|
|
60
|
+
const backgroundColor = color || (variant === 'black' ? '#111' : '#fff');
|
|
61
|
+
const textColor = variant === 'black' || (color && isColorDark(color)) ? '#fff' : '#1b1f0a';
|
|
62
|
+
// Responsive sizing
|
|
63
|
+
const logoWidth = Math.round(buttonHeight * 0.5); // 50% of button height
|
|
64
|
+
const logoHeight = Math.round(buttonHeight * 0.25); // 25% of button height
|
|
65
|
+
const fontSize = Math.round(buttonHeight * 0.35); // 35% of button height
|
|
66
|
+
const handleLayout = (e: LayoutChangeEvent) => {
|
|
67
|
+
const h = e.nativeEvent.layout.height;
|
|
68
|
+
if (h && Math.abs(h - buttonHeight) > 1) setButtonHeight(h);
|
|
69
|
+
};
|
|
70
|
+
return (
|
|
71
|
+
<TouchableOpacity
|
|
72
|
+
style={[styles.button, { backgroundColor, borderColor: textColor, borderWidth: 1 }, disabled && styles.buttonDisabled, style]}
|
|
73
|
+
onPress={handlePress}
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
activeOpacity={0.85}
|
|
76
|
+
onLayout={handleLayout}
|
|
77
|
+
>
|
|
78
|
+
<View style={styles.buttonContent}>
|
|
79
|
+
<OxyLogo
|
|
80
|
+
width={logoWidth}
|
|
81
|
+
height={logoHeight}
|
|
82
|
+
style={{ marginRight: logoWidth * 0.12, marginTop: (fontSize - logoHeight) / 2 }}
|
|
83
|
+
fillColor={textColor}
|
|
84
|
+
/>
|
|
85
|
+
<Text style={[styles.text, { color: textColor, fontSize }, textStyle]}>{text}</Text>
|
|
86
|
+
</View>
|
|
87
|
+
</TouchableOpacity>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Helper to determine if a color is dark (simple luminance check)
|
|
92
|
+
function isColorDark(hex: string) {
|
|
93
|
+
let c = hex.replace('#', '');
|
|
94
|
+
if (c.length === 3) c = c.split('').map(x => x + x).join('');
|
|
95
|
+
if (c.length !== 6) return false;
|
|
96
|
+
const r = parseInt(c.substr(0, 2), 16);
|
|
97
|
+
const g = parseInt(c.substr(2, 2), 16);
|
|
98
|
+
const b = parseInt(c.substr(4, 2), 16);
|
|
99
|
+
// Perceived luminance
|
|
100
|
+
return (0.299 * r + 0.587 * g + 0.114 * b) < 150;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const styles = StyleSheet.create({
|
|
104
|
+
button: {
|
|
105
|
+
padding: 14,
|
|
106
|
+
borderRadius: 35,
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
minHeight: 52,
|
|
111
|
+
},
|
|
112
|
+
buttonDisabled: {
|
|
113
|
+
opacity: 0.6,
|
|
114
|
+
},
|
|
115
|
+
buttonContent: {
|
|
116
|
+
flexDirection: 'row',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
justifyContent: 'center',
|
|
119
|
+
},
|
|
120
|
+
oxyLogo: {
|
|
121
|
+
// marginRight is set dynamically
|
|
122
|
+
},
|
|
123
|
+
centeredItem: {
|
|
124
|
+
justifyContent: 'center',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
},
|
|
127
|
+
text: {
|
|
128
|
+
fontFamily: fontFamilies.phudu,
|
|
129
|
+
fontWeight: '700',
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export default OxyPayButton;
|