@oxyhq/services 5.10.15 → 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 +604 -127
- 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 +244 -26
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +7 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +93 -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/node/index.js +7 -0
- package/lib/commonjs/node/index.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 +243 -25
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +1 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +3 -1
- 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/node/index.js +2 -2
- package/lib/module/node/index.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 +69 -12
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +1 -1
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -2
- 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/node/index.d.ts +2 -2
- package/lib/typescript/node/index.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 +268 -41
- package/src/core/__tests__/OxyServices.test.ts +180 -0
- package/src/core/index.ts +1 -1
- package/src/index.ts +16 -2
- package/src/lib/sonner-safe.ts +4 -1
- package/src/lib/sonner.ts +19 -2
- package/src/models/interfaces.ts +117 -6
- package/src/node/index.ts +2 -2
- 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
package/src/core/OxyServices.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
|
|
1
|
+
import axios, { type AxiosInstance, type InternalAxiosRequestConfig } from 'axios';
|
|
2
2
|
import { jwtDecode } from 'jwt-decode';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
OxyConfig,
|
|
5
|
+
ApiError,
|
|
6
|
+
User,
|
|
7
|
+
Notification,
|
|
8
|
+
AssetInitResponse,
|
|
9
|
+
AssetUrlResponse,
|
|
10
|
+
AssetVariant
|
|
11
|
+
} from '../models/interfaces';
|
|
12
|
+
import type { SessionLoginResponse } from '../models/session';
|
|
5
13
|
import { handleHttpError } from '../utils/errorUtils';
|
|
6
|
-
import { buildSearchParams, buildPaginationParams, PaginationParams } from '../utils/apiUtils';
|
|
14
|
+
import { buildSearchParams, buildPaginationParams, type PaginationParams } from '../utils/apiUtils';
|
|
7
15
|
|
|
8
16
|
interface JwtPayload {
|
|
9
17
|
exp?: number;
|
|
@@ -20,7 +28,7 @@ export class OxyAuthenticationError extends Error {
|
|
|
20
28
|
public readonly code: string;
|
|
21
29
|
public readonly status: number;
|
|
22
30
|
|
|
23
|
-
constructor(message: string, code
|
|
31
|
+
constructor(message: string, code = 'AUTH_ERROR', status = 401) {
|
|
24
32
|
super(message);
|
|
25
33
|
this.name = 'OxyAuthenticationError';
|
|
26
34
|
this.code = code;
|
|
@@ -60,7 +68,7 @@ class TokenStore {
|
|
|
60
68
|
return TokenStore.instance;
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
setTokens(accessToken: string, refreshToken
|
|
71
|
+
setTokens(accessToken: string, refreshToken = ''): void {
|
|
64
72
|
this.accessToken = accessToken;
|
|
65
73
|
this.refreshToken = refreshToken;
|
|
66
74
|
}
|
|
@@ -194,7 +202,7 @@ export class OxyServices {
|
|
|
194
202
|
/**
|
|
195
203
|
* Set authentication tokens
|
|
196
204
|
*/
|
|
197
|
-
public setTokens(accessToken: string, refreshToken
|
|
205
|
+
public setTokens(accessToken: string, refreshToken = ''): void {
|
|
198
206
|
this.tokenStore.setTokens(accessToken, refreshToken);
|
|
199
207
|
}
|
|
200
208
|
|
|
@@ -236,18 +244,25 @@ export class OxyServices {
|
|
|
236
244
|
return this.tokenStore.hasAccessToken();
|
|
237
245
|
}
|
|
238
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Get the raw access token (for constructing anchor URLs when needed)
|
|
249
|
+
*/
|
|
250
|
+
public getAccessToken(): string | null {
|
|
251
|
+
return this.tokenStore.getAccessToken();
|
|
252
|
+
}
|
|
253
|
+
|
|
239
254
|
/**
|
|
240
255
|
* Wait for authentication to be ready (public method)
|
|
241
256
|
* Useful for apps that want to ensure authentication is complete before proceeding
|
|
242
257
|
*/
|
|
243
|
-
public async waitForAuth(timeoutMs
|
|
258
|
+
public async waitForAuth(timeoutMs = 5000): Promise<boolean> {
|
|
244
259
|
return this.waitForAuthentication(timeoutMs);
|
|
245
260
|
}
|
|
246
261
|
|
|
247
262
|
/**
|
|
248
263
|
* Wait for authentication to be ready with timeout
|
|
249
264
|
*/
|
|
250
|
-
private async waitForAuthentication(timeoutMs
|
|
265
|
+
private async waitForAuthentication(timeoutMs = 5000): Promise<boolean> {
|
|
251
266
|
const startTime = Date.now();
|
|
252
267
|
const checkInterval = 100; // Check every 100ms
|
|
253
268
|
|
|
@@ -940,7 +955,8 @@ export class OxyServices {
|
|
|
940
955
|
*/
|
|
941
956
|
async deleteFile(fileId: string): Promise<any> {
|
|
942
957
|
try {
|
|
943
|
-
|
|
958
|
+
// Central Asset Service delete with force=true behavior controlled by caller via assetDelete
|
|
959
|
+
const res = await this.client.delete(`/api/assets/${encodeURIComponent(fileId)}`);
|
|
944
960
|
return res.data;
|
|
945
961
|
} catch (error) {
|
|
946
962
|
throw this.handleError(error);
|
|
@@ -950,8 +966,16 @@ export class OxyServices {
|
|
|
950
966
|
/**
|
|
951
967
|
* Get file download URL
|
|
952
968
|
*/
|
|
953
|
-
getFileDownloadUrl(fileId: string): string {
|
|
954
|
-
|
|
969
|
+
getFileDownloadUrl(fileId: string, variant?: string, expiresIn?: number): string {
|
|
970
|
+
// Default to streaming proxy to avoid ORB; attach token via query for <img src>
|
|
971
|
+
const base = this.getBaseURL();
|
|
972
|
+
const params = new URLSearchParams();
|
|
973
|
+
if (variant) params.set('variant', variant);
|
|
974
|
+
// Request a visible server-side placeholder if object is missing
|
|
975
|
+
params.set('fallback', 'placeholderVisible');
|
|
976
|
+
const token = this.tokenStore.getAccessToken();
|
|
977
|
+
if (token) params.set('token', token);
|
|
978
|
+
return `${base}/api/assets/${encodeURIComponent(fileId)}/stream${params.size ? `?${params.toString()}` : ''}`;
|
|
955
979
|
}
|
|
956
980
|
|
|
957
981
|
/**
|
|
@@ -964,37 +988,181 @@ export class OxyServices {
|
|
|
964
988
|
/**
|
|
965
989
|
* List user files
|
|
966
990
|
*/
|
|
967
|
-
async listUserFiles(
|
|
968
|
-
userId: string,
|
|
969
|
-
limit?: number,
|
|
970
|
-
offset?: number,
|
|
971
|
-
filters?: Record<string, any>
|
|
972
|
-
): Promise<any> {
|
|
991
|
+
async listUserFiles(limit?: number, offset?: number): Promise<{ files: any[]; total: number; hasMore: boolean }> {
|
|
973
992
|
try {
|
|
974
993
|
const params = new URLSearchParams();
|
|
975
|
-
if (limit) params.append('limit', limit
|
|
976
|
-
if (offset) params.append('offset', offset
|
|
994
|
+
if (limit) params.append('limit', String(limit));
|
|
995
|
+
if (offset) params.append('offset', String(offset));
|
|
996
|
+
const res = await this.client.get(`/api/assets${params.size ? `?${params.toString()}` : ''}`);
|
|
997
|
+
return res.data;
|
|
998
|
+
} catch (error) {
|
|
999
|
+
throw this.handleError(error);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
// (removed legacy downloadFileContent; use getFileContentAsBlob/Text which resolve CAS URL first)
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Get file content as text
|
|
1007
|
+
*/
|
|
1008
|
+
async getFileContentAsText(fileId: string, variant?: string): Promise<string> {
|
|
1009
|
+
try {
|
|
1010
|
+
const urlRes = await this.client.get(`/api/assets/${encodeURIComponent(fileId)}/url${variant ? `?variant=${encodeURIComponent(variant)}` : ''}`);
|
|
1011
|
+
const downloadUrl = urlRes.data?.url;
|
|
1012
|
+
const response = await fetch(downloadUrl);
|
|
1013
|
+
return await response.text();
|
|
1014
|
+
} catch (error) {
|
|
1015
|
+
throw this.handleError(error);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Get file content as blob
|
|
1021
|
+
*/
|
|
1022
|
+
async getFileContentAsBlob(fileId: string, variant?: string): Promise<Blob> {
|
|
1023
|
+
try {
|
|
1024
|
+
const urlRes = await this.client.get(`/api/assets/${encodeURIComponent(fileId)}/url${variant ? `?variant=${encodeURIComponent(variant)}` : ''}`);
|
|
1025
|
+
const downloadUrl = urlRes.data?.url;
|
|
1026
|
+
const response = await fetch(downloadUrl);
|
|
1027
|
+
return await response.blob();
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
throw this.handleError(error);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Upload raw file data
|
|
1035
|
+
*/
|
|
1036
|
+
async uploadRawFile(file: File | Blob, metadata?: Record<string, any>): Promise<any> {
|
|
1037
|
+
// Switch to Central Asset Service upload flow
|
|
1038
|
+
return this.assetUpload(file as File, metadata);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// ============================================================================
|
|
1042
|
+
// CENTRAL ASSET SERVICE METHODS
|
|
1043
|
+
// ============================================================================
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Calculate SHA256 hash of file content
|
|
1047
|
+
*/
|
|
1048
|
+
async calculateSHA256(file: File | Blob): Promise<string> {
|
|
1049
|
+
const buffer = await file.arrayBuffer();
|
|
1050
|
+
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
|
|
1051
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
1052
|
+
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Initialize asset upload - returns pre-signed URL and file ID
|
|
1057
|
+
*/
|
|
1058
|
+
async assetInit(sha256: string, size: number, mime: string): Promise<AssetInitResponse> {
|
|
1059
|
+
try {
|
|
1060
|
+
const res = await this.client.post('/api/assets/init', {
|
|
1061
|
+
sha256,
|
|
1062
|
+
size,
|
|
1063
|
+
mime
|
|
1064
|
+
});
|
|
1065
|
+
return res.data;
|
|
1066
|
+
} catch (error) {
|
|
1067
|
+
throw this.handleError(error);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Complete asset upload - commit metadata and trigger variant generation
|
|
1073
|
+
*/
|
|
1074
|
+
async assetComplete(fileId: string, originalName: string, size: number, mime: string, metadata?: Record<string, any>): Promise<any> {
|
|
1075
|
+
try {
|
|
1076
|
+
const res = await this.client.post('/api/assets/complete', {
|
|
1077
|
+
fileId,
|
|
1078
|
+
originalName,
|
|
1079
|
+
size,
|
|
1080
|
+
mime,
|
|
1081
|
+
metadata
|
|
1082
|
+
});
|
|
1083
|
+
return res.data;
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
throw this.handleError(error);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Upload file using Central Asset Service
|
|
1091
|
+
*/
|
|
1092
|
+
async assetUpload(file: File, metadata?: Record<string, any>, onProgress?: (progress: number) => void): Promise<any> {
|
|
1093
|
+
try {
|
|
1094
|
+
// Calculate SHA256
|
|
1095
|
+
const sha256 = await this.calculateSHA256(file);
|
|
977
1096
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1097
|
+
// Initialize upload
|
|
1098
|
+
const initResponse = await this.assetInit(sha256, file.size, file.type);
|
|
1099
|
+
|
|
1100
|
+
// Try presigned URL first
|
|
1101
|
+
try {
|
|
1102
|
+
await this.uploadToPresignedUrl(initResponse.uploadUrl, file, onProgress);
|
|
1103
|
+
} catch (e) {
|
|
1104
|
+
// Fallback: direct upload via API to avoid CORS issues
|
|
1105
|
+
const fd = new FormData();
|
|
1106
|
+
fd.append('file', file);
|
|
1107
|
+
await this.client.post(`/api/assets/${encodeURIComponent(initResponse.fileId)}/upload-direct`, fd, {
|
|
1108
|
+
headers: { 'Content-Type': 'multipart/form-data' }
|
|
981
1109
|
});
|
|
982
1110
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
return
|
|
1111
|
+
|
|
1112
|
+
// Complete upload
|
|
1113
|
+
return await this.assetComplete(
|
|
1114
|
+
initResponse.fileId,
|
|
1115
|
+
file.name,
|
|
1116
|
+
file.size,
|
|
1117
|
+
file.type,
|
|
1118
|
+
metadata
|
|
1119
|
+
);
|
|
986
1120
|
} catch (error) {
|
|
987
1121
|
throw this.handleError(error);
|
|
988
1122
|
}
|
|
989
1123
|
}
|
|
990
1124
|
|
|
991
1125
|
/**
|
|
992
|
-
*
|
|
1126
|
+
* Upload file to pre-signed URL
|
|
1127
|
+
*/
|
|
1128
|
+
private async uploadToPresignedUrl(url: string, file: File, onProgress?: (progress: number) => void): Promise<void> {
|
|
1129
|
+
return new Promise((resolve, reject) => {
|
|
1130
|
+
const xhr = new XMLHttpRequest();
|
|
1131
|
+
|
|
1132
|
+
xhr.upload.addEventListener('progress', (event) => {
|
|
1133
|
+
if (event.lengthComputable && onProgress) {
|
|
1134
|
+
const progress = (event.loaded / event.total) * 100;
|
|
1135
|
+
onProgress(progress);
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
|
|
1139
|
+
xhr.addEventListener('load', () => {
|
|
1140
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
1141
|
+
resolve();
|
|
1142
|
+
} else {
|
|
1143
|
+
reject(new Error(`Upload failed with status ${xhr.status}`));
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
xhr.addEventListener('error', () => {
|
|
1148
|
+
reject(new Error('Upload failed'));
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
xhr.open('PUT', url);
|
|
1152
|
+
xhr.setRequestHeader('Content-Type', file.type);
|
|
1153
|
+
xhr.send(file);
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Link asset to an entity
|
|
993
1159
|
*/
|
|
994
|
-
async
|
|
1160
|
+
async assetLink(fileId: string, app: string, entityType: string, entityId: string): Promise<any> {
|
|
995
1161
|
try {
|
|
996
|
-
const res = await this.client.
|
|
997
|
-
|
|
1162
|
+
const res = await this.client.post(`/api/assets/${fileId}/links`, {
|
|
1163
|
+
app,
|
|
1164
|
+
entityType,
|
|
1165
|
+
entityId
|
|
998
1166
|
});
|
|
999
1167
|
return res.data;
|
|
1000
1168
|
} catch (error) {
|
|
@@ -1003,13 +1171,15 @@ export class OxyServices {
|
|
|
1003
1171
|
}
|
|
1004
1172
|
|
|
1005
1173
|
/**
|
|
1006
|
-
*
|
|
1174
|
+
* Unlink asset from an entity
|
|
1007
1175
|
*/
|
|
1008
|
-
async
|
|
1176
|
+
async assetUnlink(fileId: string, app: string, entityType: string, entityId: string): Promise<any> {
|
|
1009
1177
|
try {
|
|
1010
|
-
const res = await this.client.
|
|
1011
|
-
|
|
1012
|
-
|
|
1178
|
+
const res = await this.client.delete(`/api/assets/${fileId}/links`, {
|
|
1179
|
+
data: {
|
|
1180
|
+
app,
|
|
1181
|
+
entityType,
|
|
1182
|
+
entityId
|
|
1013
1183
|
}
|
|
1014
1184
|
});
|
|
1015
1185
|
return res.data;
|
|
@@ -1019,19 +1189,73 @@ export class OxyServices {
|
|
|
1019
1189
|
}
|
|
1020
1190
|
|
|
1021
1191
|
/**
|
|
1022
|
-
* Get
|
|
1192
|
+
* Get asset metadata
|
|
1023
1193
|
*/
|
|
1024
|
-
async
|
|
1194
|
+
async assetGet(fileId: string): Promise<any> {
|
|
1025
1195
|
try {
|
|
1026
|
-
const res = await this.client.get(`/api/
|
|
1027
|
-
|
|
1028
|
-
|
|
1196
|
+
const res = await this.client.get(`/api/assets/${fileId}`);
|
|
1197
|
+
return res.data;
|
|
1198
|
+
} catch (error) {
|
|
1199
|
+
throw this.handleError(error);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Get asset URL (CDN or signed URL)
|
|
1205
|
+
*/
|
|
1206
|
+
async assetGetUrl(fileId: string, variant?: string, expiresIn?: number): Promise<AssetUrlResponse> {
|
|
1207
|
+
try {
|
|
1208
|
+
const params = new URLSearchParams();
|
|
1209
|
+
if (variant) params.set('variant', variant);
|
|
1210
|
+
if (expiresIn) params.set('expiresIn', expiresIn.toString());
|
|
1211
|
+
|
|
1212
|
+
const queryString = params.toString();
|
|
1213
|
+
const url = `/api/assets/${fileId}/url${queryString ? `?${queryString}` : ''}`;
|
|
1214
|
+
|
|
1215
|
+
const res = await this.client.get(url);
|
|
1216
|
+
return res.data;
|
|
1217
|
+
} catch (error) {
|
|
1218
|
+
throw this.handleError(error);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Restore asset from trash
|
|
1224
|
+
*/
|
|
1225
|
+
async assetRestore(fileId: string): Promise<any> {
|
|
1226
|
+
try {
|
|
1227
|
+
const res = await this.client.post(`/api/assets/${fileId}/restore`);
|
|
1228
|
+
return res.data;
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
throw this.handleError(error);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Delete asset with optional force
|
|
1236
|
+
*/
|
|
1237
|
+
async assetDelete(fileId: string, force: boolean = false): Promise<any> {
|
|
1238
|
+
try {
|
|
1239
|
+
const params = force ? '?force=true' : '';
|
|
1240
|
+
const res = await this.client.delete(`/api/assets/${fileId}${params}`);
|
|
1029
1241
|
return res.data;
|
|
1030
1242
|
} catch (error) {
|
|
1031
1243
|
throw this.handleError(error);
|
|
1032
1244
|
}
|
|
1033
1245
|
}
|
|
1034
1246
|
|
|
1247
|
+
/**
|
|
1248
|
+
* Get list of available variants for an asset
|
|
1249
|
+
*/
|
|
1250
|
+
async assetGetVariants(fileId: string): Promise<AssetVariant[]> {
|
|
1251
|
+
try {
|
|
1252
|
+
const assetData = await this.assetGet(fileId);
|
|
1253
|
+
return assetData.file?.variants || [];
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
throw this.handleError(error);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1035
1259
|
// ============================================================================
|
|
1036
1260
|
// LOCATION METHODS
|
|
1037
1261
|
// ============================================================================
|
|
@@ -1337,4 +1561,7 @@ export class OxyServices {
|
|
|
1337
1561
|
}
|
|
1338
1562
|
|
|
1339
1563
|
// Export the cloud URL constant
|
|
1340
|
-
export const OXY_CLOUD_URL = 'https://cloud.oxyhq.com';
|
|
1564
|
+
export const OXY_CLOUD_URL = 'https://cloud.oxyhq.com';
|
|
1565
|
+
|
|
1566
|
+
// Pre-configured client instance for easy import
|
|
1567
|
+
export const oxyClient = new OxyServices({ baseURL: OXY_CLOUD_URL });
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from '../OxyServices';
|
|
2
|
+
import { OXY_CLOUD_URL } from '../index';
|
|
3
|
+
|
|
4
|
+
// Mock axios for testing
|
|
5
|
+
jest.mock('axios');
|
|
6
|
+
|
|
7
|
+
describe('OxyServices', () => {
|
|
8
|
+
let oxyServices: OxyServices;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// Create a fresh instance for each test
|
|
12
|
+
oxyServices = new OxyServices({ baseURL: 'https://test.example.com' });
|
|
13
|
+
jest.clearAllMocks();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('Constructor and Configuration', () => {
|
|
17
|
+
it('should create an instance with the provided baseURL', () => {
|
|
18
|
+
const customURL = 'https://custom.example.com';
|
|
19
|
+
const service = new OxyServices({ baseURL: customURL });
|
|
20
|
+
expect(service.getBaseURL()).toBe(customURL);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should have a default cloud URL constant', () => {
|
|
24
|
+
expect(OXY_CLOUD_URL).toBe('https://cloud.oxyhq.com');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('Token Management', () => {
|
|
29
|
+
it('should set and retrieve tokens', () => {
|
|
30
|
+
const accessToken = 'test-access-token';
|
|
31
|
+
const refreshToken = 'test-refresh-token';
|
|
32
|
+
|
|
33
|
+
oxyServices.setTokens(accessToken, refreshToken);
|
|
34
|
+
expect(oxyServices.hasValidToken()).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should clear tokens', () => {
|
|
38
|
+
oxyServices.setTokens('test-token', 'refresh-token');
|
|
39
|
+
expect(oxyServices.hasValidToken()).toBe(true);
|
|
40
|
+
|
|
41
|
+
oxyServices.clearTokens();
|
|
42
|
+
expect(oxyServices.hasValidToken()).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should return null for user ID when no token is set', () => {
|
|
46
|
+
expect(oxyServices.getCurrentUserId()).toBeNull();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('Authentication Methods', () => {
|
|
51
|
+
it('should call signUp endpoint with correct parameters', async () => {
|
|
52
|
+
const mockAxios = require('axios');
|
|
53
|
+
const mockResponse = { data: { message: 'Success', token: 'test-token', user: { id: '1', username: 'test' } } };
|
|
54
|
+
mockAxios.create().post.mockResolvedValue(mockResponse);
|
|
55
|
+
|
|
56
|
+
const result = await oxyServices.signUp('testuser', 'test@example.com', 'password');
|
|
57
|
+
|
|
58
|
+
expect(mockAxios.create().post).toHaveBeenCalledWith('/api/auth/signup', {
|
|
59
|
+
username: 'testuser',
|
|
60
|
+
email: 'test@example.com',
|
|
61
|
+
password: 'password'
|
|
62
|
+
});
|
|
63
|
+
expect(result).toEqual(mockResponse.data);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should call signIn endpoint with correct parameters', async () => {
|
|
67
|
+
const mockAxios = require('axios');
|
|
68
|
+
const mockResponse = { data: { accessToken: 'test-token', user: { id: '1', username: 'test' } } };
|
|
69
|
+
mockAxios.create().post.mockResolvedValue(mockResponse);
|
|
70
|
+
|
|
71
|
+
const result = await oxyServices.signIn('testuser', 'password');
|
|
72
|
+
|
|
73
|
+
expect(mockAxios.create().post).toHaveBeenCalledWith('/api/auth/login', {
|
|
74
|
+
username: 'testuser',
|
|
75
|
+
password: 'password',
|
|
76
|
+
deviceName: undefined,
|
|
77
|
+
deviceFingerprint: undefined
|
|
78
|
+
});
|
|
79
|
+
expect(result).toEqual(mockResponse.data);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('Session Management', () => {
|
|
84
|
+
it('should get user by session ID', async () => {
|
|
85
|
+
const mockAxios = require('axios');
|
|
86
|
+
const mockUser = { id: '1', username: 'testuser' };
|
|
87
|
+
mockAxios.create().get.mockResolvedValue({ data: mockUser });
|
|
88
|
+
|
|
89
|
+
const result = await oxyServices.getUserBySession('test-session-id');
|
|
90
|
+
|
|
91
|
+
expect(mockAxios.create().get).toHaveBeenCalledWith('/api/session/user/test-session-id');
|
|
92
|
+
expect(result).toEqual(mockUser);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should get token by session ID and set it', async () => {
|
|
96
|
+
const mockAxios = require('axios');
|
|
97
|
+
const mockResponse = { data: { accessToken: 'new-token', expiresAt: '2024-01-01' } };
|
|
98
|
+
mockAxios.create().get.mockResolvedValue(mockResponse);
|
|
99
|
+
|
|
100
|
+
const result = await oxyServices.getTokenBySession('test-session-id');
|
|
101
|
+
|
|
102
|
+
expect(mockAxios.create().get).toHaveBeenCalledWith('/api/session/token/test-session-id');
|
|
103
|
+
expect(result).toEqual(mockResponse.data);
|
|
104
|
+
expect(oxyServices.hasValidToken()).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('Error Handling', () => {
|
|
109
|
+
it('should handle API errors correctly', async () => {
|
|
110
|
+
const mockAxios = require('axios');
|
|
111
|
+
const mockError = new Error('API Error');
|
|
112
|
+
mockAxios.create().post.mockRejectedValue(mockError);
|
|
113
|
+
|
|
114
|
+
await expect(oxyServices.signUp('test', 'test@example.com', 'pass')).rejects.toThrow();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('Custom Error Types', () => {
|
|
119
|
+
it('should create OxyAuthenticationError with correct properties', () => {
|
|
120
|
+
const error = new OxyAuthenticationError('Test error', 'TEST_CODE', 401);
|
|
121
|
+
expect(error.message).toBe('Test error');
|
|
122
|
+
expect(error.code).toBe('TEST_CODE');
|
|
123
|
+
expect(error.status).toBe(401);
|
|
124
|
+
expect(error.name).toBe('OxyAuthenticationError');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should create OxyAuthenticationTimeoutError with correct properties', () => {
|
|
128
|
+
const error = new OxyAuthenticationTimeoutError('testOperation', 5000);
|
|
129
|
+
expect(error.message).toContain('testOperation');
|
|
130
|
+
expect(error.message).toContain('5000ms');
|
|
131
|
+
expect(error.code).toBe('AUTH_TIMEOUT');
|
|
132
|
+
expect(error.status).toBe(408);
|
|
133
|
+
expect(error.name).toBe('OxyAuthenticationTimeoutError');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
describe('Health Check', () => {
|
|
138
|
+
it('should call health check endpoint', async () => {
|
|
139
|
+
const mockAxios = require('axios');
|
|
140
|
+
const mockResponse = { data: { status: 'ok', timestamp: '2024-01-01' } };
|
|
141
|
+
mockAxios.create().get.mockResolvedValue(mockResponse);
|
|
142
|
+
|
|
143
|
+
const result = await oxyServices.healthCheck();
|
|
144
|
+
|
|
145
|
+
expect(mockAxios.create().get).toHaveBeenCalledWith('/health');
|
|
146
|
+
expect(result).toEqual(mockResponse.data);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('Validation Methods', () => {
|
|
151
|
+
it('should return false when no token is available for validation', async () => {
|
|
152
|
+
const result = await oxyServices.validate();
|
|
153
|
+
expect(result).toBe(false);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should validate token with server when token exists', async () => {
|
|
157
|
+
const mockAxios = require('axios');
|
|
158
|
+
oxyServices.setTokens('test-token');
|
|
159
|
+
mockAxios.create().get.mockResolvedValue({ data: { valid: true } });
|
|
160
|
+
|
|
161
|
+
const result = await oxyServices.validate();
|
|
162
|
+
|
|
163
|
+
expect(mockAxios.create().get).toHaveBeenCalledWith('/api/auth/validate');
|
|
164
|
+
expect(result).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
describe('Wait for Authentication', () => {
|
|
169
|
+
it('should resolve immediately if token is already available', async () => {
|
|
170
|
+
oxyServices.setTokens('test-token');
|
|
171
|
+
const result = await oxyServices.waitForAuth(1000);
|
|
172
|
+
expect(result).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('should timeout if no token becomes available', async () => {
|
|
176
|
+
const result = await oxyServices.waitForAuth(100);
|
|
177
|
+
expect(result).toBe(false);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
package/src/core/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// Main OxyServices class (unified)
|
|
9
9
|
export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './OxyServices';
|
|
10
|
-
export { OXY_CLOUD_URL } from './OxyServices';
|
|
10
|
+
export { OXY_CLOUD_URL, oxyClient } from './OxyServices';
|
|
11
11
|
|
|
12
12
|
// Re-export all models and types for convenience
|
|
13
13
|
export * from '../models/interfaces';
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// Core exports
|
|
10
10
|
export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './core';
|
|
11
|
-
export { OXY_CLOUD_URL } from './core';
|
|
11
|
+
export { OXY_CLOUD_URL, oxyClient } from './core';
|
|
12
12
|
|
|
13
13
|
// React context
|
|
14
14
|
export {
|
|
@@ -54,7 +54,19 @@ export type {
|
|
|
54
54
|
DeviceSession,
|
|
55
55
|
DeviceSessionsResponse,
|
|
56
56
|
DeviceSessionLogoutResponse,
|
|
57
|
-
UpdateDeviceNameResponse
|
|
57
|
+
UpdateDeviceNameResponse,
|
|
58
|
+
// Central Asset Service types
|
|
59
|
+
AssetLink,
|
|
60
|
+
AssetVariant,
|
|
61
|
+
Asset,
|
|
62
|
+
AssetInitRequest,
|
|
63
|
+
AssetInitResponse,
|
|
64
|
+
AssetCompleteRequest,
|
|
65
|
+
AssetLinkRequest,
|
|
66
|
+
AssetUnlinkRequest,
|
|
67
|
+
AssetUrlResponse,
|
|
68
|
+
AssetDeleteSummary,
|
|
69
|
+
AssetUploadProgress
|
|
58
70
|
} from './models/interfaces';
|
|
59
71
|
|
|
60
72
|
export type {
|
|
@@ -65,7 +77,9 @@ export type {
|
|
|
65
77
|
|
|
66
78
|
// UI components and hooks
|
|
67
79
|
export { useAuthStore } from './ui/stores/authStore';
|
|
80
|
+
export { useAssetStore, useAssets as useAssetsStore, useAsset, useUploadProgress, useAssetLoading, useAssetErrors, useAssetsByApp, useAssetsByEntity, useAssetUsageCount, useIsAssetLinked } from './ui/stores/assetStore';
|
|
68
81
|
export { useSessionSocket } from './ui/hooks/useSessionSocket';
|
|
82
|
+
export { useAssets, setOxyAssetInstance } from './ui/hooks/useAssets';
|
|
69
83
|
|
|
70
84
|
// UI components
|
|
71
85
|
export { OxySignInButton } from './ui/components/OxySignInButton';
|
package/src/lib/sonner-safe.ts
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* In backend: exports a no-op function
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Define a type for the toast function
|
|
8
|
+
type ToastFunction = (message: string, options?: Record<string, unknown>) => void;
|
|
9
|
+
|
|
10
|
+
let toast: ToastFunction;
|
|
8
11
|
|
|
9
12
|
// Environment detection
|
|
10
13
|
const isFrontend = typeof window !== 'undefined' ||
|
package/src/lib/sonner.ts
CHANGED
|
@@ -2,8 +2,25 @@ import { Platform } from 'react-native';
|
|
|
2
2
|
import * as WebSonner from 'sonner';
|
|
3
3
|
import * as NativeSonner from 'sonner-native';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// Define proper types for the toast components
|
|
6
|
+
interface ToastFunction {
|
|
7
|
+
(message: string, options?: Record<string, unknown>): void;
|
|
8
|
+
success: (message: string, options?: Record<string, unknown>) => void;
|
|
9
|
+
error: (message: string, options?: Record<string, unknown>) => void;
|
|
10
|
+
info: (message: string, options?: Record<string, unknown>) => void;
|
|
11
|
+
warning: (message: string, options?: Record<string, unknown>) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
|
|
15
|
+
|
|
16
|
+
const { toast: webToast, Toaster: WebToaster } = WebSonner as {
|
|
17
|
+
toast: ToastFunction;
|
|
18
|
+
Toaster: ToasterComponent;
|
|
19
|
+
};
|
|
20
|
+
const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
|
|
21
|
+
toast: ToastFunction;
|
|
22
|
+
Toaster: ToasterComponent;
|
|
23
|
+
};
|
|
7
24
|
|
|
8
25
|
export const toast = Platform.OS === 'web' ? webToast : nativeToast;
|
|
9
26
|
export const Toaster = Platform.OS === 'web' ? WebToaster : NativeToaster;
|