@oxyhq/services 5.25.0 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -8
- package/lib/commonjs/core/AuthManager.js +405 -0
- package/lib/commonjs/core/AuthManager.js.map +1 -0
- package/lib/commonjs/core/HttpService.js +39 -1
- package/lib/commonjs/core/HttpService.js.map +1 -1
- package/lib/commonjs/core/index.js +16 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js +38 -44
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.popup.js +9 -7
- package/lib/commonjs/core/mixins/OxyServices.popup.js.map +1 -1
- package/lib/commonjs/index.js +321 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/shared/index.js +227 -0
- package/lib/commonjs/shared/index.js.map +1 -0
- package/lib/commonjs/shared/utils/colorUtils.js +161 -0
- package/lib/commonjs/shared/utils/colorUtils.js.map +1 -0
- package/lib/commonjs/shared/utils/debugUtils.js +84 -0
- package/lib/commonjs/shared/utils/debugUtils.js.map +1 -0
- package/lib/commonjs/shared/utils/errorUtils.js +190 -0
- package/lib/commonjs/shared/utils/errorUtils.js.map +1 -0
- package/lib/commonjs/shared/utils/index.js +196 -0
- package/lib/commonjs/shared/utils/index.js.map +1 -0
- package/lib/commonjs/shared/utils/networkUtils.js +213 -0
- package/lib/commonjs/shared/utils/networkUtils.js.map +1 -0
- package/lib/commonjs/shared/utils/themeUtils.js +118 -0
- package/lib/commonjs/shared/utils/themeUtils.js.map +1 -0
- package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -1
- package/lib/commonjs/ui/components/FontLoader.js +1 -1
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +1 -1
- package/lib/commonjs/ui/components/Header.js +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +9 -1
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +19 -20
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
- package/lib/commonjs/ui/components/QuickActions.js +1 -1
- package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
- package/lib/commonjs/ui/components/Section.js +1 -1
- package/lib/commonjs/ui/components/SectionTitle.js +1 -1
- package/lib/commonjs/ui/components/SignInModal.js +546 -0
- package/lib/commonjs/ui/components/SignInModal.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +2 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
- package/lib/commonjs/ui/hooks/useColorScheme.js.map +1 -0
- package/lib/commonjs/ui/hooks/useSessionSocket.js +6 -12
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/hooks/useThemeColors.js +1 -1
- package/lib/commonjs/ui/hooks/useThemeStyles.js +1 -1
- package/lib/commonjs/ui/navigation/bottomSheetManager.js +5 -2
- package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +7 -8
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +7 -7
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +6 -6
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -2
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +4 -4
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +1 -1
- package/lib/commonjs/ui/screens/FollowersListScreen.js +18 -0
- package/lib/commonjs/ui/screens/FollowersListScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FollowingListScreen.js +18 -0
- package/lib/commonjs/ui/screens/FollowingListScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +1 -1
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +229 -0
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +1 -1
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +9 -21
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +411 -0
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/commonjs/ui/stores/authStore.js +4 -6
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/utils/colorUtils.js +43 -46
- package/lib/commonjs/ui/utils/colorUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/themeUtils.js +29 -39
- package/lib/commonjs/ui/utils/themeUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/{user-utils.js → userUtils.js} +1 -1
- package/lib/commonjs/ui/utils/userUtils.js.map +1 -0
- package/lib/commonjs/utils/errorUtils.js +0 -13
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/hookUtils.js +8 -8
- package/lib/commonjs/utils/hookUtils.js.map +1 -1
- package/lib/commonjs/web/WebOxyContext.js +273 -41
- package/lib/commonjs/web/WebOxyContext.js.map +1 -1
- package/lib/commonjs/web/index.js +177 -4
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web.js +12 -12
- package/lib/commonjs/web.js.map +1 -1
- package/lib/module/core/AuthManager.js +399 -0
- package/lib/module/core/AuthManager.js.map +1 -0
- package/lib/module/core/HttpService.js +39 -1
- package/lib/module/core/HttpService.js.map +1 -1
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.fedcm.js +38 -44
- package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.popup.js +9 -7
- package/lib/module/core/mixins/OxyServices.popup.js.map +1 -1
- package/lib/module/index.js +27 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/shared/index.js +37 -0
- package/lib/module/shared/index.js.map +1 -0
- package/lib/module/shared/utils/colorUtils.js +150 -0
- package/lib/module/shared/utils/colorUtils.js.map +1 -0
- package/lib/module/shared/utils/debugUtils.js +75 -0
- package/lib/module/shared/utils/debugUtils.js.map +1 -0
- package/lib/module/shared/utils/errorUtils.js +176 -0
- package/lib/module/shared/utils/errorUtils.js.map +1 -0
- package/lib/module/shared/utils/index.js +21 -0
- package/lib/module/shared/utils/index.js.map +1 -0
- package/lib/module/shared/utils/networkUtils.js +202 -0
- package/lib/module/shared/utils/networkUtils.js.map +1 -0
- package/lib/module/shared/utils/themeUtils.js +109 -0
- package/lib/module/shared/utils/themeUtils.js.map +1 -0
- package/lib/module/ui/components/BottomSheetRouter.js +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/components/FontLoader.js +1 -1
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +1 -1
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/Header.js +1 -1
- package/lib/module/ui/components/Header.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +9 -1
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +20 -21
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +1 -1
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/QuickActions.js +1 -1
- package/lib/module/ui/components/QuickActions.js.map +1 -1
- package/lib/module/ui/components/Section.js +1 -1
- package/lib/module/ui/components/Section.js.map +1 -1
- package/lib/module/ui/components/SectionTitle.js +1 -1
- package/lib/module/ui/components/SectionTitle.js.map +1 -1
- package/lib/module/ui/components/SignInModal.js +536 -0
- package/lib/module/ui/components/SignInModal.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +1 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
- package/lib/module/ui/hooks/useColorScheme.js.map +1 -0
- package/lib/module/ui/hooks/useSessionSocket.js +6 -12
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/hooks/useThemeColors.js +1 -1
- package/lib/module/ui/hooks/useThemeColors.js.map +1 -1
- package/lib/module/ui/hooks/useThemeStyles.js +1 -1
- package/lib/module/ui/hooks/useThemeStyles.js.map +1 -1
- package/lib/module/ui/navigation/bottomSheetManager.js +5 -2
- package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +7 -8
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +7 -7
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +6 -6
- package/lib/module/ui/screens/AccountOverviewScreen.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 +4 -4
- 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/EditProfileFieldScreen.js +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/FollowersListScreen.js +13 -0
- package/lib/module/ui/screens/FollowersListScreen.js.map +1 -0
- package/lib/module/ui/screens/FollowingListScreen.js +13 -0
- package/lib/module/ui/screens/FollowingListScreen.js.map +1 -0
- package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +224 -0
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
- package/lib/module/ui/screens/LegalDocumentsScreen.js +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +9 -21
- package/lib/module/ui/screens/OxyAuthScreen.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/SavesCollectionsScreen.js +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +405 -0
- package/lib/module/ui/screens/UserListScreen.js.map +1 -0
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js +1 -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/KarmaFAQScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaFAQScreen.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 +1 -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/authStore.js +4 -6
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/utils/colorUtils.js +7 -40
- package/lib/module/ui/utils/colorUtils.js.map +1 -1
- package/lib/module/ui/utils/themeUtils.js +7 -35
- package/lib/module/ui/utils/themeUtils.js.map +1 -1
- package/lib/module/ui/utils/{user-utils.js → userUtils.js} +1 -1
- package/lib/module/ui/utils/userUtils.js.map +1 -0
- package/lib/module/utils/errorUtils.js +0 -7
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/hookUtils.js +8 -8
- package/lib/module/utils/hookUtils.js.map +1 -1
- package/lib/module/web/WebOxyContext.js +272 -41
- package/lib/module/web/WebOxyContext.js.map +1 -1
- package/lib/module/web/index.js +26 -5
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web.js +2 -1
- package/lib/module/web.js.map +1 -1
- package/lib/typescript/commonjs/core/AuthManager.d.ts +144 -0
- package/lib/typescript/commonjs/core/AuthManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/HttpService.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/index.d.ts +2 -0
- package/lib/typescript/commonjs/core/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/mixins/OxyServices.popup.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +16 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/models/session.d.ts +4 -0
- package/lib/typescript/commonjs/models/session.d.ts.map +1 -1
- package/lib/typescript/commonjs/shared/index.d.ts +29 -0
- package/lib/typescript/commonjs/shared/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts +105 -0
- package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts +49 -0
- package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts +98 -0
- package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/index.d.ts +14 -0
- package/lib/typescript/commonjs/shared/utils/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts +140 -0
- package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts +91 -0
- package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +18 -0
- package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +1 -2
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
- package/lib/typescript/commonjs/ui/hooks/useColorScheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +2 -0
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts +9 -0
- package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts +9 -0
- package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
- package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts +11 -0
- package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts +7 -11
- package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts +6 -19
- package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
- package/lib/typescript/commonjs/ui/utils/userUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/errorUtils.d.ts +0 -6
- package/lib/typescript/commonjs/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/web/WebOxyContext.d.ts +117 -9
- package/lib/typescript/commonjs/web/WebOxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/web/index.d.ts +19 -8
- package/lib/typescript/commonjs/web/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/web.d.ts +2 -1
- package/lib/typescript/commonjs/web.d.ts.map +1 -1
- package/lib/typescript/module/core/AuthManager.d.ts +144 -0
- package/lib/typescript/module/core/AuthManager.d.ts.map +1 -0
- package/lib/typescript/module/core/HttpService.d.ts.map +1 -1
- package/lib/typescript/module/core/index.d.ts +2 -0
- package/lib/typescript/module/core/index.d.ts.map +1 -1
- package/lib/typescript/module/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
- package/lib/typescript/module/core/mixins/OxyServices.popup.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +16 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/models/session.d.ts +4 -0
- package/lib/typescript/module/models/session.d.ts.map +1 -1
- package/lib/typescript/module/shared/index.d.ts +29 -0
- package/lib/typescript/module/shared/index.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/colorUtils.d.ts +105 -0
- package/lib/typescript/module/shared/utils/colorUtils.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/debugUtils.d.ts +49 -0
- package/lib/typescript/module/shared/utils/debugUtils.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/errorUtils.d.ts +98 -0
- package/lib/typescript/module/shared/utils/errorUtils.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/index.d.ts +14 -0
- package/lib/typescript/module/shared/utils/index.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/networkUtils.d.ts +140 -0
- package/lib/typescript/module/shared/utils/networkUtils.d.ts.map +1 -0
- package/lib/typescript/module/shared/utils/themeUtils.d.ts +91 -0
- package/lib/typescript/module/shared/utils/themeUtils.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/FontLoader.d.ts +1 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SignInModal.d.ts +18 -0
- package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts +1 -2
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
- package/lib/typescript/module/ui/hooks/useColorScheme.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +2 -0
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +9 -0
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +9 -0
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
- package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts +11 -0
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/colorUtils.d.ts +7 -11
- package/lib/typescript/module/ui/utils/colorUtils.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/themeUtils.d.ts +6 -19
- package/lib/typescript/module/ui/utils/themeUtils.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
- package/lib/typescript/module/ui/utils/userUtils.d.ts.map +1 -0
- package/lib/typescript/module/utils/errorUtils.d.ts +0 -6
- package/lib/typescript/module/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/module/web/WebOxyContext.d.ts +117 -9
- package/lib/typescript/module/web/WebOxyContext.d.ts.map +1 -1
- package/lib/typescript/module/web/index.d.ts +19 -8
- package/lib/typescript/module/web/index.d.ts.map +1 -1
- package/lib/typescript/module/web.d.ts +2 -1
- package/lib/typescript/module/web.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/core/AuthManager.ts +436 -0
- package/src/core/HttpService.ts +43 -1
- package/src/core/index.ts +4 -0
- package/src/core/mixins/OxyServices.fedcm.ts +37 -42
- package/src/core/mixins/OxyServices.popup.ts +10 -7
- package/src/index.ts +76 -11
- package/src/models/session.ts +4 -0
- package/src/shared/index.ts +82 -0
- package/src/shared/utils/colorUtils.ts +155 -0
- package/src/shared/utils/debugUtils.ts +73 -0
- package/src/shared/utils/errorUtils.ts +181 -0
- package/src/shared/utils/index.ts +59 -0
- package/src/shared/utils/networkUtils.ts +248 -0
- package/src/shared/utils/themeUtils.ts +115 -0
- package/src/ui/components/BottomSheetRouter.tsx +1 -1
- package/src/ui/components/FontLoader.tsx +1 -2
- package/src/ui/components/GroupedItem.tsx +1 -1
- package/src/ui/components/Header.tsx +1 -1
- package/src/ui/components/OxyProvider.tsx +10 -0
- package/src/ui/components/OxySignInButton.tsx +20 -22
- 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/SignInModal.tsx +534 -0
- package/src/ui/context/OxyContext.tsx +1 -2
- package/src/ui/hooks/queries/queryKeys.ts +2 -2
- package/src/ui/hooks/useSessionSocket.ts +12 -17
- package/src/ui/hooks/useThemeColors.ts +1 -1
- package/src/ui/hooks/useThemeStyles.ts +1 -1
- package/src/ui/navigation/bottomSheetManager.ts +5 -1
- package/src/ui/navigation/routes.ts +8 -9
- package/src/ui/screens/AccountCenterScreen.tsx +7 -7
- package/src/ui/screens/AccountOverviewScreen.tsx +6 -6
- package/src/ui/screens/AccountSettingsScreen.tsx +2 -2
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/AppInfoScreen.tsx +1 -1
- package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
- package/src/ui/screens/FileManagementScreen.tsx +1 -1
- package/src/ui/screens/FollowersListScreen.tsx +14 -0
- package/src/ui/screens/FollowingListScreen.tsx +14 -0
- package/src/ui/screens/HelpSupportScreen.tsx +1 -1
- package/src/ui/screens/HistoryViewScreen.tsx +1 -1
- package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
- package/src/ui/screens/LearnMoreUsernamesScreen.tsx +231 -0
- package/src/ui/screens/LegalDocumentsScreen.tsx +1 -1
- package/src/ui/screens/OxyAuthScreen.tsx +10 -21
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +1 -1
- package/src/ui/screens/ProfileScreen.tsx +1 -1
- package/src/ui/screens/SavesCollectionsScreen.tsx +1 -1
- package/src/ui/screens/UserListScreen.tsx +416 -0
- package/src/ui/screens/karma/KarmaAboutScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRewardsScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
- package/src/ui/stores/authStore.ts +5 -6
- package/src/ui/utils/colorUtils.ts +15 -43
- package/src/ui/utils/themeUtils.ts +14 -39
- package/src/utils/errorUtils.ts +1 -6
- package/src/utils/hookUtils.ts +8 -8
- package/src/web/WebOxyContext.tsx +331 -41
- package/src/web/index.ts +76 -6
- package/src/web.ts +1 -1
- package/lib/commonjs/ui/hooks/use-color-scheme.js.map +0 -1
- package/lib/commonjs/ui/utils/user-utils.js.map +0 -1
- package/lib/module/ui/hooks/use-color-scheme.js.map +0 -1
- package/lib/module/ui/utils/user-utils.js.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/use-color-scheme.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/utils/user-utils.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/use-color-scheme.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/user-utils.d.ts.map +0 -1
- /package/src/ui/hooks/{use-color-scheme.ts → useColorScheme.ts} +0 -0
- /package/src/ui/utils/{user-utils.ts → userUtils.ts} +0 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SignInModal - Full screen sign-in modal with QR code
|
|
3
|
+
*
|
|
4
|
+
* A semi-transparent full-screen modal that displays:
|
|
5
|
+
* - QR code for scanning with Oxy Accounts app
|
|
6
|
+
* - Button to open Oxy Auth popup
|
|
7
|
+
*
|
|
8
|
+
* Animates with fade-in effect.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
12
|
+
import {
|
|
13
|
+
View,
|
|
14
|
+
Text,
|
|
15
|
+
TouchableOpacity,
|
|
16
|
+
StyleSheet,
|
|
17
|
+
Modal,
|
|
18
|
+
Dimensions,
|
|
19
|
+
ActivityIndicator,
|
|
20
|
+
Platform,
|
|
21
|
+
} from 'react-native';
|
|
22
|
+
import Animated, {
|
|
23
|
+
useSharedValue,
|
|
24
|
+
useAnimatedStyle,
|
|
25
|
+
withTiming,
|
|
26
|
+
runOnJS,
|
|
27
|
+
} from 'react-native-reanimated';
|
|
28
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
29
|
+
import io, { type Socket } from 'socket.io-client';
|
|
30
|
+
import QRCode from 'react-native-qrcode-svg';
|
|
31
|
+
import { useThemeColors } from '../hooks/useThemeColors';
|
|
32
|
+
import { useOxy } from '../context/OxyContext';
|
|
33
|
+
import OxyLogo from './OxyLogo';
|
|
34
|
+
import { createDebugLogger } from '../../shared/utils/debugUtils';
|
|
35
|
+
|
|
36
|
+
const debug = createDebugLogger('SignInModal');
|
|
37
|
+
|
|
38
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
39
|
+
|
|
40
|
+
// Auth session expiration (5 minutes)
|
|
41
|
+
const AUTH_SESSION_EXPIRY_MS = 5 * 60 * 1000;
|
|
42
|
+
|
|
43
|
+
// Polling interval (fallback if socket fails)
|
|
44
|
+
const POLLING_INTERVAL_MS = 3000;
|
|
45
|
+
|
|
46
|
+
interface AuthSession {
|
|
47
|
+
sessionToken: string;
|
|
48
|
+
expiresAt: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AuthUpdatePayload {
|
|
52
|
+
status: 'authorized' | 'cancelled' | 'expired';
|
|
53
|
+
sessionId?: string;
|
|
54
|
+
publicKey?: string;
|
|
55
|
+
userId?: string;
|
|
56
|
+
username?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Store for modal visibility with subscription support
|
|
60
|
+
let modalVisible = false;
|
|
61
|
+
let setModalVisibleCallback: ((visible: boolean) => void) | null = null;
|
|
62
|
+
const visibilityListeners = new Set<(visible: boolean) => void>();
|
|
63
|
+
|
|
64
|
+
export const showSignInModal = () => {
|
|
65
|
+
modalVisible = true;
|
|
66
|
+
setModalVisibleCallback?.(true);
|
|
67
|
+
visibilityListeners.forEach(listener => listener(true));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const hideSignInModal = () => {
|
|
71
|
+
modalVisible = false;
|
|
72
|
+
setModalVisibleCallback?.(false);
|
|
73
|
+
visibilityListeners.forEach(listener => listener(false));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const isSignInModalVisible = () => modalVisible;
|
|
77
|
+
|
|
78
|
+
/** Subscribe to modal visibility changes */
|
|
79
|
+
export const subscribeToSignInModal = (listener: (visible: boolean) => void): (() => void) => {
|
|
80
|
+
visibilityListeners.add(listener);
|
|
81
|
+
return () => visibilityListeners.delete(listener);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const SignInModal: React.FC = () => {
|
|
85
|
+
const [visible, setVisible] = useState(false);
|
|
86
|
+
const [authSession, setAuthSession] = useState<AuthSession | null>(null);
|
|
87
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
88
|
+
const [error, setError] = useState<string | null>(null);
|
|
89
|
+
const [isWaiting, setIsWaiting] = useState(false);
|
|
90
|
+
|
|
91
|
+
const insets = useSafeAreaInsets();
|
|
92
|
+
const colors = useThemeColors();
|
|
93
|
+
const { oxyServices, switchSession } = useOxy();
|
|
94
|
+
|
|
95
|
+
const socketRef = useRef<Socket | null>(null);
|
|
96
|
+
const pollingIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
97
|
+
const isProcessingRef = useRef(false);
|
|
98
|
+
|
|
99
|
+
// Animation values
|
|
100
|
+
const opacity = useSharedValue(0);
|
|
101
|
+
const scale = useSharedValue(0.9);
|
|
102
|
+
|
|
103
|
+
// Register callback
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
setModalVisibleCallback = setVisible;
|
|
106
|
+
return () => {
|
|
107
|
+
setModalVisibleCallback = null;
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
111
|
+
// Animate in/out
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (visible) {
|
|
114
|
+
opacity.value = withTiming(1, { duration: 250 });
|
|
115
|
+
scale.value = withTiming(1, { duration: 250 });
|
|
116
|
+
generateAuthSession();
|
|
117
|
+
} else {
|
|
118
|
+
opacity.value = withTiming(0, { duration: 200 });
|
|
119
|
+
scale.value = withTiming(0.9, { duration: 200 });
|
|
120
|
+
}
|
|
121
|
+
}, [visible]);
|
|
122
|
+
|
|
123
|
+
const backdropStyle = useAnimatedStyle(() => ({
|
|
124
|
+
opacity: opacity.value,
|
|
125
|
+
}));
|
|
126
|
+
|
|
127
|
+
const contentStyle = useAnimatedStyle(() => ({
|
|
128
|
+
opacity: opacity.value,
|
|
129
|
+
transform: [{ scale: scale.value }],
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
// Handle successful authorization
|
|
133
|
+
const handleAuthSuccess = useCallback(async (sessionId: string) => {
|
|
134
|
+
if (isProcessingRef.current) return;
|
|
135
|
+
isProcessingRef.current = true;
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
if (switchSession) {
|
|
139
|
+
await switchSession(sessionId);
|
|
140
|
+
} else {
|
|
141
|
+
await oxyServices.getTokenBySession(sessionId);
|
|
142
|
+
}
|
|
143
|
+
hideSignInModal();
|
|
144
|
+
} catch (err) {
|
|
145
|
+
debug.error('Error completing auth:', err);
|
|
146
|
+
setError('Authorization successful but failed to complete sign in. Please try again.');
|
|
147
|
+
isProcessingRef.current = false;
|
|
148
|
+
}
|
|
149
|
+
}, [oxyServices, switchSession]);
|
|
150
|
+
|
|
151
|
+
// Cleanup socket and polling
|
|
152
|
+
const cleanup = useCallback(() => {
|
|
153
|
+
setIsWaiting(false);
|
|
154
|
+
|
|
155
|
+
if (socketRef.current) {
|
|
156
|
+
socketRef.current.disconnect();
|
|
157
|
+
socketRef.current = null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (pollingIntervalRef.current) {
|
|
161
|
+
clearInterval(pollingIntervalRef.current);
|
|
162
|
+
pollingIntervalRef.current = null;
|
|
163
|
+
}
|
|
164
|
+
}, []);
|
|
165
|
+
|
|
166
|
+
// Connect to socket for real-time updates
|
|
167
|
+
const connectSocket = useCallback((sessionToken: string) => {
|
|
168
|
+
const baseURL = oxyServices.getBaseURL();
|
|
169
|
+
|
|
170
|
+
const socket = io(`${baseURL}/auth-session`, {
|
|
171
|
+
transports: ['websocket', 'polling'],
|
|
172
|
+
reconnection: true,
|
|
173
|
+
reconnectionAttempts: 3,
|
|
174
|
+
reconnectionDelay: 1000,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
socketRef.current = socket;
|
|
178
|
+
|
|
179
|
+
socket.on('connect', () => {
|
|
180
|
+
debug.log('Auth socket connected');
|
|
181
|
+
socket.emit('join', sessionToken);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
socket.on('auth_update', (payload: AuthUpdatePayload) => {
|
|
185
|
+
debug.log('Auth update received:', payload);
|
|
186
|
+
|
|
187
|
+
if (payload.status === 'authorized' && payload.sessionId) {
|
|
188
|
+
cleanup();
|
|
189
|
+
handleAuthSuccess(payload.sessionId);
|
|
190
|
+
} else if (payload.status === 'cancelled') {
|
|
191
|
+
cleanup();
|
|
192
|
+
setError('Authorization was denied.');
|
|
193
|
+
} else if (payload.status === 'expired') {
|
|
194
|
+
cleanup();
|
|
195
|
+
setError('Session expired. Please try again.');
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
socket.on('connect_error', (err) => {
|
|
200
|
+
debug.log('Socket connection error, falling back to polling:', err.message);
|
|
201
|
+
socket.disconnect();
|
|
202
|
+
startPolling(sessionToken);
|
|
203
|
+
});
|
|
204
|
+
}, [oxyServices, handleAuthSuccess, cleanup]);
|
|
205
|
+
|
|
206
|
+
// Start polling for authorization (fallback)
|
|
207
|
+
const startPolling = useCallback((sessionToken: string) => {
|
|
208
|
+
pollingIntervalRef.current = setInterval(async () => {
|
|
209
|
+
if (isProcessingRef.current) return;
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
const response: {
|
|
213
|
+
authorized: boolean;
|
|
214
|
+
sessionId?: string;
|
|
215
|
+
status?: string;
|
|
216
|
+
} = await oxyServices.makeRequest('GET', `/api/auth/session/status/${sessionToken}`, undefined, { cache: false });
|
|
217
|
+
|
|
218
|
+
if (response.authorized && response.sessionId) {
|
|
219
|
+
cleanup();
|
|
220
|
+
handleAuthSuccess(response.sessionId);
|
|
221
|
+
} else if (response.status === 'cancelled') {
|
|
222
|
+
cleanup();
|
|
223
|
+
setError('Authorization was denied.');
|
|
224
|
+
} else if (response.status === 'expired') {
|
|
225
|
+
cleanup();
|
|
226
|
+
setError('Session expired. Please try again.');
|
|
227
|
+
}
|
|
228
|
+
} catch (err) {
|
|
229
|
+
debug.log('Auth polling error:', err);
|
|
230
|
+
}
|
|
231
|
+
}, POLLING_INTERVAL_MS);
|
|
232
|
+
}, [oxyServices, handleAuthSuccess, cleanup]);
|
|
233
|
+
|
|
234
|
+
// Generate a new auth session
|
|
235
|
+
const generateAuthSession = useCallback(async () => {
|
|
236
|
+
setIsLoading(true);
|
|
237
|
+
setError(null);
|
|
238
|
+
isProcessingRef.current = false;
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
const sessionToken = generateSessionToken();
|
|
242
|
+
const expiresAt = Date.now() + AUTH_SESSION_EXPIRY_MS;
|
|
243
|
+
|
|
244
|
+
await oxyServices.makeRequest('POST', '/api/auth/session/create', {
|
|
245
|
+
sessionToken,
|
|
246
|
+
expiresAt,
|
|
247
|
+
appId: Platform.OS,
|
|
248
|
+
}, { cache: false });
|
|
249
|
+
|
|
250
|
+
setAuthSession({ sessionToken, expiresAt });
|
|
251
|
+
setIsWaiting(true);
|
|
252
|
+
connectSocket(sessionToken);
|
|
253
|
+
} catch (err: any) {
|
|
254
|
+
setError(err.message || 'Failed to create auth session');
|
|
255
|
+
} finally {
|
|
256
|
+
setIsLoading(false);
|
|
257
|
+
}
|
|
258
|
+
}, [oxyServices, connectSocket]);
|
|
259
|
+
|
|
260
|
+
// Generate a random session token
|
|
261
|
+
const generateSessionToken = (): string => {
|
|
262
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
263
|
+
let result = '';
|
|
264
|
+
for (let i = 0; i < 32; i++) {
|
|
265
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
266
|
+
}
|
|
267
|
+
return result;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
// Build the QR code data
|
|
271
|
+
const getQRData = (): string => {
|
|
272
|
+
if (!authSession) return '';
|
|
273
|
+
return `oxyauth://${authSession.sessionToken}`;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// Open Oxy Auth popup
|
|
277
|
+
const handleOpenAuthPopup = useCallback(async () => {
|
|
278
|
+
if (!authSession) return;
|
|
279
|
+
|
|
280
|
+
const baseURL = oxyServices.getBaseURL();
|
|
281
|
+
// Resolve auth web URL
|
|
282
|
+
let authWebUrl = oxyServices.config?.authWebUrl;
|
|
283
|
+
if (!authWebUrl) {
|
|
284
|
+
try {
|
|
285
|
+
const url = new URL(baseURL);
|
|
286
|
+
if (url.port === '3001') {
|
|
287
|
+
url.port = '3000';
|
|
288
|
+
authWebUrl = url.origin;
|
|
289
|
+
} else if (url.hostname.startsWith('api.')) {
|
|
290
|
+
url.hostname = `auth.${url.hostname.slice(4)}`;
|
|
291
|
+
authWebUrl = url.origin;
|
|
292
|
+
}
|
|
293
|
+
} catch {
|
|
294
|
+
authWebUrl = 'https://auth.oxy.so';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
authWebUrl = authWebUrl || 'https://auth.oxy.so';
|
|
298
|
+
|
|
299
|
+
const webUrl = new URL('/authorize', authWebUrl);
|
|
300
|
+
webUrl.searchParams.set('token', authSession.sessionToken);
|
|
301
|
+
|
|
302
|
+
// Open popup window
|
|
303
|
+
const width = 500;
|
|
304
|
+
const height = 650;
|
|
305
|
+
const left = (window.screen.width - width) / 2;
|
|
306
|
+
const top = (window.screen.height - height) / 2;
|
|
307
|
+
|
|
308
|
+
window.open(
|
|
309
|
+
webUrl.toString(),
|
|
310
|
+
'oxy-auth-popup',
|
|
311
|
+
`width=${width},height=${height},left=${left},top=${top},popup=1`
|
|
312
|
+
);
|
|
313
|
+
}, [authSession, oxyServices]);
|
|
314
|
+
|
|
315
|
+
// Refresh session
|
|
316
|
+
const handleRefresh = useCallback(() => {
|
|
317
|
+
cleanup();
|
|
318
|
+
generateAuthSession();
|
|
319
|
+
}, [generateAuthSession, cleanup]);
|
|
320
|
+
|
|
321
|
+
// Handle close
|
|
322
|
+
const handleClose = useCallback(() => {
|
|
323
|
+
cleanup();
|
|
324
|
+
hideSignInModal();
|
|
325
|
+
}, [cleanup]);
|
|
326
|
+
|
|
327
|
+
// Clean up on unmount
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
return () => {
|
|
330
|
+
cleanup();
|
|
331
|
+
};
|
|
332
|
+
}, [cleanup]);
|
|
333
|
+
|
|
334
|
+
if (!visible) return null;
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<Modal visible={visible} transparent animationType="none" statusBarTranslucent onRequestClose={handleClose}>
|
|
338
|
+
<Animated.View style={[styles.backdrop, backdropStyle]}>
|
|
339
|
+
<TouchableOpacity style={StyleSheet.absoluteFill} onPress={handleClose} activeOpacity={1} />
|
|
340
|
+
|
|
341
|
+
<Animated.View style={[styles.content, contentStyle, { paddingTop: insets.top + 20, paddingBottom: insets.bottom + 20 }]}>
|
|
342
|
+
{/* Close button */}
|
|
343
|
+
<TouchableOpacity style={styles.closeButton} onPress={handleClose}>
|
|
344
|
+
<Text style={styles.closeButtonText}>×</Text>
|
|
345
|
+
</TouchableOpacity>
|
|
346
|
+
|
|
347
|
+
{/* Header */}
|
|
348
|
+
<View style={styles.header}>
|
|
349
|
+
<OxyLogo width={56} height={56} />
|
|
350
|
+
<Text style={[styles.title, { color: colors.text }]}>Sign in with Oxy</Text>
|
|
351
|
+
<Text style={[styles.subtitle, { color: colors.secondaryText }]}>
|
|
352
|
+
Scan with Oxy Accounts app or use the button below
|
|
353
|
+
</Text>
|
|
354
|
+
</View>
|
|
355
|
+
|
|
356
|
+
{isLoading ? (
|
|
357
|
+
<View style={styles.loadingContainer}>
|
|
358
|
+
<ActivityIndicator size="large" color={colors.tint} />
|
|
359
|
+
<Text style={[styles.loadingText, { color: colors.secondaryText }]}>
|
|
360
|
+
Preparing sign in...
|
|
361
|
+
</Text>
|
|
362
|
+
</View>
|
|
363
|
+
) : error ? (
|
|
364
|
+
<View style={styles.errorContainer}>
|
|
365
|
+
<Text style={[styles.errorText, { color: '#EA4335' }]}>{error}</Text>
|
|
366
|
+
<TouchableOpacity
|
|
367
|
+
style={[styles.button, { backgroundColor: colors.tint }]}
|
|
368
|
+
onPress={handleRefresh}
|
|
369
|
+
>
|
|
370
|
+
<Text style={styles.buttonText}>Try Again</Text>
|
|
371
|
+
</TouchableOpacity>
|
|
372
|
+
</View>
|
|
373
|
+
) : (
|
|
374
|
+
<>
|
|
375
|
+
{/* QR Code */}
|
|
376
|
+
<View style={[styles.qrContainer, { backgroundColor: 'white' }]}>
|
|
377
|
+
{authSession ? (
|
|
378
|
+
<QRCode
|
|
379
|
+
value={getQRData()}
|
|
380
|
+
size={200}
|
|
381
|
+
backgroundColor="white"
|
|
382
|
+
color="black"
|
|
383
|
+
/>
|
|
384
|
+
) : (
|
|
385
|
+
<ActivityIndicator size="large" color="#d169e5" />
|
|
386
|
+
)}
|
|
387
|
+
</View>
|
|
388
|
+
|
|
389
|
+
{/* Divider */}
|
|
390
|
+
<View style={styles.dividerContainer}>
|
|
391
|
+
<View style={[styles.divider, { backgroundColor: 'rgba(255,255,255,0.3)' }]} />
|
|
392
|
+
<Text style={[styles.dividerText, { color: 'rgba(255,255,255,0.7)' }]}>or</Text>
|
|
393
|
+
<View style={[styles.divider, { backgroundColor: 'rgba(255,255,255,0.3)' }]} />
|
|
394
|
+
</View>
|
|
395
|
+
|
|
396
|
+
{/* Open Auth Popup Button */}
|
|
397
|
+
<TouchableOpacity
|
|
398
|
+
style={[styles.button, { backgroundColor: '#d169e5' }]}
|
|
399
|
+
onPress={handleOpenAuthPopup}
|
|
400
|
+
>
|
|
401
|
+
<OxyLogo width={20} height={20} fillColor="white" style={styles.buttonIcon} />
|
|
402
|
+
<Text style={styles.buttonText}>Open Oxy Auth</Text>
|
|
403
|
+
</TouchableOpacity>
|
|
404
|
+
|
|
405
|
+
{/* Status */}
|
|
406
|
+
{isWaiting && (
|
|
407
|
+
<View style={styles.statusContainer}>
|
|
408
|
+
<ActivityIndicator size="small" color="white" />
|
|
409
|
+
<Text style={styles.statusText}>
|
|
410
|
+
Waiting for authorization...
|
|
411
|
+
</Text>
|
|
412
|
+
</View>
|
|
413
|
+
)}
|
|
414
|
+
</>
|
|
415
|
+
)}
|
|
416
|
+
</Animated.View>
|
|
417
|
+
</Animated.View>
|
|
418
|
+
</Modal>
|
|
419
|
+
);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const styles = StyleSheet.create({
|
|
423
|
+
backdrop: {
|
|
424
|
+
flex: 1,
|
|
425
|
+
backgroundColor: 'rgba(0, 0, 0, 0.85)',
|
|
426
|
+
justifyContent: 'center',
|
|
427
|
+
alignItems: 'center',
|
|
428
|
+
},
|
|
429
|
+
content: {
|
|
430
|
+
width: '100%',
|
|
431
|
+
maxWidth: 400,
|
|
432
|
+
alignItems: 'center',
|
|
433
|
+
paddingHorizontal: 24,
|
|
434
|
+
},
|
|
435
|
+
closeButton: {
|
|
436
|
+
position: 'absolute',
|
|
437
|
+
top: 16,
|
|
438
|
+
right: 16,
|
|
439
|
+
width: 40,
|
|
440
|
+
height: 40,
|
|
441
|
+
borderRadius: 20,
|
|
442
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
443
|
+
justifyContent: 'center',
|
|
444
|
+
alignItems: 'center',
|
|
445
|
+
zIndex: 10,
|
|
446
|
+
},
|
|
447
|
+
closeButtonText: {
|
|
448
|
+
color: 'white',
|
|
449
|
+
fontSize: 28,
|
|
450
|
+
fontWeight: '300',
|
|
451
|
+
lineHeight: 32,
|
|
452
|
+
},
|
|
453
|
+
header: {
|
|
454
|
+
alignItems: 'center',
|
|
455
|
+
marginBottom: 32,
|
|
456
|
+
},
|
|
457
|
+
title: {
|
|
458
|
+
fontSize: 28,
|
|
459
|
+
fontWeight: 'bold',
|
|
460
|
+
marginTop: 16,
|
|
461
|
+
color: 'white',
|
|
462
|
+
},
|
|
463
|
+
subtitle: {
|
|
464
|
+
fontSize: 15,
|
|
465
|
+
marginTop: 8,
|
|
466
|
+
textAlign: 'center',
|
|
467
|
+
color: 'rgba(255, 255, 255, 0.7)',
|
|
468
|
+
},
|
|
469
|
+
qrContainer: {
|
|
470
|
+
padding: 20,
|
|
471
|
+
borderRadius: 16,
|
|
472
|
+
},
|
|
473
|
+
dividerContainer: {
|
|
474
|
+
flexDirection: 'row',
|
|
475
|
+
alignItems: 'center',
|
|
476
|
+
marginVertical: 24,
|
|
477
|
+
width: '100%',
|
|
478
|
+
},
|
|
479
|
+
divider: {
|
|
480
|
+
flex: 1,
|
|
481
|
+
height: 1,
|
|
482
|
+
},
|
|
483
|
+
dividerText: {
|
|
484
|
+
marginHorizontal: 16,
|
|
485
|
+
fontSize: 14,
|
|
486
|
+
},
|
|
487
|
+
button: {
|
|
488
|
+
flexDirection: 'row',
|
|
489
|
+
alignItems: 'center',
|
|
490
|
+
justifyContent: 'center',
|
|
491
|
+
paddingVertical: 16,
|
|
492
|
+
paddingHorizontal: 24,
|
|
493
|
+
borderRadius: 12,
|
|
494
|
+
width: '100%',
|
|
495
|
+
},
|
|
496
|
+
buttonIcon: {
|
|
497
|
+
marginRight: 10,
|
|
498
|
+
},
|
|
499
|
+
buttonText: {
|
|
500
|
+
color: 'white',
|
|
501
|
+
fontSize: 16,
|
|
502
|
+
fontWeight: '600',
|
|
503
|
+
},
|
|
504
|
+
statusContainer: {
|
|
505
|
+
flexDirection: 'row',
|
|
506
|
+
alignItems: 'center',
|
|
507
|
+
marginTop: 24,
|
|
508
|
+
},
|
|
509
|
+
statusText: {
|
|
510
|
+
marginLeft: 8,
|
|
511
|
+
fontSize: 14,
|
|
512
|
+
color: 'rgba(255, 255, 255, 0.7)',
|
|
513
|
+
},
|
|
514
|
+
loadingContainer: {
|
|
515
|
+
alignItems: 'center',
|
|
516
|
+
paddingVertical: 40,
|
|
517
|
+
},
|
|
518
|
+
loadingText: {
|
|
519
|
+
marginTop: 16,
|
|
520
|
+
fontSize: 14,
|
|
521
|
+
},
|
|
522
|
+
errorContainer: {
|
|
523
|
+
alignItems: 'center',
|
|
524
|
+
paddingVertical: 20,
|
|
525
|
+
width: '100%',
|
|
526
|
+
},
|
|
527
|
+
errorText: {
|
|
528
|
+
fontSize: 14,
|
|
529
|
+
textAlign: 'center',
|
|
530
|
+
marginBottom: 16,
|
|
531
|
+
},
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
export default SignInModal;
|
|
@@ -58,9 +58,9 @@ export const queryKeys = {
|
|
|
58
58
|
// Security activity queries
|
|
59
59
|
security: {
|
|
60
60
|
all: ['security'] as const,
|
|
61
|
-
activity: (limit?: number, offset?: number, eventType?: string) =>
|
|
61
|
+
activity: (limit?: number, offset?: number, eventType?: string) =>
|
|
62
62
|
[...queryKeys.security.all, 'activity', limit, offset, eventType] as const,
|
|
63
|
-
recent: (limit: number) =>
|
|
63
|
+
recent: (limit: number) =>
|
|
64
64
|
[...queryKeys.security.all, 'recent', limit] as const,
|
|
65
65
|
},
|
|
66
66
|
} as const;
|
|
@@ -2,6 +2,9 @@ import { useEffect, useRef } from 'react';
|
|
|
2
2
|
import io from 'socket.io-client';
|
|
3
3
|
import { toast } from '../../lib/sonner';
|
|
4
4
|
import { logger } from '../../utils/loggerUtils';
|
|
5
|
+
import { createDebugLogger } from '../../shared/utils/debugUtils';
|
|
6
|
+
|
|
7
|
+
const debug = createDebugLogger('SessionSocket');
|
|
5
8
|
|
|
6
9
|
interface UseSessionSocketProps {
|
|
7
10
|
userId: string | null | undefined;
|
|
@@ -69,27 +72,21 @@ export function useSessionSocket({ userId, activeSessionId, currentDeviceId, ref
|
|
|
69
72
|
socket.emit('join', { userId: roomId });
|
|
70
73
|
joinedRoomRef.current = roomId;
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
console.log('Emitting join for room:', roomId);
|
|
74
|
-
}
|
|
75
|
+
debug.log('Emitting join for room:', roomId);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
// Set up event handlers (only once per socket instance)
|
|
78
79
|
const handleConnect = () => {
|
|
79
|
-
|
|
80
|
-
console.log('Socket connected:', socket.id);
|
|
81
|
-
}
|
|
80
|
+
debug.log('Socket connected:', socket.id);
|
|
82
81
|
};
|
|
83
82
|
|
|
84
|
-
const handleSessionUpdate = async (data: {
|
|
85
|
-
type: string;
|
|
86
|
-
sessionId?: string;
|
|
87
|
-
deviceId?: string;
|
|
88
|
-
sessionIds?: string[]
|
|
83
|
+
const handleSessionUpdate = async (data: {
|
|
84
|
+
type: string;
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
deviceId?: string;
|
|
87
|
+
sessionIds?: string[]
|
|
89
88
|
}) => {
|
|
90
|
-
|
|
91
|
-
console.log('Received session_update:', data);
|
|
92
|
-
}
|
|
89
|
+
debug.log('Received session_update:', data);
|
|
93
90
|
|
|
94
91
|
const currentActiveSessionId = activeSessionIdRef.current;
|
|
95
92
|
const currentDeviceId = currentDeviceIdRef.current;
|
|
@@ -213,9 +210,7 @@ export function useSessionSocket({ userId, activeSessionId, currentDeviceId, ref
|
|
|
213
210
|
try {
|
|
214
211
|
await clearSessionStateRef.current();
|
|
215
212
|
} catch (error) {
|
|
216
|
-
|
|
217
|
-
console.error('Failed to clear session state after session_update:', error);
|
|
218
|
-
}
|
|
213
|
+
debug.error('Failed to clear session state after session_update:', error);
|
|
219
214
|
}
|
|
220
215
|
}
|
|
221
216
|
}
|
|
@@ -12,6 +12,7 @@ export interface BottomSheetState {
|
|
|
12
12
|
currentStep?: number;
|
|
13
13
|
history: Array<{ screen: RouteName; props: Record<string, unknown>; step?: number }>;
|
|
14
14
|
isOpen: boolean;
|
|
15
|
+
fullScreen: boolean;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const initialState: BottomSheetState = {
|
|
@@ -20,6 +21,7 @@ const initialState: BottomSheetState = {
|
|
|
20
21
|
currentStep: undefined,
|
|
21
22
|
history: [],
|
|
22
23
|
isOpen: false,
|
|
24
|
+
fullScreen: false,
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
export const bottomSheetStore = createStore<BottomSheetState>(() => initialState);
|
|
@@ -27,10 +29,11 @@ export const bottomSheetStore = createStore<BottomSheetState>(() => initialState
|
|
|
27
29
|
export const getState = () => bottomSheetStore.getState();
|
|
28
30
|
|
|
29
31
|
export const showBottomSheet = (
|
|
30
|
-
screenOrConfig: RouteName | { screen: RouteName; props?: Record<string, unknown
|
|
32
|
+
screenOrConfig: RouteName | { screen: RouteName; props?: Record<string, unknown>; fullScreen?: boolean },
|
|
31
33
|
): void => {
|
|
32
34
|
const screen = typeof screenOrConfig === 'string' ? screenOrConfig : screenOrConfig.screen;
|
|
33
35
|
const props = typeof screenOrConfig === 'string' ? {} : (screenOrConfig.props || {});
|
|
36
|
+
const fullScreen = typeof screenOrConfig === 'string' ? false : (screenOrConfig.fullScreen ?? false);
|
|
34
37
|
|
|
35
38
|
if (!isValidRoute(screen)) {
|
|
36
39
|
if (__DEV__) console.warn(`[BottomSheet] Invalid route: ${screen}`);
|
|
@@ -55,6 +58,7 @@ export const showBottomSheet = (
|
|
|
55
58
|
screenProps: props,
|
|
56
59
|
currentStep: typeof props.initialStep === 'number' ? props.initialStep : undefined,
|
|
57
60
|
isOpen: true,
|
|
61
|
+
fullScreen,
|
|
58
62
|
});
|
|
59
63
|
};
|
|
60
64
|
|