@oxyhq/services 5.10.16 → 5.11.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 +78 -14
- package/lib/commonjs/assets/assets/icons/OxyServices.tsx +2 -2
- package/lib/commonjs/assets/assets/illustrations/HighFive.tsx +1 -1
- package/lib/commonjs/assets/icons/OxyServices.js +0 -2
- package/lib/commonjs/assets/icons/OxyServices.js.map +1 -1
- package/lib/commonjs/assets/illustrations/HighFive.js +0 -2
- package/lib/commonjs/assets/illustrations/HighFive.js.map +1 -1
- package/lib/commonjs/core/OxyServices.js +238 -25
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/index.js +86 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/lib/sonner-safe.js +2 -0
- package/lib/commonjs/lib/sonner-safe.js.map +1 -1
- package/lib/commonjs/lib/sonner.js +2 -0
- package/lib/commonjs/lib/sonner.js.map +1 -1
- package/lib/commonjs/ui/components/Avatar.js +0 -2
- package/lib/commonjs/ui/components/Avatar.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +4 -4
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/FontLoader.js +3 -2
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +7 -4
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
- package/lib/commonjs/ui/components/Header.js +0 -1
- package/lib/commonjs/ui/components/Header.js.map +1 -1
- package/lib/commonjs/ui/components/OxyLogo.js +0 -2
- package/lib/commonjs/ui/components/OxyLogo.js.map +1 -1
- package/lib/commonjs/ui/components/OxyPayButton.js +4 -5
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +4 -3
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +0 -1
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +0 -1
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
- package/lib/commonjs/ui/components/QuickActions.js +0 -2
- package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
- package/lib/commonjs/ui/components/Section.js +0 -1
- package/lib/commonjs/ui/components/Section.js.map +1 -1
- package/lib/commonjs/ui/components/SectionTitle.js +0 -2
- package/lib/commonjs/ui/components/SectionTitle.js.map +1 -1
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +0 -2
- package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js +0 -2
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +0 -2
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +4 -3
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.js +3 -3
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAssets.js +263 -0
- package/lib/commonjs/ui/hooks/useAssets.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +1 -2
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -2
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js +0 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -2
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -6
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -2
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +631 -430
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +2 -2
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -2
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +1 -2
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +1 -2
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +1 -2
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -2
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserLinksScreen.js +0 -2
- package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +1 -2
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +1 -2
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +1 -2
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +1 -2
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +0 -1
- package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +0 -1
- package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +0 -2
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -2
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -2
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +0 -2
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -2
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/assetStore.js +225 -0
- package/lib/commonjs/ui/stores/assetStore.js.map +1 -0
- package/lib/commonjs/ui/stores/authStore.js +1 -1
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/stores/fileStore.js +153 -0
- package/lib/commonjs/ui/stores/fileStore.js.map +1 -0
- package/lib/commonjs/ui/stores/followStore.js +2 -2
- package/lib/commonjs/ui/stores/followStore.js.map +1 -1
- package/lib/commonjs/utils/asyncUtils.js +1 -1
- package/lib/commonjs/utils/asyncUtils.js.map +1 -1
- package/lib/commonjs/utils/errorUtils.js +19 -11
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/hookUtils.js +1 -1
- package/lib/commonjs/utils/hookUtils.js.map +1 -1
- package/lib/commonjs/utils/loggerUtils.js.map +1 -1
- package/lib/commonjs/utils/validationUtils.js +2 -2
- package/lib/commonjs/utils/validationUtils.js.map +1 -1
- package/lib/module/assets/assets/icons/OxyServices.tsx +2 -2
- package/lib/module/assets/assets/illustrations/HighFive.tsx +1 -1
- package/lib/module/assets/icons/OxyServices.js +0 -1
- package/lib/module/assets/icons/OxyServices.js.map +1 -1
- package/lib/module/assets/illustrations/HighFive.js +0 -1
- package/lib/module/assets/illustrations/HighFive.js.map +1 -1
- package/lib/module/core/OxyServices.js +238 -25
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/lib/sonner-safe.js +2 -0
- package/lib/module/lib/sonner-safe.js.map +1 -1
- package/lib/module/lib/sonner.js +3 -0
- package/lib/module/lib/sonner.js.map +1 -1
- package/lib/module/ui/components/Avatar.js +0 -1
- package/lib/module/ui/components/Avatar.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +4 -3
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/FontLoader.js +3 -2
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +7 -3
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +1 -1
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/Header.js +0 -1
- package/lib/module/ui/components/Header.js.map +1 -1
- package/lib/module/ui/components/OxyLogo.js +0 -1
- package/lib/module/ui/components/OxyLogo.js.map +1 -1
- package/lib/module/ui/components/OxyPayButton.js +4 -4
- package/lib/module/ui/components/OxyPayButton.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +4 -2
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +0 -1
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +0 -1
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/QuickActions.js +0 -1
- package/lib/module/ui/components/QuickActions.js.map +1 -1
- package/lib/module/ui/components/Section.js +0 -1
- package/lib/module/ui/components/Section.js.map +1 -1
- package/lib/module/ui/components/SectionTitle.js +0 -1
- package/lib/module/ui/components/SectionTitle.js.map +1 -1
- package/lib/module/ui/components/icon/FAIRWalletIcon.js +0 -1
- package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +0 -1
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +0 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +4 -2
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.js +3 -3
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useAssets.js +257 -0
- package/lib/module/ui/hooks/useAssets.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +1 -1
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +0 -1
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +0 -1
- package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +633 -432
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +1 -1
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/UserLinksScreen.js +0 -1
- package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js +1 -1
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js +1 -1
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js +0 -1
- package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +0 -1
- package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js +0 -1
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +0 -1
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/stores/assetStore.js +212 -0
- package/lib/module/ui/stores/assetStore.js.map +1 -0
- package/lib/module/ui/stores/authStore.js +1 -1
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/stores/fileStore.js +145 -0
- package/lib/module/ui/stores/fileStore.js.map +1 -0
- package/lib/module/ui/stores/followStore.js +2 -2
- package/lib/module/ui/stores/followStore.js.map +1 -1
- package/lib/module/ui/styles/fonts.js.map +1 -1
- package/lib/module/ui/styles/theme.js.map +1 -1
- package/lib/module/utils/asyncUtils.js +1 -1
- package/lib/module/utils/asyncUtils.js.map +1 -1
- package/lib/module/utils/errorUtils.js +19 -11
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/hookUtils.js +1 -1
- package/lib/module/utils/hookUtils.js.map +1 -1
- package/lib/module/utils/loggerUtils.js.map +1 -1
- package/lib/module/utils/validationUtils.js +2 -2
- package/lib/module/utils/validationUtils.js.map +1 -1
- package/lib/typescript/assets/icons/OxyServices.d.ts +2 -2
- package/lib/typescript/assets/icons/OxyServices.d.ts.map +1 -1
- package/lib/typescript/assets/illustrations/HighFive.d.ts +1 -1
- package/lib/typescript/assets/illustrations/HighFive.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +68 -12
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/lib/sonner-safe.d.ts +2 -1
- package/lib/typescript/lib/sonner-safe.d.ts.map +1 -1
- package/lib/typescript/lib/sonner.d.ts +11 -3
- package/lib/typescript/lib/sonner.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +105 -6
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/types/expo-vector-icons.d.ts +8 -1
- package/lib/typescript/types/express.d.ts +22 -3
- package/lib/typescript/ui/components/Avatar.d.ts +2 -2
- package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
- package/lib/typescript/ui/components/FollowButton.d.ts +2 -2
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/FontLoader.d.ts +1 -1
- package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +2 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedSection.d.ts +2 -1
- package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
- package/lib/typescript/ui/components/Header.d.ts +1 -1
- package/lib/typescript/ui/components/Header.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyLogo.d.ts +2 -2
- package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyPayButton.d.ts +2 -2
- package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts +2 -2
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxySignInButton.d.ts +2 -2
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts +1 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -1
- package/lib/typescript/ui/components/QuickActions.d.ts +1 -1
- package/lib/typescript/ui/components/QuickActions.d.ts.map +1 -1
- package/lib/typescript/ui/components/Section.d.ts +1 -1
- package/lib/typescript/ui/components/Section.d.ts.map +1 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts +1 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +1 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts +1 -1
- package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +3 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useAssets.d.ts +35 -0
- package/lib/typescript/ui/hooks/useAssets.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts +2 -2
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +7 -7
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +1 -1
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/UserLinksScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/UserLinksScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/assetStore.d.ts +54 -0
- package/lib/typescript/ui/stores/assetStore.d.ts.map +1 -0
- package/lib/typescript/ui/stores/fileStore.d.ts +31 -0
- package/lib/typescript/ui/stores/fileStore.d.ts.map +1 -0
- package/lib/typescript/ui/stores/followStore.d.ts +1 -1
- package/lib/typescript/ui/stores/followStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/fonts.d.ts +1 -1
- package/lib/typescript/ui/styles/fonts.d.ts.map +1 -1
- package/lib/typescript/ui/styles/theme.d.ts +1 -1
- package/lib/typescript/ui/styles/theme.d.ts.map +1 -1
- package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
- package/lib/typescript/utils/errorUtils.d.ts +5 -5
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/utils/hookUtils.d.ts +4 -4
- package/lib/typescript/utils/hookUtils.d.ts.map +1 -1
- package/lib/typescript/utils/loggerUtils.d.ts +18 -18
- package/lib/typescript/utils/loggerUtils.d.ts.map +1 -1
- package/lib/typescript/utils/validationUtils.d.ts +6 -6
- package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
- package/package.json +149 -143
- package/src/assets/icons/OxyServices.tsx +2 -2
- package/src/assets/illustrations/HighFive.tsx +1 -1
- package/src/core/OxyServices.ts +264 -40
- package/src/core/__tests__/OxyServices.test.ts +180 -0
- package/src/index.ts +15 -1
- package/src/lib/sonner-safe.ts +4 -1
- package/src/lib/sonner.ts +19 -2
- package/src/models/interfaces.ts +117 -6
- package/src/types/expo-vector-icons.d.ts +8 -1
- package/src/types/express.d.ts +22 -3
- package/src/ui/components/Avatar.tsx +2 -2
- package/src/ui/components/FollowButton.tsx +10 -8
- package/src/ui/components/FontLoader.tsx +5 -3
- package/src/ui/components/GroupedItem.tsx +12 -2
- package/src/ui/components/GroupedSection.tsx +3 -1
- package/src/ui/components/Header.tsx +1 -1
- package/src/ui/components/OxyLogo.tsx +2 -2
- package/src/ui/components/OxyPayButton.tsx +6 -5
- package/src/ui/components/OxyProvider.tsx +7 -4
- package/src/ui/components/OxySignInButton.tsx +2 -2
- package/src/ui/components/ProfileCard.tsx +1 -1
- package/src/ui/components/QuickActions.tsx +1 -1
- package/src/ui/components/Section.tsx +1 -1
- package/src/ui/components/SectionTitle.tsx +1 -1
- package/src/ui/components/icon/FAIRWalletIcon.tsx +1 -1
- package/src/ui/components/icon/OxyIcon.tsx +1 -1
- package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
- package/src/ui/components/internal/PinInput.tsx +3 -2
- package/src/ui/components/internal/TextField.tsx +9 -11
- package/src/ui/context/OxyContext.tsx +3 -3
- package/src/ui/hooks/useAssets.ts +306 -0
- package/src/ui/navigation/OxyRouter.tsx +3 -2
- package/src/ui/navigation/types.ts +8 -8
- package/src/ui/screens/AccountCenterScreen.tsx +2 -2
- package/src/ui/screens/AccountManagementDemo.tsx +1 -1
- package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
- package/src/ui/screens/AccountSettingsScreen.tsx +3 -3
- package/src/ui/screens/AccountSwitcherScreen.tsx +9 -8
- package/src/ui/screens/AppInfoScreen.tsx +3 -2
- package/src/ui/screens/FeedbackScreen.tsx +1 -1
- package/src/ui/screens/FileManagementScreen.tsx +619 -494
- package/src/ui/screens/PaymentGatewayScreen.tsx +3 -2
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +3 -2
- package/src/ui/screens/ProfileScreen.tsx +3 -2
- package/src/ui/screens/RecoverAccountScreen.tsx +3 -2
- package/src/ui/screens/SessionManagementScreen.tsx +4 -3
- package/src/ui/screens/SignInScreen.tsx +3 -2
- package/src/ui/screens/SignUpScreen.tsx +1 -1
- package/src/ui/screens/UserLinksScreen.tsx +2 -2
- package/src/ui/screens/internal/SignInPasswordStep.tsx +3 -2
- package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -2
- package/src/ui/screens/internal/SignUpIdentityStep.tsx +3 -2
- package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -2
- package/src/ui/screens/internal/SignUpSummaryStep.tsx +1 -1
- package/src/ui/screens/internal/SignUpWelcomeStep.tsx +1 -1
- package/src/ui/screens/karma/KarmaAboutScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +3 -2
- package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +3 -2
- package/src/ui/screens/karma/KarmaRewardsScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +3 -2
- package/src/ui/stores/assetStore.ts +281 -0
- package/src/ui/stores/authStore.ts +1 -1
- package/src/ui/stores/fileStore.ts +118 -0
- package/src/ui/stores/followStore.ts +4 -4
- package/src/ui/styles/fonts.ts +1 -1
- package/src/ui/styles/theme.ts +1 -1
- package/src/utils/__tests__/validationUtils.test.ts +236 -0
- package/src/utils/asyncUtils.ts +4 -4
- package/src/utils/errorUtils.ts +35 -23
- package/src/utils/hookUtils.ts +7 -7
- package/src/utils/loggerUtils.ts +18 -18
- package/src/utils/validationUtils.ts +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
-
import { OxyServices } from '../../core';
|
|
2
|
+
import type { OxyServices } from '../../core';
|
|
3
3
|
|
|
4
4
|
interface FollowState {
|
|
5
5
|
followingUsers: Record<string, boolean>;
|
|
@@ -163,16 +163,16 @@ export const useFollowStore = create<FollowState>((set: any, get: any) => ({
|
|
|
163
163
|
set((state: FollowState) => ({
|
|
164
164
|
followerCounts: {
|
|
165
165
|
...state.followerCounts,
|
|
166
|
-
[userId]: user._count
|
|
166
|
+
[userId]: user._count?.followers || 0
|
|
167
167
|
},
|
|
168
168
|
followingCounts: {
|
|
169
169
|
...state.followingCounts,
|
|
170
|
-
[userId]: user._count
|
|
170
|
+
[userId]: user._count?.following || 0
|
|
171
171
|
},
|
|
172
172
|
loadingCounts: { ...state.loadingCounts, [userId]: false },
|
|
173
173
|
}));
|
|
174
174
|
}
|
|
175
|
-
} catch (error:
|
|
175
|
+
} catch (error: unknown) {
|
|
176
176
|
set((state: FollowState) => ({
|
|
177
177
|
loadingCounts: { ...state.loadingCounts, [userId]: false },
|
|
178
178
|
}));
|
package/src/ui/styles/fonts.ts
CHANGED
package/src/ui/styles/theme.ts
CHANGED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isRequiredString,
|
|
3
|
+
isRequiredNumber,
|
|
4
|
+
isRequiredBoolean,
|
|
5
|
+
isValidArray,
|
|
6
|
+
isValidObject,
|
|
7
|
+
isValidEmail,
|
|
8
|
+
isValidUsername,
|
|
9
|
+
isValidPassword,
|
|
10
|
+
isValidUUID,
|
|
11
|
+
isValidDate,
|
|
12
|
+
isValidFileSize,
|
|
13
|
+
isValidFileType,
|
|
14
|
+
sanitizeString,
|
|
15
|
+
sanitizeHTML,
|
|
16
|
+
validateAndSanitizeUserInput
|
|
17
|
+
} from '../validationUtils';
|
|
18
|
+
|
|
19
|
+
describe('Validation Utils', () => {
|
|
20
|
+
describe('isRequiredString', () => {
|
|
21
|
+
it('should return true for valid non-empty strings', () => {
|
|
22
|
+
expect(isRequiredString('hello')).toBe(true);
|
|
23
|
+
expect(isRequiredString(' hello ')).toBe(true); // trims whitespace
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should return false for invalid or empty strings', () => {
|
|
27
|
+
expect(isRequiredString('')).toBe(false);
|
|
28
|
+
expect(isRequiredString(' ')).toBe(false); // only whitespace
|
|
29
|
+
expect(isRequiredString(null)).toBe(false);
|
|
30
|
+
expect(isRequiredString(undefined)).toBe(false);
|
|
31
|
+
expect(isRequiredString(123)).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('isRequiredNumber', () => {
|
|
36
|
+
it('should return true for valid numbers', () => {
|
|
37
|
+
expect(isRequiredNumber(123)).toBe(true);
|
|
38
|
+
expect(isRequiredNumber(0)).toBe(true);
|
|
39
|
+
expect(isRequiredNumber(-456)).toBe(true);
|
|
40
|
+
expect(isRequiredNumber(3.14)).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should return false for invalid numbers', () => {
|
|
44
|
+
expect(isRequiredNumber(Number.NaN)).toBe(false);
|
|
45
|
+
expect(isRequiredNumber('123')).toBe(false);
|
|
46
|
+
expect(isRequiredNumber(null)).toBe(false);
|
|
47
|
+
expect(isRequiredNumber(undefined)).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('isRequiredBoolean', () => {
|
|
52
|
+
it('should return true for boolean values', () => {
|
|
53
|
+
expect(isRequiredBoolean(true)).toBe(true);
|
|
54
|
+
expect(isRequiredBoolean(false)).toBe(true);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should return false for non-boolean values', () => {
|
|
58
|
+
expect(isRequiredBoolean('true')).toBe(false);
|
|
59
|
+
expect(isRequiredBoolean(1)).toBe(false);
|
|
60
|
+
expect(isRequiredBoolean(0)).toBe(false);
|
|
61
|
+
expect(isRequiredBoolean(null)).toBe(false);
|
|
62
|
+
expect(isRequiredBoolean(undefined)).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('isValidArray', () => {
|
|
67
|
+
it('should return true for arrays', () => {
|
|
68
|
+
expect(isValidArray([])).toBe(true);
|
|
69
|
+
expect(isValidArray([1, 2, 3])).toBe(true);
|
|
70
|
+
expect(isValidArray(['a', 'b'])).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should return false for non-arrays', () => {
|
|
74
|
+
expect(isValidArray({})).toBe(false);
|
|
75
|
+
expect(isValidArray('[]')).toBe(false);
|
|
76
|
+
expect(isValidArray(null)).toBe(false);
|
|
77
|
+
expect(isValidArray(undefined)).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('isValidObject', () => {
|
|
82
|
+
it('should return true for plain objects', () => {
|
|
83
|
+
expect(isValidObject({})).toBe(true);
|
|
84
|
+
expect(isValidObject({ key: 'value' })).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should return false for non-objects', () => {
|
|
88
|
+
expect(isValidObject([])).toBe(false);
|
|
89
|
+
expect(isValidObject(null)).toBe(false);
|
|
90
|
+
expect(isValidObject(undefined)).toBe(false);
|
|
91
|
+
expect(isValidObject('object')).toBe(false);
|
|
92
|
+
expect(isValidObject(123)).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('isValidEmail', () => {
|
|
97
|
+
it('should return true for valid email addresses', () => {
|
|
98
|
+
expect(isValidEmail('test@example.com')).toBe(true);
|
|
99
|
+
expect(isValidEmail('user.name+tag@domain.co.uk')).toBe(true);
|
|
100
|
+
expect(isValidEmail('simple@test.io')).toBe(true);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should return false for invalid email addresses', () => {
|
|
104
|
+
expect(isValidEmail('invalid-email')).toBe(false);
|
|
105
|
+
expect(isValidEmail('test@')).toBe(false);
|
|
106
|
+
expect(isValidEmail('@domain.com')).toBe(false);
|
|
107
|
+
expect(isValidEmail('test.domain.com')).toBe(false);
|
|
108
|
+
expect(isValidEmail('')).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('isValidUsername', () => {
|
|
113
|
+
it('should return true for valid usernames', () => {
|
|
114
|
+
expect(isValidUsername('user123')).toBe(true);
|
|
115
|
+
expect(isValidUsername('test_user')).toBe(true);
|
|
116
|
+
expect(isValidUsername('john-doe')).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should return false for invalid usernames', () => {
|
|
120
|
+
expect(isValidUsername('')).toBe(false);
|
|
121
|
+
expect(isValidUsername('a')).toBe(false); // too short
|
|
122
|
+
expect(isValidUsername('ab')).toBe(false); // too short
|
|
123
|
+
expect(isValidUsername('user@domain')).toBe(false); // invalid characters
|
|
124
|
+
expect(isValidUsername('user with spaces')).toBe(false); // spaces
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
describe('isValidPassword', () => {
|
|
129
|
+
it('should return true for valid passwords', () => {
|
|
130
|
+
expect(isValidPassword('password123')).toBe(true);
|
|
131
|
+
expect(isValidPassword('mySecurePass')).toBe(true);
|
|
132
|
+
expect(isValidPassword('12345678')).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should return false for invalid passwords', () => {
|
|
136
|
+
expect(isValidPassword('')).toBe(false);
|
|
137
|
+
expect(isValidPassword('short')).toBe(false); // too short
|
|
138
|
+
expect(isValidPassword('1234567')).toBe(false); // too short
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe('isValidUUID', () => {
|
|
143
|
+
it('should return true for valid UUIDs', () => {
|
|
144
|
+
expect(isValidUUID('123e4567-e89b-12d3-a456-426614174000')).toBe(true);
|
|
145
|
+
expect(isValidUUID('550e8400-e29b-41d4-a716-446655440000')).toBe(true);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should return false for invalid UUIDs', () => {
|
|
149
|
+
expect(isValidUUID('invalid-uuid')).toBe(false);
|
|
150
|
+
expect(isValidUUID('123-456-789')).toBe(false);
|
|
151
|
+
expect(isValidUUID('')).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('isValidDate', () => {
|
|
156
|
+
it('should return true for valid date strings', () => {
|
|
157
|
+
expect(isValidDate('2024-01-01')).toBe(true);
|
|
158
|
+
expect(isValidDate('2024-12-31T23:59:59.999Z')).toBe(true);
|
|
159
|
+
expect(isValidDate('January 1, 2024')).toBe(true);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('should return false for invalid date strings', () => {
|
|
163
|
+
expect(isValidDate('invalid-date')).toBe(false);
|
|
164
|
+
expect(isValidDate('2024-13-01')).toBe(false); // invalid month
|
|
165
|
+
expect(isValidDate('')).toBe(false);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe('isValidFileSize', () => {
|
|
170
|
+
const maxSize = 1024 * 1024; // 1MB
|
|
171
|
+
|
|
172
|
+
it('should return true for valid file sizes', () => {
|
|
173
|
+
expect(isValidFileSize(1024, maxSize)).toBe(true);
|
|
174
|
+
expect(isValidFileSize(maxSize, maxSize)).toBe(true);
|
|
175
|
+
expect(isValidFileSize(1, maxSize)).toBe(true);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('should return false for invalid file sizes', () => {
|
|
179
|
+
expect(isValidFileSize(0, maxSize)).toBe(false);
|
|
180
|
+
expect(isValidFileSize(-1, maxSize)).toBe(false);
|
|
181
|
+
expect(isValidFileSize(maxSize + 1, maxSize)).toBe(false);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe('isValidFileType', () => {
|
|
186
|
+
const allowedTypes = ['jpg', 'png', 'gif', 'pdf'];
|
|
187
|
+
|
|
188
|
+
it('should return true for allowed file types', () => {
|
|
189
|
+
expect(isValidFileType('image.jpg', allowedTypes)).toBe(true);
|
|
190
|
+
expect(isValidFileType('document.PDF', allowedTypes)).toBe(true); // case insensitive
|
|
191
|
+
expect(isValidFileType('photo.png', allowedTypes)).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it('should return false for disallowed file types', () => {
|
|
195
|
+
expect(isValidFileType('script.js', allowedTypes)).toBe(false);
|
|
196
|
+
expect(isValidFileType('data.txt', allowedTypes)).toBe(false);
|
|
197
|
+
expect(isValidFileType('noextension', allowedTypes)).toBe(false);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('sanitizeString', () => {
|
|
202
|
+
it('should trim whitespace and remove dangerous characters', () => {
|
|
203
|
+
expect(sanitizeString(' hello ')).toBe('hello');
|
|
204
|
+
expect(sanitizeString('hello<script>alert("xss")</script>world')).toBe('helloalert("xss")world');
|
|
205
|
+
expect(sanitizeString('normal text')).toBe('normal text');
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
describe('sanitizeHTML', () => {
|
|
210
|
+
it('should escape HTML characters', () => {
|
|
211
|
+
expect(sanitizeHTML('<script>alert("xss")</script>')).toBe('<script>alert("xss")</script>');
|
|
212
|
+
expect(sanitizeHTML('Hello & Goodbye')).toBe('Hello & Goodbye');
|
|
213
|
+
expect(sanitizeHTML("It's a test")).toBe('It's a test');
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
describe('validateAndSanitizeUserInput', () => {
|
|
218
|
+
it('should validate and sanitize email input', () => {
|
|
219
|
+
expect(validateAndSanitizeUserInput(' test@example.com ', 'email')).toBe('test@example.com');
|
|
220
|
+
expect(validateAndSanitizeUserInput('invalid-email', 'email')).toBeNull();
|
|
221
|
+
expect(validateAndSanitizeUserInput(123, 'email')).toBeNull();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('should validate and sanitize username input', () => {
|
|
225
|
+
expect(validateAndSanitizeUserInput(' testuser ', 'username')).toBe('testuser');
|
|
226
|
+
expect(validateAndSanitizeUserInput('ab', 'username')).toBeNull(); // too short
|
|
227
|
+
expect(validateAndSanitizeUserInput(123, 'username')).toBeNull();
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('should validate and sanitize string input', () => {
|
|
231
|
+
expect(validateAndSanitizeUserInput(' hello world ', 'string')).toBe('hello world');
|
|
232
|
+
expect(validateAndSanitizeUserInput('', 'string')).toBeNull();
|
|
233
|
+
expect(validateAndSanitizeUserInput(123, 'string')).toBeNull();
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
});
|
package/src/utils/asyncUtils.ts
CHANGED
|
@@ -45,8 +45,8 @@ export async function parallelWithErrorHandling<T>(
|
|
|
45
45
|
*/
|
|
46
46
|
export async function retryAsync<T>(
|
|
47
47
|
operation: () => Promise<T>,
|
|
48
|
-
maxRetries
|
|
49
|
-
baseDelay
|
|
48
|
+
maxRetries = 3,
|
|
49
|
+
baseDelay = 1000,
|
|
50
50
|
shouldRetry?: (error: any) => boolean
|
|
51
51
|
): Promise<T> {
|
|
52
52
|
let lastError: any;
|
|
@@ -81,7 +81,7 @@ export function debounceAsync<T extends (...args: any[]) => Promise<any>>(
|
|
|
81
81
|
delay: number
|
|
82
82
|
): (...args: Parameters<T>) => Promise<ReturnType<T>> {
|
|
83
83
|
let timeoutId: NodeJS.Timeout;
|
|
84
|
-
|
|
84
|
+
const lastPromise: Promise<ReturnType<T>> | null = null;
|
|
85
85
|
|
|
86
86
|
return (...args: Parameters<T>): Promise<ReturnType<T>> => {
|
|
87
87
|
return new Promise((resolve, reject) => {
|
|
@@ -256,7 +256,7 @@ export const delay = (ms: number): Promise<void> =>
|
|
|
256
256
|
export async function retryOnError<T>(
|
|
257
257
|
operation: () => Promise<T>,
|
|
258
258
|
retryableErrors: (string | number)[],
|
|
259
|
-
maxRetries
|
|
259
|
+
maxRetries = 3
|
|
260
260
|
): Promise<T> {
|
|
261
261
|
return retryAsync(operation, maxRetries, 1000, (error) => {
|
|
262
262
|
const errorCode = error?.code || error?.status || error?.message;
|
package/src/utils/errorUtils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiError } from '../models/interfaces';
|
|
1
|
+
import type { ApiError } from '../models/interfaces';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Error handling utilities for consistent error processing
|
|
@@ -40,8 +40,8 @@ export const ErrorCodes = {
|
|
|
40
40
|
export function createApiError(
|
|
41
41
|
message: string,
|
|
42
42
|
code: string = ErrorCodes.INTERNAL_ERROR,
|
|
43
|
-
status
|
|
44
|
-
details?:
|
|
43
|
+
status = 500,
|
|
44
|
+
details?: Record<string, unknown>
|
|
45
45
|
): ApiError {
|
|
46
46
|
return {
|
|
47
47
|
message,
|
|
@@ -54,26 +54,29 @@ export function createApiError(
|
|
|
54
54
|
/**
|
|
55
55
|
* Handle common HTTP errors and convert to ApiError
|
|
56
56
|
*/
|
|
57
|
-
export function handleHttpError(error:
|
|
57
|
+
export function handleHttpError(error: unknown): ApiError {
|
|
58
58
|
// If it's already an ApiError, return it
|
|
59
59
|
if (error && typeof error === 'object' && 'code' in error && 'status' in error) {
|
|
60
60
|
return error as ApiError;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Handle axios errors
|
|
64
|
-
if (error
|
|
65
|
-
const { status
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
// Handle axios errors - check if it looks like an axios error
|
|
64
|
+
if (error && typeof error === 'object' && 'response' in error) {
|
|
65
|
+
const axiosError = error as { response?: { status: number; data?: { message?: string; code?: string } } };
|
|
66
|
+
if (axiosError.response) {
|
|
67
|
+
const { status, data } = axiosError.response;
|
|
68
|
+
|
|
69
|
+
return createApiError(
|
|
70
|
+
data?.message || `HTTP ${status} error`,
|
|
71
|
+
data?.code || getErrorCodeFromStatus(status),
|
|
72
|
+
status,
|
|
73
|
+
data
|
|
74
|
+
);
|
|
75
|
+
}
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
// Handle network errors
|
|
76
|
-
if (error
|
|
78
|
+
// Handle network errors - check if it looks like a network error
|
|
79
|
+
if (error && typeof error === 'object' && 'request' in error) {
|
|
77
80
|
return createApiError(
|
|
78
81
|
'Network error - no response received',
|
|
79
82
|
ErrorCodes.NETWORK_ERROR,
|
|
@@ -81,9 +84,18 @@ export function handleHttpError(error: any): ApiError {
|
|
|
81
84
|
);
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
// Handle standard errors
|
|
88
|
+
if (error instanceof Error) {
|
|
89
|
+
return createApiError(
|
|
90
|
+
error.message || 'Unknown error occurred',
|
|
91
|
+
ErrorCodes.INTERNAL_ERROR,
|
|
92
|
+
500
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
// Handle other errors
|
|
85
97
|
return createApiError(
|
|
86
|
-
error
|
|
98
|
+
String(error) || 'Unknown error occurred',
|
|
87
99
|
ErrorCodes.INTERNAL_ERROR,
|
|
88
100
|
500
|
|
89
101
|
);
|
|
@@ -118,7 +130,7 @@ function getErrorCodeFromStatus(status: number): string {
|
|
|
118
130
|
/**
|
|
119
131
|
* Validate required fields and throw error if missing
|
|
120
132
|
*/
|
|
121
|
-
export function validateRequiredFields(data: Record<string,
|
|
133
|
+
export function validateRequiredFields(data: Record<string, unknown>, fields: string[]): void {
|
|
122
134
|
const missing = fields.filter(field => !data[field]);
|
|
123
135
|
|
|
124
136
|
if (missing.length > 0) {
|
|
@@ -133,7 +145,7 @@ export function validateRequiredFields(data: Record<string, any>, fields: string
|
|
|
133
145
|
/**
|
|
134
146
|
* Safe error logging with context
|
|
135
147
|
*/
|
|
136
|
-
export function logError(error:
|
|
148
|
+
export function logError(error: unknown, context?: string): void {
|
|
137
149
|
const prefix = context ? `[${context}]` : '[Error]';
|
|
138
150
|
|
|
139
151
|
if (error instanceof Error) {
|
|
@@ -148,10 +160,10 @@ export function logError(error: any, context?: string): void {
|
|
|
148
160
|
*/
|
|
149
161
|
export async function retryWithBackoff<T>(
|
|
150
162
|
fn: () => Promise<T>,
|
|
151
|
-
maxRetries
|
|
152
|
-
baseDelay
|
|
163
|
+
maxRetries = 3,
|
|
164
|
+
baseDelay = 1000
|
|
153
165
|
): Promise<T> {
|
|
154
|
-
let lastError:
|
|
166
|
+
let lastError: unknown;
|
|
155
167
|
|
|
156
168
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
157
169
|
try {
|
|
@@ -163,7 +175,7 @@ export async function retryWithBackoff<T>(
|
|
|
163
175
|
break;
|
|
164
176
|
}
|
|
165
177
|
|
|
166
|
-
const delay = baseDelay *
|
|
178
|
+
const delay = baseDelay * 2 ** attempt;
|
|
167
179
|
await new Promise(resolve => setTimeout(resolve, delay));
|
|
168
180
|
}
|
|
169
181
|
}
|
package/src/utils/hookUtils.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
|
9
9
|
*/
|
|
10
10
|
export function useAsync<T>(
|
|
11
11
|
asyncFn: () => Promise<T>,
|
|
12
|
-
deps:
|
|
12
|
+
deps: React.DependencyList = []
|
|
13
13
|
) {
|
|
14
14
|
const [data, setData] = useState<T | null>(null);
|
|
15
15
|
const [loading, setLoading] = useState(false);
|
|
@@ -40,7 +40,7 @@ export function useAsync<T>(
|
|
|
40
40
|
*/
|
|
41
41
|
export function useAsyncEffect<T>(
|
|
42
42
|
asyncFn: () => Promise<T>,
|
|
43
|
-
deps:
|
|
43
|
+
deps: React.DependencyList = []
|
|
44
44
|
) {
|
|
45
45
|
const [data, setData] = useState<T | null>(null);
|
|
46
46
|
const [loading, setLoading] = useState(true);
|
|
@@ -121,7 +121,7 @@ export function useThrottle<T>(value: T, delay: number): T {
|
|
|
121
121
|
* Hook for previous value
|
|
122
122
|
*/
|
|
123
123
|
export function usePrevious<T>(value: T): T | undefined {
|
|
124
|
-
const ref = useRef<T>();
|
|
124
|
+
const ref = useRef<T | undefined>(undefined);
|
|
125
125
|
|
|
126
126
|
useEffect(() => {
|
|
127
127
|
ref.current = value;
|
|
@@ -133,7 +133,7 @@ export function usePrevious<T>(value: T): T | undefined {
|
|
|
133
133
|
/**
|
|
134
134
|
* Hook for boolean state with toggle
|
|
135
135
|
*/
|
|
136
|
-
export function useToggle(initialValue
|
|
136
|
+
export function useToggle(initialValue = false) {
|
|
137
137
|
const [value, setValue] = useState(initialValue);
|
|
138
138
|
|
|
139
139
|
const toggle = useCallback(() => setValue(v => !v), []);
|
|
@@ -146,7 +146,7 @@ export function useToggle(initialValue: boolean = false) {
|
|
|
146
146
|
/**
|
|
147
147
|
* Hook for counter state
|
|
148
148
|
*/
|
|
149
|
-
export function useCounter(initialValue
|
|
149
|
+
export function useCounter(initialValue = 0) {
|
|
150
150
|
const [count, setCount] = useState(initialValue);
|
|
151
151
|
|
|
152
152
|
const increment = useCallback(() => setCount(c => c + 1), []);
|
|
@@ -352,7 +352,7 @@ export function useClickOutside(ref: React.RefObject<HTMLElement>, handler: () =
|
|
|
352
352
|
/**
|
|
353
353
|
* Hook for form validation
|
|
354
354
|
*/
|
|
355
|
-
export function useFormValidation<T extends Record<string,
|
|
355
|
+
export function useFormValidation<T extends Record<string, unknown>>(
|
|
356
356
|
initialValues: T,
|
|
357
357
|
validationSchema: (values: T) => Partial<Record<keyof T, string>>
|
|
358
358
|
) {
|
|
@@ -364,7 +364,7 @@ export function useFormValidation<T extends Record<string, any>>(
|
|
|
364
364
|
return validationSchema(valuesToValidate);
|
|
365
365
|
}, [validationSchema]);
|
|
366
366
|
|
|
367
|
-
const setValue = useCallback((field: keyof T, value:
|
|
367
|
+
const setValue = useCallback((field: keyof T, value: T[keyof T]) => {
|
|
368
368
|
setValues(prev => ({ ...prev, [field]: value }));
|
|
369
369
|
if (touched[field]) {
|
|
370
370
|
const newErrors = validate({ ...values, [field]: value });
|
package/src/utils/loggerUtils.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface LogContext {
|
|
|
16
16
|
userId?: string;
|
|
17
17
|
sessionId?: string;
|
|
18
18
|
requestId?: string;
|
|
19
|
-
[key: string]:
|
|
19
|
+
[key: string]: unknown;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
class Logger {
|
|
@@ -37,7 +37,7 @@ class Logger {
|
|
|
37
37
|
return `[${timestamp}] ${level}${contextStr}: ${message}`;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
debug(message: string, context?: LogContext, ...args:
|
|
40
|
+
debug(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
41
41
|
if (this.shouldLog(LogLevel.DEBUG)) {
|
|
42
42
|
const formattedMessage = this.formatMessage('DEBUG', message, context);
|
|
43
43
|
if (this.isDevelopment) {
|
|
@@ -46,21 +46,21 @@ class Logger {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
info(message: string, context?: LogContext, ...args:
|
|
49
|
+
info(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
50
50
|
if (this.shouldLog(LogLevel.INFO)) {
|
|
51
51
|
const formattedMessage = this.formatMessage('INFO', message, context);
|
|
52
52
|
console.log(formattedMessage, ...args);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
warn(message: string, context?: LogContext, ...args:
|
|
56
|
+
warn(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
57
57
|
if (this.shouldLog(LogLevel.WARN)) {
|
|
58
58
|
const formattedMessage = this.formatMessage('WARN', message, context);
|
|
59
59
|
console.warn(formattedMessage, ...args);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
error(message: string, error?:
|
|
63
|
+
error(message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]): void {
|
|
64
64
|
if (this.shouldLog(LogLevel.ERROR)) {
|
|
65
65
|
const formattedMessage = this.formatMessage('ERROR', message, context);
|
|
66
66
|
if (error) {
|
|
@@ -72,27 +72,27 @@ class Logger {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// Specialized logging methods for common patterns
|
|
75
|
-
auth(message: string, context?: LogContext, ...args:
|
|
75
|
+
auth(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
76
76
|
this.info(`🔐 ${message}`, { ...context, category: 'auth' }, ...args);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
api(message: string, context?: LogContext, ...args:
|
|
79
|
+
api(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
80
80
|
this.info(`🌐 ${message}`, { ...context, category: 'api' }, ...args);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
session(message: string, context?: LogContext, ...args:
|
|
83
|
+
session(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
84
84
|
this.info(`📱 ${message}`, { ...context, category: 'session' }, ...args);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
user(message: string, context?: LogContext, ...args:
|
|
87
|
+
user(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
88
88
|
this.info(`👤 ${message}`, { ...context, category: 'user' }, ...args);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
device(message: string, context?: LogContext, ...args:
|
|
91
|
+
device(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
92
92
|
this.info(`📱 ${message}`, { ...context, category: 'device' }, ...args);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
payment(message: string, context?: LogContext, ...args:
|
|
95
|
+
payment(message: string, context?: LogContext, ...args: unknown[]): void {
|
|
96
96
|
this.info(`💳 ${message}`, { ...context, category: 'payment' }, ...args);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -128,25 +128,25 @@ class Logger {
|
|
|
128
128
|
export const logger = new Logger();
|
|
129
129
|
|
|
130
130
|
// Convenience functions for common logging patterns
|
|
131
|
-
export const logAuth = (message: string, context?: LogContext, ...args:
|
|
131
|
+
export const logAuth = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
132
132
|
logger.auth(message, context, ...args);
|
|
133
133
|
|
|
134
|
-
export const logApi = (message: string, context?: LogContext, ...args:
|
|
134
|
+
export const logApi = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
135
135
|
logger.api(message, context, ...args);
|
|
136
136
|
|
|
137
|
-
export const logSession = (message: string, context?: LogContext, ...args:
|
|
137
|
+
export const logSession = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
138
138
|
logger.session(message, context, ...args);
|
|
139
139
|
|
|
140
|
-
export const logUser = (message: string, context?: LogContext, ...args:
|
|
140
|
+
export const logUser = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
141
141
|
logger.user(message, context, ...args);
|
|
142
142
|
|
|
143
|
-
export const logDevice = (message: string, context?: LogContext, ...args:
|
|
143
|
+
export const logDevice = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
144
144
|
logger.device(message, context, ...args);
|
|
145
145
|
|
|
146
|
-
export const logPayment = (message: string, context?: LogContext, ...args:
|
|
146
|
+
export const logPayment = (message: string, context?: LogContext, ...args: unknown[]) =>
|
|
147
147
|
logger.payment(message, context, ...args);
|
|
148
148
|
|
|
149
|
-
export const logError = (message: string, error?:
|
|
149
|
+
export const logError = (message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]) =>
|
|
150
150
|
logger.error(message, error, context, ...args);
|
|
151
151
|
|
|
152
152
|
export const logPerformance = (operation: string, duration: number, context?: LogContext) =>
|
|
@@ -41,35 +41,35 @@ export function isValidPassword(password: string): boolean {
|
|
|
41
41
|
/**
|
|
42
42
|
* Validate required string
|
|
43
43
|
*/
|
|
44
|
-
export function isRequiredString(value:
|
|
44
|
+
export function isRequiredString(value: unknown): boolean {
|
|
45
45
|
return typeof value === 'string' && value.trim().length > 0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Validate required number
|
|
50
50
|
*/
|
|
51
|
-
export function isRequiredNumber(value:
|
|
52
|
-
return typeof value === 'number' && !isNaN(value);
|
|
51
|
+
export function isRequiredNumber(value: unknown): boolean {
|
|
52
|
+
return typeof value === 'number' && !Number.isNaN(value);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Validate required boolean
|
|
57
57
|
*/
|
|
58
|
-
export function isRequiredBoolean(value:
|
|
58
|
+
export function isRequiredBoolean(value: unknown): boolean {
|
|
59
59
|
return typeof value === 'boolean';
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Validate array
|
|
64
64
|
*/
|
|
65
|
-
export function isValidArray(value:
|
|
65
|
+
export function isValidArray(value: unknown): boolean {
|
|
66
66
|
return Array.isArray(value);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Validate object
|
|
71
71
|
*/
|
|
72
|
-
export function isValidObject(value:
|
|
72
|
+
export function isValidObject(value: unknown): boolean {
|
|
73
73
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -98,7 +98,7 @@ export function isValidURL(url: string): boolean {
|
|
|
98
98
|
*/
|
|
99
99
|
export function isValidDate(dateString: string): boolean {
|
|
100
100
|
const date = new Date(dateString);
|
|
101
|
-
return !isNaN(date.getTime());
|
|
101
|
+
return !Number.isNaN(date.getTime());
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
@@ -138,7 +138,7 @@ export function sanitizeHTML(input: string): string {
|
|
|
138
138
|
/**
|
|
139
139
|
* Validate and sanitize user input
|
|
140
140
|
*/
|
|
141
|
-
export function validateAndSanitizeUserInput(input:
|
|
141
|
+
export function validateAndSanitizeUserInput(input: unknown, type: 'string' | 'email' | 'username'): string | null {
|
|
142
142
|
if (typeof input !== 'string') {
|
|
143
143
|
return null;
|
|
144
144
|
}
|