@oxyhq/services 5.5.9 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/lib/commonjs/core/index.js +69 -82
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +24 -183
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/node/index.js +0 -2
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +100 -229
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxyPayButton.js +131 -0
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +41 -198
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +15 -2
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +66 -0
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -0
- package/lib/commonjs/ui/components/icon/index.js +7 -0
- package/lib/commonjs/ui/components/icon/index.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -7
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +108 -0
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -0
- package/lib/commonjs/ui/components/internal/TextField.js +20 -0
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +116 -84
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/index.js +2 -15
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollow.js +52 -136
- package/lib/commonjs/ui/hooks/useFollow.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +52 -0
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -0
- package/lib/commonjs/ui/index.js +8 -191
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +52 -60
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +18 -30
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +4 -22
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +90 -39
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +37 -66
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +21 -44
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +44 -23
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +59 -78
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +1588 -0
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +22 -36
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +269 -0
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +47 -69
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +99 -333
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +136 -340
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +192 -0
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +135 -0
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +108 -0
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +126 -0
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +84 -0
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +59 -0
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +15 -2
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +66 -0
- package/lib/commonjs/ui/stores/authStore.js.map +1 -0
- package/lib/commonjs/ui/stores/followStore.js +124 -0
- package/lib/commonjs/ui/stores/followStore.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +0 -11
- package/lib/commonjs/ui/styles/index.js.map +1 -1
- package/lib/commonjs/ui/utils/confirmAction.js +28 -0
- package/lib/commonjs/ui/utils/confirmAction.js.map +1 -0
- package/lib/module/core/index.js +69 -81
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +14 -17
- package/lib/module/index.js.map +1 -1
- package/lib/module/node/index.js +0 -3
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +100 -229
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/OxyPayButton.js +125 -0
- package/lib/module/ui/components/OxyPayButton.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +42 -199
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +15 -2
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/icon/FAIRWalletIcon.js +60 -0
- package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -0
- package/lib/module/ui/components/icon/index.js +1 -0
- package/lib/module/ui/components/icon/index.js.map +1 -1
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +15 -8
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +103 -0
- package/lib/module/ui/components/internal/PinInput.js.map +1 -0
- package/lib/module/ui/components/internal/TextField.js +20 -0
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +117 -85
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/index.js +1 -2
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/useFollow.js +52 -137
- package/lib/module/ui/hooks/useFollow.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +47 -0
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -0
- package/lib/module/ui/index.js +2 -13
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +53 -61
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +6 -18
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +5 -23
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +91 -40
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +38 -67
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +22 -45
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +44 -23
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +59 -78
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +1583 -0
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -0
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +23 -37
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +263 -0
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -0
- package/lib/module/ui/screens/SessionManagementScreen.js +47 -69
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +100 -334
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +137 -341
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +186 -0
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +129 -0
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js +102 -0
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js +120 -0
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js +79 -0
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +54 -0
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +16 -3
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +62 -0
- package/lib/module/ui/stores/authStore.js.map +1 -0
- package/lib/module/ui/stores/followStore.js +120 -0
- package/lib/module/ui/stores/followStore.js.map +1 -0
- package/lib/module/ui/styles/index.js +0 -1
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/module/ui/utils/confirmAction.js +25 -0
- package/lib/module/ui/utils/confirmAction.js.map +1 -0
- package/lib/typescript/core/index.d.ts +28 -10
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +5 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +6 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/secureSession.d.ts +0 -1
- package/lib/typescript/models/secureSession.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +0 -1
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/FollowButton.d.ts +1 -77
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyPayButton.d.ts +29 -0
- package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -0
- package/lib/typescript/ui/components/icon/index.d.ts +1 -0
- package/lib/typescript/ui/components/icon/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +1 -0
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts +12 -0
- package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -0
- package/lib/typescript/ui/components/internal/TextField.d.ts +1 -0
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +0 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/index.d.ts +1 -2
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useFollow.d.ts +14 -15
- package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts +11 -0
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +2 -5
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +5 -23
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +27 -0
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +8 -0
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +27 -0
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +26 -0
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +20 -0
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +24 -0
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +15 -0
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +13 -0
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +16 -0
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -0
- package/lib/typescript/ui/stores/followStore.d.ts +15 -0
- package/lib/typescript/ui/stores/followStore.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +0 -1
- package/lib/typescript/ui/styles/index.d.ts.map +1 -1
- package/lib/typescript/ui/utils/confirmAction.d.ts +7 -0
- package/lib/typescript/ui/utils/confirmAction.d.ts.map +1 -0
- package/package.json +12 -7
- package/src/core/index.ts +78 -88
- package/src/index.ts +8 -45
- package/src/models/interfaces.ts +7 -1
- package/src/models/secureSession.ts +1 -2
- package/src/node/index.ts +0 -3
- package/src/ui/components/FollowButton.tsx +100 -322
- package/src/ui/components/OxyPayButton.tsx +133 -0
- package/src/ui/components/OxyProvider.tsx +39 -201
- package/src/ui/components/OxySignInButton.tsx +13 -2
- package/src/ui/components/icon/FAIRWalletIcon.tsx +49 -0
- package/src/ui/components/icon/index.ts +1 -0
- package/src/ui/components/index.ts +1 -0
- package/src/ui/components/internal/GroupedPillButtons.tsx +12 -8
- package/src/ui/components/internal/PinInput.tsx +102 -0
- package/src/ui/components/internal/TextField.tsx +9 -0
- package/src/ui/context/OxyContext.tsx +74 -91
- package/src/ui/hooks/index.ts +1 -2
- package/src/ui/hooks/useFollow.ts +58 -129
- package/src/ui/hooks/useSessionSocket.ts +50 -0
- package/src/ui/index.ts +2 -37
- package/src/ui/navigation/OxyRouter.tsx +47 -63
- package/src/ui/navigation/types.ts +5 -26
- package/src/ui/screens/AccountCenterScreen.tsx +12 -21
- package/src/ui/screens/AccountOverviewScreen.tsx +6 -30
- package/src/ui/screens/AccountSettingsScreen.tsx +75 -46
- package/src/ui/screens/AccountSwitcherScreen.tsx +46 -88
- package/src/ui/screens/AppInfoScreen.tsx +27 -47
- package/src/ui/screens/FeedbackScreen.tsx +34 -19
- package/src/ui/screens/FileManagementScreen.tsx +293 -321
- package/src/ui/screens/PaymentGatewayScreen.tsx +1315 -0
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +109 -124
- package/src/ui/screens/RecoverAccountScreen.tsx +260 -0
- package/src/ui/screens/SessionManagementScreen.tsx +65 -137
- package/src/ui/screens/SignInScreen.tsx +89 -283
- package/src/ui/screens/SignUpScreen.tsx +138 -291
- package/src/ui/screens/internal/SignInPasswordStep.tsx +179 -0
- package/src/ui/screens/internal/SignInUsernameStep.tsx +139 -0
- package/src/ui/screens/internal/SignUpIdentityStep.tsx +114 -0
- package/src/ui/screens/internal/SignUpSecurityStep.tsx +132 -0
- package/src/ui/screens/internal/SignUpSummaryStep.tsx +66 -0
- package/src/ui/screens/internal/SignUpWelcomeStep.tsx +52 -0
- package/src/ui/screens/karma/KarmaRewardsScreen.tsx +13 -3
- package/src/ui/stores/authStore.ts +45 -0
- package/src/ui/stores/followStore.ts +80 -0
- package/src/ui/styles/index.ts +0 -1
- package/src/ui/utils/confirmAction.ts +23 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAuthFetch.js +0 -217
- package/lib/commonjs/ui/hooks/useAuthFetch.js.map +0 -1
- package/lib/commonjs/ui/hooks/useOxyFollow.js +0 -190
- package/lib/commonjs/ui/hooks/useOxyFollow.js.map +0 -1
- package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
- package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/store/index.js +0 -67
- package/lib/commonjs/ui/store/index.js.map +0 -1
- package/lib/commonjs/ui/store/setupOxyStore.js +0 -63
- package/lib/commonjs/ui/store/setupOxyStore.js.map +0 -1
- package/lib/commonjs/ui/store/slices/authSlice.js +0 -56
- package/lib/commonjs/ui/store/slices/authSlice.js.map +0 -1
- package/lib/commonjs/ui/store/slices/followSlice.js +0 -238
- package/lib/commonjs/ui/store/slices/followSlice.js.map +0 -1
- package/lib/commonjs/ui/store/slices/index.js +0 -129
- package/lib/commonjs/ui/store/slices/index.js.map +0 -1
- package/lib/commonjs/ui/store/slices/types.js +0 -19
- package/lib/commonjs/ui/store/slices/types.js.map +0 -1
- package/lib/commonjs/ui/styles/shadows.js +0 -123
- package/lib/commonjs/ui/styles/shadows.js.map +0 -1
- package/lib/commonjs/utils/polyfills.js +0 -42
- package/lib/commonjs/utils/polyfills.js.map +0 -1
- package/lib/module/ui/components/bottomSheet/index.js +0 -5
- package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/module/ui/hooks/useAuthFetch.js +0 -212
- package/lib/module/ui/hooks/useAuthFetch.js.map +0 -1
- package/lib/module/ui/hooks/useOxyFollow.js +0 -186
- package/lib/module/ui/hooks/useOxyFollow.js.map +0 -1
- package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
- package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/module/ui/store/index.js +0 -33
- package/lib/module/ui/store/index.js.map +0 -1
- package/lib/module/ui/store/setupOxyStore.js +0 -59
- package/lib/module/ui/store/setupOxyStore.js.map +0 -1
- package/lib/module/ui/store/slices/authSlice.js +0 -48
- package/lib/module/ui/store/slices/authSlice.js.map +0 -1
- package/lib/module/ui/store/slices/followSlice.js +0 -232
- package/lib/module/ui/store/slices/followSlice.js.map +0 -1
- package/lib/module/ui/store/slices/index.js +0 -11
- package/lib/module/ui/store/slices/index.js.map +0 -1
- package/lib/module/ui/store/slices/types.js +0 -15
- package/lib/module/ui/store/slices/types.js.map +0 -1
- package/lib/module/ui/styles/shadows.js +0 -119
- package/lib/module/ui/styles/shadows.js.map +0 -1
- package/lib/module/utils/polyfills.js +0 -36
- package/lib/module/utils/polyfills.js.map +0 -1
- package/lib/typescript/types/react-redux.d.ts +0 -5
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAuthFetch.d.ts +0 -34
- package/lib/typescript/ui/hooks/useAuthFetch.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useOxyFollow.d.ts +0 -81
- package/lib/typescript/ui/hooks/useOxyFollow.d.ts.map +0 -1
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
- package/lib/typescript/ui/store/index.d.ts +0 -27
- package/lib/typescript/ui/store/index.d.ts.map +0 -1
- package/lib/typescript/ui/store/setupOxyStore.d.ts +0 -29
- package/lib/typescript/ui/store/setupOxyStore.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/authSlice.d.ts +0 -32
- package/lib/typescript/ui/store/slices/authSlice.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/followSlice.d.ts +0 -120
- package/lib/typescript/ui/store/slices/followSlice.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/index.d.ts +0 -9
- package/lib/typescript/ui/store/slices/index.d.ts.map +0 -1
- package/lib/typescript/ui/store/slices/types.d.ts +0 -16
- package/lib/typescript/ui/store/slices/types.d.ts.map +0 -1
- package/lib/typescript/ui/styles/shadows.d.ts +0 -233
- package/lib/typescript/ui/styles/shadows.d.ts.map +0 -1
- package/lib/typescript/utils/polyfills.d.ts +0 -6
- package/lib/typescript/utils/polyfills.d.ts.map +0 -1
- package/src/__tests__/backend-middleware.test.ts +0 -209
- package/src/__tests__/polyfills.test.ts +0 -30
- package/src/__tests__/setup.ts +0 -43
- package/src/__tests__/ui/hooks/authfetch-integration.test.ts +0 -197
- package/src/__tests__/ui/hooks/backward-compatibility.test.ts +0 -159
- package/src/__tests__/ui/hooks/real-world-scenarios.test.ts +0 -224
- package/src/__tests__/ui/hooks/url-resolution.test.ts +0 -129
- package/src/__tests__/ui/hooks/useAuthFetch-separation.test.ts +0 -69
- package/src/__tests__/ui/hooks/useAuthFetch.test.ts +0 -70
- package/src/__tests__/ui/hooks/useOxyFollow.test.tsx +0 -92
- package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +0 -112
- package/src/__tests__/ui/store/setupOxyStore.test.ts +0 -50
- package/src/__tests__/validate-structure.js +0 -91
- package/src/__tests__/validation.js +0 -42
- package/src/types/react-redux.d.ts +0 -5
- package/src/ui/components/bottomSheet/index.tsx +0 -14
- package/src/ui/hooks/useAuthFetch.ts +0 -238
- package/src/ui/hooks/useOxyFollow.ts +0 -188
- package/src/ui/screens/BillingManagementScreen.tsx +0 -589
- package/src/ui/store/index.ts +0 -36
- package/src/ui/store/setupOxyStore.ts +0 -58
- package/src/ui/store/slices/authSlice.ts +0 -43
- package/src/ui/store/slices/followSlice.ts +0 -207
- package/src/ui/store/slices/index.ts +0 -31
- package/src/ui/store/slices/types.ts +0 -33
- package/src/ui/styles/shadows.ts +0 -112
- package/src/utils/polyfills.ts +0 -34
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createShadow = createShadow;
|
|
7
|
-
exports.shadows = void 0;
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
/**
|
|
10
|
-
* Cross-platform shadow utility that eliminates "shadow*" deprecation warnings
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Creates cross-platform shadow styles
|
|
15
|
-
* Uses boxShadow for web and native shadow props for iOS/Android
|
|
16
|
-
*/
|
|
17
|
-
function createShadow(config) {
|
|
18
|
-
const {
|
|
19
|
-
shadowColor = '#000',
|
|
20
|
-
shadowOffset = {
|
|
21
|
-
width: 0,
|
|
22
|
-
height: 2
|
|
23
|
-
},
|
|
24
|
-
shadowOpacity = 0.1,
|
|
25
|
-
shadowRadius = 4,
|
|
26
|
-
elevation = 2
|
|
27
|
-
} = config;
|
|
28
|
-
return _reactNative.Platform.select({
|
|
29
|
-
web: {
|
|
30
|
-
boxShadow: `${shadowOffset.width}px ${shadowOffset.height}px ${shadowRadius}px rgba(${hexToRgb(shadowColor)}, ${shadowOpacity})`
|
|
31
|
-
},
|
|
32
|
-
ios: {
|
|
33
|
-
shadowColor,
|
|
34
|
-
shadowOffset,
|
|
35
|
-
shadowOpacity,
|
|
36
|
-
shadowRadius
|
|
37
|
-
},
|
|
38
|
-
android: {
|
|
39
|
-
elevation
|
|
40
|
-
},
|
|
41
|
-
default: {
|
|
42
|
-
shadowColor,
|
|
43
|
-
shadowOffset,
|
|
44
|
-
shadowOpacity,
|
|
45
|
-
shadowRadius,
|
|
46
|
-
elevation
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Helper function to convert hex color to RGB
|
|
53
|
-
*/
|
|
54
|
-
function hexToRgb(hex) {
|
|
55
|
-
// Remove # if present
|
|
56
|
-
hex = hex.replace('#', '');
|
|
57
|
-
|
|
58
|
-
// Handle shorthand hex colors (e.g., #fff)
|
|
59
|
-
if (hex.length === 3) {
|
|
60
|
-
hex = hex.split('').map(char => char + char).join('');
|
|
61
|
-
}
|
|
62
|
-
const r = parseInt(hex.substr(0, 2), 16);
|
|
63
|
-
const g = parseInt(hex.substr(2, 2), 16);
|
|
64
|
-
const b = parseInt(hex.substr(4, 2), 16);
|
|
65
|
-
return `${r}, ${g}, ${b}`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Predefined shadow presets
|
|
70
|
-
*/
|
|
71
|
-
const shadows = exports.shadows = {
|
|
72
|
-
small: createShadow({
|
|
73
|
-
shadowColor: '#000',
|
|
74
|
-
shadowOffset: {
|
|
75
|
-
width: 0,
|
|
76
|
-
height: 1
|
|
77
|
-
},
|
|
78
|
-
shadowOpacity: 0.05,
|
|
79
|
-
shadowRadius: 2,
|
|
80
|
-
elevation: 1
|
|
81
|
-
}),
|
|
82
|
-
medium: createShadow({
|
|
83
|
-
shadowColor: '#000',
|
|
84
|
-
shadowOffset: {
|
|
85
|
-
width: 0,
|
|
86
|
-
height: 2
|
|
87
|
-
},
|
|
88
|
-
shadowOpacity: 0.1,
|
|
89
|
-
shadowRadius: 4,
|
|
90
|
-
elevation: 2
|
|
91
|
-
}),
|
|
92
|
-
large: createShadow({
|
|
93
|
-
shadowColor: '#000',
|
|
94
|
-
shadowOffset: {
|
|
95
|
-
width: 0,
|
|
96
|
-
height: 4
|
|
97
|
-
},
|
|
98
|
-
shadowOpacity: 0.15,
|
|
99
|
-
shadowRadius: 8,
|
|
100
|
-
elevation: 4
|
|
101
|
-
}),
|
|
102
|
-
card: createShadow({
|
|
103
|
-
shadowColor: '#000',
|
|
104
|
-
shadowOffset: {
|
|
105
|
-
width: 0,
|
|
106
|
-
height: 2
|
|
107
|
-
},
|
|
108
|
-
shadowOpacity: 0.08,
|
|
109
|
-
shadowRadius: 8,
|
|
110
|
-
elevation: 3
|
|
111
|
-
}),
|
|
112
|
-
button: createShadow({
|
|
113
|
-
shadowColor: '#000',
|
|
114
|
-
shadowOffset: {
|
|
115
|
-
width: 0,
|
|
116
|
-
height: 2
|
|
117
|
-
},
|
|
118
|
-
shadowOpacity: 0.1,
|
|
119
|
-
shadowRadius: 4,
|
|
120
|
-
elevation: 2
|
|
121
|
-
})
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=shadows.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","createShadow","config","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","Platform","select","web","boxShadow","hexToRgb","ios","android","default","hex","replace","length","split","map","char","join","r","parseInt","substr","g","b","shadows","exports","small","medium","large","card","button"],"sourceRoot":"../../../../src","sources":["ui/styles/shadows.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;;AASA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,MAAoB,EAAE;EACjD,MAAM;IACJC,WAAW,GAAG,MAAM;IACpBC,YAAY,GAAG;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACtCC,aAAa,GAAG,GAAG;IACnBC,YAAY,GAAG,CAAC;IAChBC,SAAS,GAAG;EACd,CAAC,GAAGP,MAAM;EAEV,OAAOQ,qBAAQ,CAACC,MAAM,CAAC;IACrBC,GAAG,EAAE;MACHC,SAAS,EAAE,GAAGT,YAAY,CAACC,KAAK,MAAMD,YAAY,CAACE,MAAM,MAAME,YAAY,WAAWM,QAAQ,CAACX,WAAW,CAAC,KAAKI,aAAa;IAC/H,CAAC;IACDQ,GAAG,EAAE;MACHZ,WAAW;MACXC,YAAY;MACZG,aAAa;MACbC;IACF,CAAC;IACDQ,OAA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AAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC,CAAC;EAEFyB,KAAK,EAAEjC,YAAY,CAAC;IAClBE,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF0B,IAAI,EAAElC,YAAY,CAAC;IACjBE,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF2B,MAAM,EAAEnC,YAAY,CAAC;IACnBE,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getFormDataConstructor = exports.ensureFormDataAvailable = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Polyfills for React Native environments that may be missing certain Web APIs
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// FormData polyfill for React Native/Hermes environments
|
|
12
|
-
if (typeof FormData === 'undefined') {
|
|
13
|
-
try {
|
|
14
|
-
const FormDataPolyfill = require('form-data');
|
|
15
|
-
// Use globalThis which is more universal than global
|
|
16
|
-
if (typeof globalThis !== 'undefined') {
|
|
17
|
-
globalThis.FormData = FormDataPolyfill;
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.warn('form-data package not found. File uploads may not work in React Native environments without native FormData support.');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Export a helper to ensure FormData is available
|
|
25
|
-
const ensureFormDataAvailable = () => {
|
|
26
|
-
return typeof FormData !== 'undefined' || typeof require !== 'undefined';
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Get FormData constructor (either native or polyfilled)
|
|
30
|
-
exports.ensureFormDataAvailable = ensureFormDataAvailable;
|
|
31
|
-
const getFormDataConstructor = () => {
|
|
32
|
-
if (typeof FormData !== 'undefined') {
|
|
33
|
-
return FormData;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
return require('form-data');
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw new Error('FormData is not available and form-data package is not installed. Please install form-data for file upload support.');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
exports.getFormDataConstructor = getFormDataConstructor;
|
|
42
|
-
//# sourceMappingURL=polyfills.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["FormData","FormDataPolyfill","require","globalThis","error","console","warn","ensureFormDataAvailable","exports","getFormDataConstructor","Error"],"sourceRoot":"../../../src","sources":["utils/polyfills.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA,IAAI,OAAOA,QAAQ,KAAK,WAAW,EAAE;EACnC,IAAI;IACF,MAAMC,gBAAgB,GAAGC,OAAO,CAAC,WAAW,CAAC;IAC7C;IACA,IAAI,OAAOC,UAAU,KAAK,WAAW,EAAE;MACpCA,UAAU,CAASH,QAAQ,GAAGC,gBAAgB;IACjD;EACF,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,sHAAsH,CAAC;EACtI;AACF;;AAEA;AACO,MAAMC,uBAAuB,GAAGA,CAAA,KAAe;EACpD,OAAO,OAAOP,QAAQ,KAAK,WAAW,IAAI,OAAOE,OAAO,KAAK,WAAW;AAC1E,CAAC;;AAED;AAAAM,OAAA,CAAAD,uBAAA,GAAAA,uBAAA;AACO,MAAME,sBAAsB,GAAGA,CAAA,KAAW;EAC/C,IAAI,OAAOT,QAAQ,KAAK,WAAW,EAAE;IACnC,OAAOA,QAAQ;EACjB;EAEA,IAAI;IACF,OAAOE,OAAO,CAAC,WAAW,CAAC;EAC7B,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,MAAM,IAAIM,KAAK,CAAC,qHAAqH,CAAC;EACxI;AACF,CAAC;AAACF,OAAA,CAAAC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheetModal","BottomSheetBackdrop","BottomSheetModalProvider","BottomSheetView","BottomSheetScrollView"],"sourceRoot":"../../../../../src","sources":["ui/components/bottomSheet/index.tsx"],"mappings":";;AAAA;AACA,SACEA,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,eAAe,EACfC,qBAAqB,QAChB,sBAAsB","ignoreList":[]}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Zero Config Authenticated Fetch Hook
|
|
5
|
-
*
|
|
6
|
-
* Simple hook that provides fetch-like API with automatic authentication
|
|
7
|
-
* Leverages the existing useOxy hook and OxyProvider infrastructure
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* const authFetch = useAuthFetch();
|
|
11
|
-
* const response = await authFetch('/api/protected');
|
|
12
|
-
* const data = await authFetch.get('/api/users');
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { useCallback } from 'react';
|
|
16
|
-
import { useOxy } from '../context/OxyContext';
|
|
17
|
-
/**
|
|
18
|
-
* Hook that provides authenticated fetch functionality
|
|
19
|
-
* Uses the existing OxyServices instance from useOxy context
|
|
20
|
-
*/
|
|
21
|
-
export function useAuthFetch() {
|
|
22
|
-
const {
|
|
23
|
-
oxyServices,
|
|
24
|
-
isAuthenticated,
|
|
25
|
-
user,
|
|
26
|
-
login,
|
|
27
|
-
logout,
|
|
28
|
-
signUp,
|
|
29
|
-
activeSessionId,
|
|
30
|
-
setApiUrl,
|
|
31
|
-
getAppBaseURL
|
|
32
|
-
} = useOxy();
|
|
33
|
-
|
|
34
|
-
// Validate that we have the required dependencies
|
|
35
|
-
if (!oxyServices) {
|
|
36
|
-
throw new Error('useAuthFetch requires OxyServices to be initialized. Make sure your app is wrapped with OxyProvider.');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Main fetch function with automatic auth headers
|
|
40
|
-
const authFetch = useCallback(async (input, init) => {
|
|
41
|
-
if (!oxyServices) {
|
|
42
|
-
throw new Error('OxyServices not initialized. Make sure to wrap your app in OxyProvider.');
|
|
43
|
-
}
|
|
44
|
-
const url = resolveURL(input, getAppBaseURL());
|
|
45
|
-
const options = await addAuthHeaders(init, oxyServices, activeSessionId || undefined, isAuthenticated);
|
|
46
|
-
try {
|
|
47
|
-
let response = await fetch(url, options);
|
|
48
|
-
|
|
49
|
-
// Handle token expiry and automatic refresh
|
|
50
|
-
if (response.status === 401 && isAuthenticated) {
|
|
51
|
-
// Try to refresh token if we have refresh capability
|
|
52
|
-
if (oxyServices.refreshTokens) {
|
|
53
|
-
try {
|
|
54
|
-
await oxyServices.refreshTokens();
|
|
55
|
-
const retryOptions = await addAuthHeaders(init, oxyServices, activeSessionId || undefined, isAuthenticated);
|
|
56
|
-
response = await fetch(url, retryOptions);
|
|
57
|
-
} catch (refreshError) {
|
|
58
|
-
// Refresh failed, throw authentication error
|
|
59
|
-
const error = new Error('Authentication expired. Please login again.');
|
|
60
|
-
error.status = 401;
|
|
61
|
-
error.code = 'AUTH_EXPIRED';
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return response;
|
|
67
|
-
} catch (error) {
|
|
68
|
-
// Re-throw with additional context if needed
|
|
69
|
-
if (error instanceof Error) {
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
throw new Error('Request failed');
|
|
73
|
-
}
|
|
74
|
-
}, [oxyServices, activeSessionId, isAuthenticated, getAppBaseURL]);
|
|
75
|
-
|
|
76
|
-
// JSON convenience methods
|
|
77
|
-
const get = useCallback(async (endpoint, options) => {
|
|
78
|
-
const response = await authFetch(endpoint, {
|
|
79
|
-
...options,
|
|
80
|
-
method: 'GET'
|
|
81
|
-
});
|
|
82
|
-
return handleJsonResponse(response);
|
|
83
|
-
}, [authFetch]);
|
|
84
|
-
const post = useCallback(async (endpoint, data, options) => {
|
|
85
|
-
const response = await authFetch(endpoint, {
|
|
86
|
-
...options,
|
|
87
|
-
method: 'POST',
|
|
88
|
-
headers: {
|
|
89
|
-
'Content-Type': 'application/json',
|
|
90
|
-
...options?.headers
|
|
91
|
-
},
|
|
92
|
-
body: data ? JSON.stringify(data) : undefined
|
|
93
|
-
});
|
|
94
|
-
return handleJsonResponse(response);
|
|
95
|
-
}, [authFetch]);
|
|
96
|
-
const put = useCallback(async (endpoint, data, options) => {
|
|
97
|
-
const response = await authFetch(endpoint, {
|
|
98
|
-
...options,
|
|
99
|
-
method: 'PUT',
|
|
100
|
-
headers: {
|
|
101
|
-
'Content-Type': 'application/json',
|
|
102
|
-
...options?.headers
|
|
103
|
-
},
|
|
104
|
-
body: data ? JSON.stringify(data) : undefined
|
|
105
|
-
});
|
|
106
|
-
return handleJsonResponse(response);
|
|
107
|
-
}, [authFetch]);
|
|
108
|
-
const del = useCallback(async (endpoint, options) => {
|
|
109
|
-
const response = await authFetch(endpoint, {
|
|
110
|
-
...options,
|
|
111
|
-
method: 'DELETE'
|
|
112
|
-
});
|
|
113
|
-
return handleJsonResponse(response);
|
|
114
|
-
}, [authFetch]);
|
|
115
|
-
|
|
116
|
-
// Attach convenience methods and auth state to the main function
|
|
117
|
-
const fetchWithMethods = authFetch;
|
|
118
|
-
fetchWithMethods.get = get;
|
|
119
|
-
fetchWithMethods.post = post;
|
|
120
|
-
fetchWithMethods.put = put;
|
|
121
|
-
fetchWithMethods.delete = del;
|
|
122
|
-
fetchWithMethods.isAuthenticated = isAuthenticated;
|
|
123
|
-
fetchWithMethods.user = user;
|
|
124
|
-
fetchWithMethods.login = login;
|
|
125
|
-
fetchWithMethods.logout = logout;
|
|
126
|
-
fetchWithMethods.signUp = signUp;
|
|
127
|
-
fetchWithMethods.setApiUrl = setApiUrl;
|
|
128
|
-
return fetchWithMethods;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Helper functions
|
|
133
|
-
*/
|
|
134
|
-
|
|
135
|
-
function resolveURL(input, baseURL) {
|
|
136
|
-
if (!baseURL) {
|
|
137
|
-
throw new Error('Base URL not configured. Please provide a baseURL in OxyServices configuration.');
|
|
138
|
-
}
|
|
139
|
-
const url = input.toString();
|
|
140
|
-
|
|
141
|
-
// If it's already a full URL (http/https), return as is
|
|
142
|
-
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
143
|
-
return url;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Normalize base URL (remove trailing slash)
|
|
147
|
-
const normalizedBaseURL = baseURL.replace(/\/$/, '');
|
|
148
|
-
|
|
149
|
-
// If URL starts with /, it's relative to base URL
|
|
150
|
-
if (url.startsWith('/')) {
|
|
151
|
-
return `${normalizedBaseURL}${url}`;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Otherwise, append to base URL with /
|
|
155
|
-
return `${normalizedBaseURL}/${url}`;
|
|
156
|
-
}
|
|
157
|
-
async function addAuthHeaders(init, oxyServices, activeSessionId, isAuthenticated) {
|
|
158
|
-
const headers = new Headers(init?.headers);
|
|
159
|
-
|
|
160
|
-
// Add auth header if user is authenticated
|
|
161
|
-
if (isAuthenticated && oxyServices && !headers.has('Authorization')) {
|
|
162
|
-
try {
|
|
163
|
-
// First try to get regular JWT access token
|
|
164
|
-
let accessToken = oxyServices.getAccessToken?.();
|
|
165
|
-
|
|
166
|
-
// If no JWT token but we have a secure session, try to get token from session
|
|
167
|
-
if (!accessToken && activeSessionId) {
|
|
168
|
-
try {
|
|
169
|
-
const tokenData = await oxyServices.getTokenBySession(activeSessionId);
|
|
170
|
-
accessToken = tokenData.accessToken;
|
|
171
|
-
} catch (error) {
|
|
172
|
-
// Silent fail - will attempt request without token
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (accessToken) {
|
|
176
|
-
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
177
|
-
}
|
|
178
|
-
} catch (error) {
|
|
179
|
-
// Silent fail - will attempt request without token
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const body = init?.body;
|
|
183
|
-
const processedBody = body && typeof body === 'object' && !(body instanceof FormData) && !(body instanceof URLSearchParams) ? JSON.stringify(body) : body;
|
|
184
|
-
return {
|
|
185
|
-
...init,
|
|
186
|
-
headers,
|
|
187
|
-
body: processedBody
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
async function handleJsonResponse(response) {
|
|
191
|
-
if (!response.ok) {
|
|
192
|
-
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
193
|
-
try {
|
|
194
|
-
const errorData = await response.json();
|
|
195
|
-
errorMessage = errorData.message || errorData.error || errorMessage;
|
|
196
|
-
} catch {
|
|
197
|
-
// Ignore JSON parsing errors
|
|
198
|
-
}
|
|
199
|
-
const error = new Error(errorMessage);
|
|
200
|
-
error.status = response.status;
|
|
201
|
-
error.response = response;
|
|
202
|
-
throw error;
|
|
203
|
-
}
|
|
204
|
-
try {
|
|
205
|
-
return await response.json();
|
|
206
|
-
} catch {
|
|
207
|
-
// If response isn't JSON, return the response itself
|
|
208
|
-
return response;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
export default useAuthFetch;
|
|
212
|
-
//# sourceMappingURL=useAuthFetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useOxy","useAuthFetch","oxyServices","isAuthenticated","user","login","logout","signUp","activeSessionId","setApiUrl","getAppBaseURL","Error","authFetch","input","init","url","resolveURL","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"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAuthFetch.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,MAAM,QAAQ,uBAAuB;AA2B9C;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAA,EAAiB;EAC3C,MAAM;IAAEC,WAAW;IAAEC,eAAe;IAAEC,IAAI;IAAEC,KAAK;IAAEC,MAAM;IAAEC,MAAM;IAAEC,eAAe;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGV,MAAM,CAAC,CAAC;;EAEzH;EACA,IAAI,CAACE,WAAW,EAAE;IAChB,MAAM,IAAIS,KAAK,CAAC,sGAAsG,CAAC;EACzH;;EAEA;EACA,MAAMC,SAAS,GAAGb,WAAW,CAAC,OAAOc,KAAwB,EAAEC,IAAuB,KAAwB;IAC5G,IAAI,CAACZ,WAAW,EAAE;MAChB,MAAM,IAAIS,KAAK,CAAC,yEAAyE,CAAC;IAC5F;IAEA,MAAMI,GAAG,GAAGC,UAAU,CAACH,KAAK,EAAEH,aAAa,CAAC,CAAC,CAAC;IAC9C,MAAMO,OAAO,GAAG,MAAMC,cAAc,CAACJ,IAAI,EAAEZ,WAAW,EAAEM,eAAe,IAAIW,SAAS,EAAEhB,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AAC,CAAC,MAAM;MACN;IAAA;IAGF,MAAMhC,KAAK,GAAG,IAAIf,KAAK,CAAC+C,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;AAEA,eAAenB,YAAY","ignoreList":[]}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
import { useCallback, useMemo } from 'react';
|
|
5
|
-
import { toggleFollowUser, setFollowingStatus, clearFollowError, fetchFollowStatus, followSelectors } from '../store/slices/followSlice';
|
|
6
|
-
import { useOxy } from '../context/OxyContext';
|
|
7
|
-
|
|
8
|
-
// Generic type for state that includes follow slice
|
|
9
|
-
|
|
10
|
-
// Memoized selector to prevent unnecessary re-renders
|
|
11
|
-
const createFollowSelector = userId => state => ({
|
|
12
|
-
isFollowing: followSelectors.selectIsUserFollowed(state, userId),
|
|
13
|
-
isLoading: followSelectors.selectIsUserLoading(state, userId),
|
|
14
|
-
error: followSelectors.selectUserError(state, userId)
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Memoized selector for multiple users
|
|
18
|
-
const createMultipleFollowSelector = userIds => state => {
|
|
19
|
-
const followData = {};
|
|
20
|
-
for (const userId of userIds) {
|
|
21
|
-
followData[userId] = {
|
|
22
|
-
isFollowing: followSelectors.selectIsUserFollowed(state, userId),
|
|
23
|
-
isLoading: followSelectors.selectIsUserLoading(state, userId),
|
|
24
|
-
error: followSelectors.selectUserError(state, userId)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const followState = state.follow;
|
|
28
|
-
return {
|
|
29
|
-
followData,
|
|
30
|
-
isAnyLoading: userIds.some(uid => followState.loadingUsers[uid]),
|
|
31
|
-
hasAnyError: userIds.some(uid => followState.errors[uid]),
|
|
32
|
-
allFollowing: userIds.every(uid => followState.followingUsers[uid]),
|
|
33
|
-
allNotFollowing: userIds.every(uid => !followState.followingUsers[uid])
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Custom hook for managing follow/unfollow functionality
|
|
39
|
-
* Works with any Redux store that includes the Oxy follow reducer
|
|
40
|
-
* Optimized to prevent unnecessary re-renders
|
|
41
|
-
* Can handle both single user and multiple users
|
|
42
|
-
*/
|
|
43
|
-
export const useOxyFollow = userId => {
|
|
44
|
-
const dispatch = useDispatch();
|
|
45
|
-
const {
|
|
46
|
-
oxyServices
|
|
47
|
-
} = useOxy();
|
|
48
|
-
|
|
49
|
-
// Memoize user IDs to prevent recreation on every render
|
|
50
|
-
const userIds = useMemo(() => {
|
|
51
|
-
return Array.isArray(userId) ? userId : userId ? [userId] : [];
|
|
52
|
-
}, [userId]);
|
|
53
|
-
const isSingleUser = typeof userId === 'string';
|
|
54
|
-
|
|
55
|
-
// Memoize selectors to prevent recreation
|
|
56
|
-
const singleUserSelector = useMemo(() => {
|
|
57
|
-
return isSingleUser && userId ? createFollowSelector(userId) : null;
|
|
58
|
-
}, [isSingleUser, userId]);
|
|
59
|
-
const multipleUserSelector = useMemo(() => {
|
|
60
|
-
return !isSingleUser ? createMultipleFollowSelector(userIds) : null;
|
|
61
|
-
}, [isSingleUser, userIds]);
|
|
62
|
-
|
|
63
|
-
// Use appropriate selector based on mode
|
|
64
|
-
const singleUserData = useSelector(singleUserSelector || (() => ({
|
|
65
|
-
isFollowing: false,
|
|
66
|
-
isLoading: false,
|
|
67
|
-
error: null
|
|
68
|
-
})));
|
|
69
|
-
const multipleUserData = useSelector(multipleUserSelector || (() => ({
|
|
70
|
-
followData: {},
|
|
71
|
-
isAnyLoading: false,
|
|
72
|
-
hasAnyError: false,
|
|
73
|
-
allFollowing: false,
|
|
74
|
-
allNotFollowing: true
|
|
75
|
-
})));
|
|
76
|
-
|
|
77
|
-
// Memoized callbacks to prevent recreation on every render
|
|
78
|
-
const toggleFollow = useCallback(async () => {
|
|
79
|
-
if (!isSingleUser || !userId) throw new Error('toggleFollow is only available for single user mode');
|
|
80
|
-
try {
|
|
81
|
-
const result = await dispatch(toggleFollowUser({
|
|
82
|
-
userId,
|
|
83
|
-
oxyServices,
|
|
84
|
-
isCurrentlyFollowing: singleUserData.isFollowing
|
|
85
|
-
})).unwrap();
|
|
86
|
-
return result;
|
|
87
|
-
} catch (error) {
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
}, [dispatch, userId, oxyServices, singleUserData.isFollowing, isSingleUser]);
|
|
91
|
-
const setFollowStatus = useCallback(following => {
|
|
92
|
-
if (!isSingleUser || !userId) throw new Error('setFollowStatus is only available for single user mode');
|
|
93
|
-
dispatch(setFollowingStatus({
|
|
94
|
-
userId,
|
|
95
|
-
isFollowing: following
|
|
96
|
-
}));
|
|
97
|
-
}, [dispatch, userId, isSingleUser]);
|
|
98
|
-
const fetchStatus = useCallback(async () => {
|
|
99
|
-
if (!isSingleUser || !userId) throw new Error('fetchStatus is only available for single user mode');
|
|
100
|
-
try {
|
|
101
|
-
await dispatch(fetchFollowStatus({
|
|
102
|
-
userId,
|
|
103
|
-
oxyServices
|
|
104
|
-
})).unwrap();
|
|
105
|
-
} catch (error) {
|
|
106
|
-
console.warn(`Failed to fetch follow status for user ${userId}:`, error);
|
|
107
|
-
}
|
|
108
|
-
}, [dispatch, userId, oxyServices, isSingleUser]);
|
|
109
|
-
const clearError = useCallback(() => {
|
|
110
|
-
if (!isSingleUser || !userId) throw new Error('clearError is only available for single user mode');
|
|
111
|
-
dispatch(clearFollowError(userId));
|
|
112
|
-
}, [dispatch, userId, isSingleUser]);
|
|
113
|
-
|
|
114
|
-
// Multiple user callbacks
|
|
115
|
-
const toggleFollowForUser = useCallback(async targetUserId => {
|
|
116
|
-
const currentState = multipleUserData.followData[targetUserId]?.isFollowing ?? false;
|
|
117
|
-
try {
|
|
118
|
-
const result = await dispatch(toggleFollowUser({
|
|
119
|
-
userId: targetUserId,
|
|
120
|
-
oxyServices,
|
|
121
|
-
isCurrentlyFollowing: currentState
|
|
122
|
-
})).unwrap();
|
|
123
|
-
return result;
|
|
124
|
-
} catch (error) {
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
}, [dispatch, oxyServices, multipleUserData.followData]);
|
|
128
|
-
const setFollowStatusForUser = useCallback((targetUserId, following) => {
|
|
129
|
-
dispatch(setFollowingStatus({
|
|
130
|
-
userId: targetUserId,
|
|
131
|
-
isFollowing: following
|
|
132
|
-
}));
|
|
133
|
-
}, [dispatch]);
|
|
134
|
-
const fetchStatusForUser = useCallback(async targetUserId => {
|
|
135
|
-
try {
|
|
136
|
-
await dispatch(fetchFollowStatus({
|
|
137
|
-
userId: targetUserId,
|
|
138
|
-
oxyServices
|
|
139
|
-
})).unwrap();
|
|
140
|
-
} catch (error) {
|
|
141
|
-
console.warn(`Failed to fetch follow status for user ${targetUserId}:`, error);
|
|
142
|
-
}
|
|
143
|
-
}, [dispatch, oxyServices]);
|
|
144
|
-
const fetchAllStatuses = useCallback(async () => {
|
|
145
|
-
const promises = userIds.map(uid => dispatch(fetchFollowStatus({
|
|
146
|
-
userId: uid,
|
|
147
|
-
oxyServices
|
|
148
|
-
})).unwrap().catch(error => {
|
|
149
|
-
console.warn(`Failed to fetch follow status for user ${uid}:`, error);
|
|
150
|
-
}));
|
|
151
|
-
await Promise.all(promises);
|
|
152
|
-
}, [dispatch, userIds, oxyServices]);
|
|
153
|
-
const clearErrorForUser = useCallback(targetUserId => {
|
|
154
|
-
dispatch(clearFollowError(targetUserId));
|
|
155
|
-
}, [dispatch]);
|
|
156
|
-
|
|
157
|
-
// Return appropriate interface based on mode
|
|
158
|
-
if (isSingleUser && userId) {
|
|
159
|
-
return {
|
|
160
|
-
isFollowing: singleUserData.isFollowing,
|
|
161
|
-
isLoading: singleUserData.isLoading,
|
|
162
|
-
error: singleUserData.error,
|
|
163
|
-
toggleFollow,
|
|
164
|
-
setFollowStatus,
|
|
165
|
-
fetchStatus,
|
|
166
|
-
clearError
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
followData: multipleUserData.followData,
|
|
171
|
-
toggleFollowForUser,
|
|
172
|
-
setFollowStatusForUser,
|
|
173
|
-
fetchStatusForUser,
|
|
174
|
-
fetchAllStatuses,
|
|
175
|
-
clearErrorForUser,
|
|
176
|
-
// Helper methods
|
|
177
|
-
isAnyLoading: multipleUserData.isAnyLoading,
|
|
178
|
-
hasAnyError: multipleUserData.hasAnyError,
|
|
179
|
-
allFollowing: multipleUserData.allFollowing,
|
|
180
|
-
allNotFollowing: multipleUserData.allNotFollowing
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// Backward compatibility alias
|
|
185
|
-
export const useFollow = useOxyFollow;
|
|
186
|
-
//# sourceMappingURL=useOxyFollow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelector","useCallback","useMemo","toggleFollowUser","setFollowingStatus","clearFollowError","fetchFollowStatus","followSelectors","useOxy","createFollowSelector","userId","state","isFollowing","selectIsUserFollowed","isLoading","selectIsUserLoading","error","selectUserError","createMultipleFollowSelector","userIds","followData","followState","follow","isAnyLoading","some","uid","loadingUsers","hasAnyError","errors","allFollowing","every","followingUsers","allNotFollowing","useOxyFollow","dispatch","oxyServices","Array","isArray","isSingleUser","singleUserSelector","multipleUserSelector","singleUserData","multipleUserData","toggleFollow","Error","result","isCurrentlyFollowing","unwrap","setFollowStatus","following","fetchStatus","console","warn","clearError","toggleFollowForUser","targetUserId","currentState","setFollowStatusForUser","fetchStatusForUser","fetchAllStatuses","promises","map","catch","Promise","all","clearErrorForUser","useFollow"],"sourceRoot":"../../../../src","sources":["ui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