@oxyhq/services 5.17.16 → 5.17.18
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 +32 -38
- package/lib/commonjs/core/CrossDomainAuth.js +277 -0
- package/lib/commonjs/core/CrossDomainAuth.js.map +1 -0
- package/lib/commonjs/core/HttpService.js +82 -15
- package/lib/commonjs/core/HttpService.js.map +1 -1
- package/lib/commonjs/core/OxyServices.base.js +11 -3
- package/lib/commonjs/core/OxyServices.base.js.map +1 -1
- package/lib/commonjs/core/OxyServices.js +4 -1
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +30 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.assets.js +16 -3
- package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.auth.js +73 -32
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js +289 -0
- package/lib/commonjs/core/mixins/OxyServices.fedcm.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.popup.js +352 -0
- package/lib/commonjs/core/mixins/OxyServices.popup.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.redirect.js +378 -0
- package/lib/commonjs/core/mixins/OxyServices.redirect.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js +35 -24
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/core/mixins/index.js +27 -15
- package/lib/commonjs/core/mixins/index.js.map +1 -1
- package/lib/commonjs/crypto/index.js +30 -0
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/crypto/keyManager.js +902 -0
- package/lib/commonjs/crypto/keyManager.js.map +1 -0
- package/lib/commonjs/crypto/polyfill.js +14 -5
- package/lib/commonjs/crypto/polyfill.js.map +1 -1
- package/lib/commonjs/crypto/recoveryPhrase.js +152 -0
- package/lib/commonjs/crypto/recoveryPhrase.js.map +1 -0
- package/lib/commonjs/crypto/signatureService.js +289 -0
- package/lib/commonjs/crypto/signatureService.js.map +1 -0
- package/lib/commonjs/i18n/locales/en-US.json +1 -1
- package/lib/commonjs/index.js +40 -26
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/interfaces.js +0 -15
- package/lib/commonjs/models/interfaces.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +9 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/components/Icon.js.map +1 -1
- package/lib/commonjs/ui/components/IconButton/utils.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +41 -11
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/commonjs/ui/components/TextField/helpers.js.map +1 -1
- package/lib/commonjs/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/commonjs/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +110 -192
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +150 -19
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useSessionManagement.js +279 -0
- package/lib/commonjs/ui/context/hooks/useSessionManagement.js.map +1 -0
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +78 -64
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +38 -51
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js +3 -3
- package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +18 -12
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useProfileEditing.js +3 -5
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +4 -8
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +162 -315
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/hooks/useStorage.js +24 -58
- package/lib/commonjs/ui/hooks/useStorage.js.map +1 -1
- package/lib/commonjs/ui/index.js +50 -21
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +5 -1
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +2 -2
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +29 -24
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +134 -66
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +6 -13
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/accountStore.js +2 -4
- package/lib/commonjs/ui/stores/accountStore.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +45 -32
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/spacing.js +54 -2
- package/lib/commonjs/ui/styles/spacing.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +37 -41
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/storageHelpers.js.map +1 -1
- package/lib/commonjs/utils/errorUtils.js +13 -0
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/validationUtils.js +15 -1
- package/lib/commonjs/utils/validationUtils.js.map +1 -1
- package/lib/module/core/CrossDomainAuth.js +271 -0
- package/lib/module/core/CrossDomainAuth.js.map +1 -0
- package/lib/module/core/HttpService.js +82 -15
- package/lib/module/core/HttpService.js.map +1 -1
- package/lib/module/core/OxyServices.base.js +11 -4
- package/lib/module/core/OxyServices.base.js.map +1 -1
- package/lib/module/core/OxyServices.js +4 -1
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +6 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.assets.js +16 -3
- package/lib/module/core/mixins/OxyServices.assets.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.auth.js +73 -32
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.fedcm.js +286 -0
- package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.popup.js +349 -0
- package/lib/module/core/mixins/OxyServices.popup.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.redirect.js +375 -0
- package/lib/module/core/mixins/OxyServices.redirect.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.user.js +35 -24
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/core/mixins/index.js +15 -3
- package/lib/module/core/mixins/index.js.map +1 -1
- package/lib/module/crypto/index.js +8 -4
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/crypto/keyManager.js +899 -0
- package/lib/module/crypto/keyManager.js.map +1 -0
- package/lib/module/crypto/polyfill.js +6 -5
- package/lib/module/crypto/polyfill.js.map +1 -1
- package/lib/module/crypto/recoveryPhrase.js +147 -0
- package/lib/module/crypto/recoveryPhrase.js.map +1 -0
- package/lib/module/crypto/signatureService.js +286 -0
- package/lib/module/crypto/signatureService.js.map +1 -0
- package/lib/module/i18n/locales/en-US.json +1 -1
- package/lib/module/index.js +6 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/interfaces.js +0 -15
- package/lib/module/models/interfaces.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +6 -2
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/components/Icon.js.map +1 -1
- package/lib/module/ui/components/IconButton/utils.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +41 -11
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/TextField/Adornment/utils.js.map +1 -1
- package/lib/module/ui/components/TextField/helpers.js.map +1 -1
- package/lib/module/ui/components/TouchableRipple/utils.js.map +1 -1
- package/lib/module/ui/components/Typography/AnimatedText.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +112 -184
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +150 -19
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/hooks/useSessionManagement.js +274 -0
- package/lib/module/ui/context/hooks/useSessionManagement.js.map +1 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +79 -64
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +31 -44
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useSecurityQueries.js +1 -1
- package/lib/module/ui/hooks/queries/useSecurityQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +13 -7
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/useProfileEditing.js +3 -5
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +4 -8
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +162 -315
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/hooks/useStorage.js +25 -59
- package/lib/module/ui/hooks/useStorage.js.map +1 -1
- package/lib/module/ui/index.js +15 -10
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +5 -1
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +2 -2
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +29 -24
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +135 -68
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +6 -13
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/stores/accountStore.js +2 -4
- package/lib/module/ui/stores/accountStore.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +45 -32
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/spacing.js +6 -2
- package/lib/module/ui/styles/spacing.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +37 -40
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/ui/utils/storageHelpers.js.map +1 -1
- package/lib/module/utils/errorUtils.js +7 -0
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/validationUtils.js +13 -0
- package/lib/module/utils/validationUtils.js.map +1 -1
- package/lib/typescript/core/CrossDomainAuth.d.ts +161 -0
- package/lib/typescript/core/CrossDomainAuth.d.ts.map +1 -0
- package/lib/typescript/core/HttpService.d.ts +1 -1
- package/lib/typescript/core/HttpService.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.base.d.ts +0 -6
- package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +5 -36
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +4 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +40 -20
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts +195 -0
- package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.popup.d.ts +206 -0
- package/lib/typescript/core/mixins/OxyServices.popup.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.redirect.d.ts +246 -0
- package/lib/typescript/core/mixins/OxyServices.redirect.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +6 -4
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +220 -8
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/crypto/index.d.ts +6 -3
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/keyManager.d.ts +190 -0
- package/lib/typescript/crypto/keyManager.d.ts.map +1 -0
- package/lib/typescript/crypto/polyfill.d.ts +4 -3
- package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
- package/lib/typescript/crypto/recoveryPhrase.d.ts +59 -0
- package/lib/typescript/crypto/recoveryPhrase.d.ts.map +1 -0
- package/lib/typescript/crypto/signatureService.d.ts +87 -0
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -6
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +2 -14
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +0 -9
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/types/bip39.d.ts +32 -0
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts +5 -0
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/ui/components/IconButton/utils.d.ts +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts +1 -1
- package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/helpers.d.ts +8 -8
- package/lib/typescript/ui/components/TextField/types.d.ts +1 -0
- package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
- package/lib/typescript/ui/components/types.d.ts +4 -0
- package/lib/typescript/ui/components/types.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +57 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +10 -3
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts +41 -0
- package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts +1 -2
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useStorage.d.ts +3 -9
- package/lib/typescript/ui/hooks/useStorage.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +6 -2
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/OxyAuthScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/accountStore.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +8 -7
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/spacing.d.ts +5 -0
- package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
- package/lib/typescript/ui/types/navigation.d.ts +2 -1
- package/lib/typescript/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +2 -13
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/ui/utils/storageHelpers.d.ts +0 -3
- package/lib/typescript/ui/utils/storageHelpers.d.ts.map +1 -1
- package/lib/typescript/utils/errorUtils.d.ts +6 -0
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/utils/validationUtils.d.ts +8 -0
- package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/core/CrossDomainAuth.ts +307 -0
- package/src/core/HttpService.ts +99 -16
- package/src/core/OxyServices.base.ts +20 -3
- package/src/core/OxyServices.ts +7 -3
- package/src/core/index.ts +9 -1
- package/src/core/mixins/OxyServices.assets.ts +14 -3
- package/src/core/mixins/OxyServices.auth.ts +105 -36
- package/src/core/mixins/OxyServices.fedcm.ts +315 -0
- package/src/core/mixins/OxyServices.popup.ts +402 -0
- package/src/core/mixins/OxyServices.redirect.ts +397 -0
- package/src/core/mixins/OxyServices.user.ts +39 -24
- package/src/core/mixins/index.ts +19 -3
- package/src/crypto/index.ts +16 -5
- package/src/crypto/keyManager.ts +966 -0
- package/src/crypto/polyfill.ts +6 -5
- package/src/crypto/recoveryPhrase.ts +166 -0
- package/src/crypto/signatureService.ts +323 -0
- package/src/i18n/locales/en-US.json +1 -1
- package/src/index.ts +19 -15
- package/src/models/interfaces.ts +4 -16
- package/src/models/session.ts +2 -11
- package/src/types/bip39.d.ts +32 -0
- package/src/ui/components/BottomSheetRouter.tsx +6 -1
- package/src/ui/components/Icon.tsx +1 -1
- package/src/ui/components/IconButton/utils.ts +1 -1
- package/src/ui/components/OxyProvider.tsx +44 -12
- package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
- package/src/ui/components/TextField/Adornment/utils.ts +2 -2
- package/src/ui/components/TextField/helpers.tsx +10 -10
- package/src/ui/components/TextField/types.tsx +1 -1
- package/src/ui/components/TouchableRipple/utils.ts +2 -2
- package/src/ui/components/Typography/AnimatedText.tsx +2 -2
- package/src/ui/components/types.tsx +6 -0
- package/src/ui/context/OxyContext.tsx +173 -185
- package/src/ui/context/hooks/useAuthOperations.ts +177 -36
- package/src/ui/context/hooks/useSessionManagement.ts +399 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +82 -65
- package/src/ui/hooks/queries/useAccountQueries.ts +29 -35
- package/src/ui/hooks/queries/useSecurityQueries.ts +1 -1
- package/src/ui/hooks/queries/useServicesQueries.ts +14 -6
- package/src/ui/hooks/useProfileEditing.ts +3 -3
- package/src/ui/hooks/useSessionManagement.ts +5 -10
- package/src/ui/hooks/useSessionSocket.ts +46 -175
- package/src/ui/hooks/useStorage.ts +24 -76
- package/src/ui/index.ts +22 -13
- package/src/ui/navigation/routes.ts +6 -2
- package/src/ui/screens/AccountCenterScreen.tsx +2 -2
- package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
- package/src/ui/screens/AccountSettingsScreen.tsx +34 -37
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/OxyAuthScreen.tsx +138 -64
- package/src/ui/screens/PrivacySettingsScreen.tsx +6 -12
- package/src/ui/stores/accountStore.ts +1 -11
- package/src/ui/stores/authStore.ts +43 -44
- package/src/ui/styles/spacing.ts +15 -2
- package/src/ui/types/navigation.ts +2 -2
- package/src/ui/utils/avatarUtils.ts +39 -46
- package/src/ui/utils/storageHelpers.ts +0 -4
- package/src/utils/__tests__/validationUtils.test.ts +16 -1
- package/src/utils/errorUtils.ts +8 -1
- package/src/utils/validationUtils.ts +12 -0
- package/lib/commonjs/core/services/SessionService.js +0 -163
- package/lib/commonjs/core/services/SessionService.js.map +0 -1
- package/lib/commonjs/core/services/TokenService.js +0 -220
- package/lib/commonjs/core/services/TokenService.js.map +0 -1
- package/lib/commonjs/crypto/types.js +0 -2
- package/lib/commonjs/crypto/types.js.map +0 -1
- package/lib/commonjs/ui/context/OxyContextBase.js +0 -21
- package/lib/commonjs/ui/context/OxyContextBase.js.map +0 -1
- package/lib/commonjs/ui/context/hooks/useStorage.js +0 -79
- package/lib/commonjs/ui/context/hooks/useStorage.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -56
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/module/core/services/SessionService.js +0 -159
- package/lib/module/core/services/SessionService.js.map +0 -1
- package/lib/module/core/services/TokenService.js +0 -217
- package/lib/module/core/services/TokenService.js.map +0 -1
- package/lib/module/crypto/types.js +0 -2
- package/lib/module/crypto/types.js.map +0 -1
- package/lib/module/ui/context/OxyContextBase.js +0 -16
- package/lib/module/ui/context/OxyContextBase.js.map +0 -1
- package/lib/module/ui/context/hooks/useStorage.js +0 -74
- package/lib/module/ui/context/hooks/useStorage.js.map +0 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +0 -50
- package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/typescript/core/services/SessionService.d.ts +0 -78
- package/lib/typescript/core/services/SessionService.d.ts.map +0 -1
- package/lib/typescript/core/services/TokenService.d.ts +0 -72
- package/lib/typescript/core/services/TokenService.d.ts.map +0 -1
- package/lib/typescript/crypto/types.d.ts +0 -22
- package/lib/typescript/crypto/types.d.ts.map +0 -1
- package/lib/typescript/ui/context/OxyContextBase.d.ts +0 -63
- package/lib/typescript/ui/context/OxyContextBase.d.ts.map +0 -1
- package/lib/typescript/ui/context/hooks/useStorage.d.ts +0 -22
- package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -19
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
- package/src/core/services/SessionService.ts +0 -173
- package/src/core/services/TokenService.ts +0 -237
- package/src/crypto/types.ts +0 -23
- package/src/ui/context/OxyContextBase.tsx +0 -78
- package/src/ui/context/hooks/useStorage.ts +0 -104
- package/src/ui/hooks/useAvatarPicker.ts +0 -61
|
@@ -4,7 +4,6 @@ import { useEffect, useRef } from 'react';
|
|
|
4
4
|
import io from 'socket.io-client';
|
|
5
5
|
import { toast } from '../../lib/sonner';
|
|
6
6
|
import { logger } from '../../utils/loggerUtils';
|
|
7
|
-
import { tokenService } from '../../core/services/TokenService';
|
|
8
7
|
export function useSessionSocket({
|
|
9
8
|
userId,
|
|
10
9
|
activeSessionId,
|
|
@@ -13,16 +12,13 @@ export function useSessionSocket({
|
|
|
13
12
|
logout,
|
|
14
13
|
clearSessionState,
|
|
15
14
|
baseURL,
|
|
16
|
-
getAccessToken,
|
|
17
15
|
onRemoteSignOut,
|
|
18
16
|
onSessionRemoved
|
|
19
17
|
}) {
|
|
20
18
|
const socketRef = useRef(null);
|
|
21
19
|
const joinedRoomRef = useRef(null);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const lastRegisteredSocketIdRef = useRef(null);
|
|
25
|
-
const getAccessTokenRef = useRef(getAccessToken);
|
|
20
|
+
|
|
21
|
+
// Store callbacks in refs to avoid re-joining when they change
|
|
26
22
|
const refreshSessionsRef = useRef(refreshSessions);
|
|
27
23
|
const logoutRef = useRef(logout);
|
|
28
24
|
const clearSessionStateRef = useRef(clearSessionState);
|
|
@@ -30,6 +26,8 @@ export function useSessionSocket({
|
|
|
30
26
|
const onSessionRemovedRef = useRef(onSessionRemoved);
|
|
31
27
|
const activeSessionIdRef = useRef(activeSessionId);
|
|
32
28
|
const currentDeviceIdRef = useRef(currentDeviceId);
|
|
29
|
+
|
|
30
|
+
// Update refs when callbacks change
|
|
33
31
|
useEffect(() => {
|
|
34
32
|
refreshSessionsRef.current = refreshSessions;
|
|
35
33
|
logoutRef.current = logout;
|
|
@@ -38,363 +36,212 @@ export function useSessionSocket({
|
|
|
38
36
|
onSessionRemovedRef.current = onSessionRemoved;
|
|
39
37
|
activeSessionIdRef.current = activeSessionId;
|
|
40
38
|
currentDeviceIdRef.current = currentDeviceId;
|
|
41
|
-
|
|
42
|
-
}, [refreshSessions, logout, clearSessionState, onRemoteSignOut, onSessionRemoved, activeSessionId, currentDeviceId, getAccessToken]);
|
|
39
|
+
}, [refreshSessions, logout, clearSessionState, onRemoteSignOut, onSessionRemoved, activeSessionId, currentDeviceId]);
|
|
43
40
|
useEffect(() => {
|
|
44
41
|
if (!userId || !baseURL) {
|
|
45
|
-
if
|
|
46
|
-
|
|
47
|
-
socketRef.current
|
|
42
|
+
// Clean up if userId or baseURL becomes invalid
|
|
43
|
+
if (socketRef.current && joinedRoomRef.current) {
|
|
44
|
+
socketRef.current.emit('leave', {
|
|
45
|
+
userId: joinedRoomRef.current
|
|
46
|
+
});
|
|
48
47
|
joinedRoomRef.current = null;
|
|
49
48
|
}
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const roomId = `user:${userId}`;
|
|
52
|
+
|
|
53
|
+
// Only create socket if it doesn't exist
|
|
54
|
+
if (!socketRef.current) {
|
|
55
|
+
socketRef.current = io(baseURL, {
|
|
56
|
+
transports: ['websocket']
|
|
57
57
|
});
|
|
58
|
-
if (socketRef.current) {
|
|
59
|
-
socketRef.current.disconnect();
|
|
60
|
-
socketRef.current = null;
|
|
61
|
-
joinedRoomRef.current = null;
|
|
62
|
-
}
|
|
63
|
-
return;
|
|
64
58
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
const socket = socketRef.current;
|
|
60
|
+
|
|
61
|
+
// Only join if we haven't already joined this room
|
|
62
|
+
if (joinedRoomRef.current !== roomId) {
|
|
63
|
+
// Leave previous room if switching users
|
|
64
|
+
if (joinedRoomRef.current) {
|
|
65
|
+
socket.emit('leave', {
|
|
66
|
+
userId: joinedRoomRef.current
|
|
73
67
|
});
|
|
74
68
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
const socketOptions = {
|
|
83
|
-
transports: ['websocket']
|
|
84
|
-
};
|
|
85
|
-
const freshToken = getAccessTokenRef.current();
|
|
86
|
-
if (freshToken) {
|
|
87
|
-
socketOptions.auth = {
|
|
88
|
-
token: freshToken
|
|
89
|
-
};
|
|
90
|
-
} else {
|
|
91
|
-
logger.debug('No access token available for socket authentication', {
|
|
92
|
-
component: 'useSessionSocket',
|
|
93
|
-
userId
|
|
94
|
-
});
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
socketRef.current = io(baseURL, socketOptions);
|
|
98
|
-
accessTokenRef.current = freshToken;
|
|
99
|
-
joinedRoomRef.current = null;
|
|
100
|
-
handlersSetupRef.current = false;
|
|
69
|
+
socket.emit('join', {
|
|
70
|
+
userId: roomId
|
|
71
|
+
});
|
|
72
|
+
joinedRoomRef.current = roomId;
|
|
73
|
+
if (__DEV__) {
|
|
74
|
+
console.log('Emitting join for room:', roomId);
|
|
101
75
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Set up event handlers (only once per socket instance)
|
|
79
|
+
const handleConnect = () => {
|
|
80
|
+
if (__DEV__) {
|
|
81
|
+
console.log('Socket connected:', socket.id);
|
|
106
82
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
// Server auto-joins room on connection when authenticated
|
|
123
|
-
// Just track that we're connected
|
|
124
|
-
if (userId) {
|
|
125
|
-
joinedRoomRef.current = `user:${userId}`;
|
|
83
|
+
};
|
|
84
|
+
const handleSessionUpdate = async data => {
|
|
85
|
+
if (__DEV__) {
|
|
86
|
+
console.log('Received session_update:', data);
|
|
87
|
+
}
|
|
88
|
+
const currentActiveSessionId = activeSessionIdRef.current;
|
|
89
|
+
const currentDeviceId = currentDeviceIdRef.current;
|
|
90
|
+
|
|
91
|
+
// Handle different event types
|
|
92
|
+
if (data.type === 'session_removed') {
|
|
93
|
+
// Track removed session
|
|
94
|
+
if (data.sessionId && onSessionRemovedRef.current) {
|
|
95
|
+
onSessionRemovedRef.current(data.sessionId);
|
|
126
96
|
}
|
|
127
|
-
};
|
|
128
|
-
const handleDisconnect = async reason => {
|
|
129
|
-
logger.debug('Socket disconnected', {
|
|
130
|
-
component: 'useSessionSocket',
|
|
131
|
-
reason,
|
|
132
|
-
userId
|
|
133
|
-
});
|
|
134
|
-
joinedRoomRef.current = null;
|
|
135
97
|
|
|
136
|
-
// If
|
|
137
|
-
if (
|
|
98
|
+
// If the removed sessionId matches the current activeSessionId, immediately clear state
|
|
99
|
+
if (data.sessionId === currentActiveSessionId) {
|
|
100
|
+
if (onRemoteSignOutRef.current) {
|
|
101
|
+
onRemoteSignOutRef.current();
|
|
102
|
+
} else {
|
|
103
|
+
toast.info('You have been signed out remotely.');
|
|
104
|
+
}
|
|
105
|
+
// Use clearSessionState since session was already removed server-side
|
|
106
|
+
// Await to ensure storage cleanup completes before continuing
|
|
138
107
|
try {
|
|
139
|
-
|
|
140
|
-
await tokenService.refreshTokenIfNeeded();
|
|
141
|
-
const freshToken = getAccessTokenRef.current();
|
|
142
|
-
if (freshToken && socketRef.current) {
|
|
143
|
-
// Update auth and reconnect
|
|
144
|
-
socketRef.current.auth = {
|
|
145
|
-
token: freshToken
|
|
146
|
-
};
|
|
147
|
-
socketRef.current.connect();
|
|
148
|
-
}
|
|
108
|
+
await clearSessionStateRef.current();
|
|
149
109
|
} catch (error) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
110
|
+
if (__DEV__) {
|
|
111
|
+
logger.error('Failed to clear session state after session_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
112
|
+
component: 'useSessionSocket'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
155
115
|
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const handleConnectError = async error => {
|
|
165
|
-
logger.debug('Socket connection error', {
|
|
166
|
-
component: 'useSessionSocket',
|
|
167
|
-
userId,
|
|
168
|
-
error: error.message
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// If error is due to expired/invalid token, try to refresh and reconnect
|
|
172
|
-
if (error.message.includes('Authentication') || error.message.includes('expired') || error.message.includes('token')) {
|
|
173
|
-
try {
|
|
174
|
-
await tokenService.refreshTokenIfNeeded();
|
|
175
|
-
const freshToken = getAccessTokenRef.current();
|
|
176
|
-
if (freshToken && socketRef.current) {
|
|
177
|
-
// Update auth and reconnect
|
|
178
|
-
socketRef.current.auth = {
|
|
179
|
-
token: freshToken
|
|
180
|
-
};
|
|
181
|
-
socketRef.current.connect();
|
|
116
|
+
} else {
|
|
117
|
+
// Otherwise, just refresh the sessions list (with error handling)
|
|
118
|
+
refreshSessionsRef.current().catch(error => {
|
|
119
|
+
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
120
|
+
if (__DEV__) {
|
|
121
|
+
logger.debug('Failed to refresh sessions after session_removed', {
|
|
122
|
+
component: 'useSessionSocket'
|
|
123
|
+
}, error);
|
|
182
124
|
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
} else if (data.type === 'device_removed') {
|
|
128
|
+
// Track all removed sessions from this device
|
|
129
|
+
if (data.sessionIds && onSessionRemovedRef.current) {
|
|
130
|
+
for (const sessionId of data.sessionIds) {
|
|
131
|
+
onSessionRemovedRef.current(sessionId);
|
|
189
132
|
}
|
|
190
133
|
}
|
|
191
|
-
};
|
|
192
|
-
const handleSessionUpdate = async data => {
|
|
193
|
-
logger.debug('Received session_update event', {
|
|
194
|
-
component: 'useSessionSocket',
|
|
195
|
-
type: data.type,
|
|
196
|
-
socketId: socket.id,
|
|
197
|
-
socketConnected: socket.connected,
|
|
198
|
-
roomId: joinedRoomRef.current
|
|
199
|
-
});
|
|
200
|
-
const currentActiveSessionId = activeSessionIdRef.current;
|
|
201
|
-
const currentDeviceId = currentDeviceIdRef.current;
|
|
202
134
|
|
|
203
|
-
//
|
|
204
|
-
if (data.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
135
|
+
// If the removed deviceId matches the current device, immediately clear state
|
|
136
|
+
if (data.deviceId && data.deviceId === currentDeviceId) {
|
|
137
|
+
if (onRemoteSignOutRef.current) {
|
|
138
|
+
onRemoteSignOutRef.current();
|
|
139
|
+
} else {
|
|
140
|
+
toast.info('This device has been removed. You have been signed out.');
|
|
208
141
|
}
|
|
209
|
-
|
|
210
|
-
//
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// Await to ensure storage cleanup completes before continuing
|
|
219
|
-
try {
|
|
220
|
-
await clearSessionStateRef.current();
|
|
221
|
-
} catch (error) {
|
|
222
|
-
if (__DEV__) {
|
|
223
|
-
logger.error('Failed to clear session state after session_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
224
|
-
component: 'useSessionSocket'
|
|
225
|
-
});
|
|
226
|
-
}
|
|
142
|
+
// Use clearSessionState since sessions were already removed server-side
|
|
143
|
+
// Await to ensure storage cleanup completes before continuing
|
|
144
|
+
try {
|
|
145
|
+
await clearSessionStateRef.current();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (__DEV__) {
|
|
148
|
+
logger.error('Failed to clear session state after device_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
149
|
+
component: 'useSessionSocket'
|
|
150
|
+
});
|
|
227
151
|
}
|
|
228
|
-
} else {
|
|
229
|
-
// Otherwise, just refresh the sessions list (with error handling)
|
|
230
|
-
refreshSessionsRef.current().catch(error => {
|
|
231
|
-
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
232
|
-
if (__DEV__) {
|
|
233
|
-
logger.debug('Failed to refresh sessions after session_removed', {
|
|
234
|
-
component: 'useSessionSocket'
|
|
235
|
-
}, error);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
152
|
}
|
|
239
|
-
} else
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
153
|
+
} else {
|
|
154
|
+
// Otherwise, refresh sessions and device list (with error handling)
|
|
155
|
+
refreshSessionsRef.current().catch(error => {
|
|
156
|
+
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
157
|
+
if (__DEV__) {
|
|
158
|
+
logger.debug('Failed to refresh sessions after device_removed', {
|
|
159
|
+
component: 'useSessionSocket'
|
|
160
|
+
}, error);
|
|
244
161
|
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else if (data.type === 'sessions_removed') {
|
|
165
|
+
// Track all removed sessions
|
|
166
|
+
if (data.sessionIds && onSessionRemovedRef.current) {
|
|
167
|
+
for (const sessionId of data.sessionIds) {
|
|
168
|
+
onSessionRemovedRef.current(sessionId);
|
|
245
169
|
}
|
|
170
|
+
}
|
|
246
171
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
} else {
|
|
252
|
-
toast.info('This device has been removed. You have been signed out.');
|
|
253
|
-
}
|
|
254
|
-
// Use clearSessionState since sessions were already removed server-side
|
|
255
|
-
// Await to ensure storage cleanup completes before continuing
|
|
256
|
-
try {
|
|
257
|
-
await clearSessionStateRef.current();
|
|
258
|
-
} catch (error) {
|
|
259
|
-
if (__DEV__) {
|
|
260
|
-
logger.error('Failed to clear session state after device_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
261
|
-
component: 'useSessionSocket'
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
172
|
+
// If the current activeSessionId is in the removed sessionIds list, immediately clear state
|
|
173
|
+
if (data.sessionIds && currentActiveSessionId && data.sessionIds.includes(currentActiveSessionId)) {
|
|
174
|
+
if (onRemoteSignOutRef.current) {
|
|
175
|
+
onRemoteSignOutRef.current();
|
|
265
176
|
} else {
|
|
266
|
-
|
|
267
|
-
refreshSessionsRef.current().catch(error => {
|
|
268
|
-
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
269
|
-
if (__DEV__) {
|
|
270
|
-
logger.debug('Failed to refresh sessions after device_removed', {
|
|
271
|
-
component: 'useSessionSocket'
|
|
272
|
-
}, error);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
} else if (data.type === 'sessions_removed') {
|
|
277
|
-
// Track all removed sessions
|
|
278
|
-
if (data.sessionIds && onSessionRemovedRef.current) {
|
|
279
|
-
for (const sessionId of data.sessionIds) {
|
|
280
|
-
onSessionRemovedRef.current(sessionId);
|
|
281
|
-
}
|
|
177
|
+
toast.info('You have been signed out remotely.');
|
|
282
178
|
}
|
|
283
|
-
|
|
284
|
-
//
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
// Await to ensure storage cleanup completes before continuing
|
|
293
|
-
try {
|
|
294
|
-
await clearSessionStateRef.current();
|
|
295
|
-
} catch (error) {
|
|
296
|
-
if (__DEV__) {
|
|
297
|
-
logger.error('Failed to clear session state after sessions_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
298
|
-
component: 'useSessionSocket'
|
|
299
|
-
});
|
|
300
|
-
}
|
|
179
|
+
// Use clearSessionState since sessions were already removed server-side
|
|
180
|
+
// Await to ensure storage cleanup completes before continuing
|
|
181
|
+
try {
|
|
182
|
+
await clearSessionStateRef.current();
|
|
183
|
+
} catch (error) {
|
|
184
|
+
if (__DEV__) {
|
|
185
|
+
logger.error('Failed to clear session state after sessions_removed', error instanceof Error ? error : new Error(String(error)), {
|
|
186
|
+
component: 'useSessionSocket'
|
|
187
|
+
});
|
|
301
188
|
}
|
|
302
|
-
} else {
|
|
303
|
-
// Otherwise, refresh sessions list (with error handling)
|
|
304
|
-
refreshSessionsRef.current().catch(error => {
|
|
305
|
-
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
306
|
-
if (__DEV__) {
|
|
307
|
-
logger.debug('Failed to refresh sessions after sessions_removed', {
|
|
308
|
-
component: 'useSessionSocket'
|
|
309
|
-
}, error);
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
189
|
}
|
|
313
190
|
} else {
|
|
314
|
-
//
|
|
191
|
+
// Otherwise, refresh sessions list (with error handling)
|
|
315
192
|
refreshSessionsRef.current().catch(error => {
|
|
316
|
-
//
|
|
193
|
+
// Silently handle errors from refresh - they're expected if sessions were removed
|
|
317
194
|
if (__DEV__) {
|
|
318
|
-
logger.debug('Failed to refresh sessions after
|
|
195
|
+
logger.debug('Failed to refresh sessions after sessions_removed', {
|
|
319
196
|
component: 'useSessionSocket'
|
|
320
197
|
}, error);
|
|
321
198
|
}
|
|
322
199
|
});
|
|
323
|
-
|
|
324
|
-
// If the current session was logged out (legacy behavior), handle it specially
|
|
325
|
-
if (data.sessionId === currentActiveSessionId) {
|
|
326
|
-
if (onRemoteSignOutRef.current) {
|
|
327
|
-
onRemoteSignOutRef.current();
|
|
328
|
-
} else {
|
|
329
|
-
toast.info('You have been signed out remotely.');
|
|
330
|
-
}
|
|
331
|
-
// Use clearSessionState since session was already removed server-side
|
|
332
|
-
// Await to ensure storage cleanup completes before continuing
|
|
333
|
-
try {
|
|
334
|
-
await clearSessionStateRef.current();
|
|
335
|
-
} catch (error) {
|
|
336
|
-
logger.error('Failed to clear session state after session_update', error instanceof Error ? error : new Error(String(error)), {
|
|
337
|
-
component: 'useSessionSocket'
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
200
|
}
|
|
342
|
-
}
|
|
201
|
+
} else {
|
|
202
|
+
// For other event types (e.g., session_created), refresh sessions (with error handling)
|
|
203
|
+
refreshSessionsRef.current().catch(error => {
|
|
204
|
+
// Log but don't throw - refresh errors shouldn't break the socket handler
|
|
205
|
+
if (__DEV__) {
|
|
206
|
+
logger.debug('Failed to refresh sessions after session_update', {
|
|
207
|
+
component: 'useSessionSocket'
|
|
208
|
+
}, error);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
343
211
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
212
|
+
// If the current session was logged out (legacy behavior), handle it specially
|
|
213
|
+
if (data.sessionId === currentActiveSessionId) {
|
|
214
|
+
if (onRemoteSignOutRef.current) {
|
|
215
|
+
onRemoteSignOutRef.current();
|
|
216
|
+
} else {
|
|
217
|
+
toast.info('You have been signed out remotely.');
|
|
218
|
+
}
|
|
219
|
+
// Use clearSessionState since session was already removed server-side
|
|
220
|
+
// Await to ensure storage cleanup completes before continuing
|
|
350
221
|
try {
|
|
351
|
-
|
|
352
|
-
socketRef.current.off('disconnect', handleDisconnect);
|
|
353
|
-
socketRef.current.off('error', handleError);
|
|
354
|
-
socketRef.current.off('session_update', handleSessionUpdate);
|
|
222
|
+
await clearSessionStateRef.current();
|
|
355
223
|
} catch (error) {
|
|
356
|
-
|
|
224
|
+
if (__DEV__) {
|
|
225
|
+
console.error('Failed to clear session state after session_update:', error);
|
|
226
|
+
}
|
|
357
227
|
}
|
|
358
228
|
}
|
|
359
|
-
|
|
360
|
-
// Register handlers on current socket
|
|
361
|
-
socket.on('connect', handleConnect);
|
|
362
|
-
socket.on('disconnect', handleDisconnect);
|
|
363
|
-
socket.on('error', handleError);
|
|
364
|
-
socket.on('connect_error', handleConnectError);
|
|
365
|
-
socket.on('session_update', handleSessionUpdate);
|
|
366
|
-
handlersSetupRef.current = true;
|
|
367
|
-
lastRegisteredSocketIdRef.current = currentSocketId;
|
|
368
|
-
logger.debug('Event handlers set up', {
|
|
369
|
-
component: 'useSessionSocket',
|
|
370
|
-
socketId: socket.id,
|
|
371
|
-
userId
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
if (!socket.connected) {
|
|
375
|
-
logger.debug('Socket not connected, connecting...', {
|
|
376
|
-
component: 'useSessionSocket',
|
|
377
|
-
userId
|
|
378
|
-
});
|
|
379
|
-
socket.connect();
|
|
380
229
|
}
|
|
381
230
|
};
|
|
382
|
-
|
|
231
|
+
socket.on('connect', handleConnect);
|
|
232
|
+
socket.on('session_update', handleSessionUpdate);
|
|
383
233
|
return () => {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
// Ignore errors when removing handlers
|
|
394
|
-
}
|
|
395
|
-
handlersSetupRef.current = false;
|
|
234
|
+
socket.off('connect', handleConnect);
|
|
235
|
+
socket.off('session_update', handleSessionUpdate);
|
|
236
|
+
|
|
237
|
+
// Only leave on unmount if we're still in this room
|
|
238
|
+
if (joinedRoomRef.current === roomId) {
|
|
239
|
+
socket.emit('leave', {
|
|
240
|
+
userId: roomId
|
|
241
|
+
});
|
|
242
|
+
joinedRoomRef.current = null;
|
|
396
243
|
}
|
|
397
244
|
};
|
|
398
|
-
}, [userId, baseURL]); // Only depend on userId and baseURL -
|
|
245
|
+
}, [userId, baseURL]); // Only depend on userId and baseURL - callbacks are in refs
|
|
399
246
|
}
|
|
400
247
|
//# sourceMappingURL=useSessionSocket.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","io","toast","logger","tokenService","useSessionSocket","userId","activeSessionId","currentDeviceId","refreshSessions","logout","clearSessionState","baseURL","getAccessToken","onRemoteSignOut","onSessionRemoved","socketRef","joinedRoomRef","accessTokenRef","handlersSetupRef","lastRegisteredSocketIdRef","getAccessTokenRef","refreshSessionsRef","logoutRef","clearSessionStateRef","onRemoteSignOutRef","onSessionRemovedRef","activeSessionIdRef","currentDeviceIdRef","current","disconnect","freshToken","debug","component","initializeSocket","refreshTokenIfNeeded","error","accessToken","tokenChanged","socketOptions","transports","auth","token","socket","connected","handleConnect","currentToken","__DEV__","console","log","socketId","id","room","hasAuth","handleDisconnect","reason","includes","connect","handleError","handleConnectError","message","refreshError","handleSessionUpdate","data","type","socketConnected","roomId","currentActiveSessionId","sessionId","info","Error","String","catch","sessionIds","deviceId","currentSocketId","off","on"],"sourceRoot":"../../../../src","sources":["ui/hooks/useSessionSocket.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,OAAOC,EAAE,MAAM,kBAAkB;AACjC,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,YAAY,QAAQ,kCAAkC;AAe/D,OAAO,SAASC,gBAAgBA,CAAC;EAAEC,MAAM;EAAEC,eAAe;EAAEC,eAAe;EAAEC,eAAe;EAAEC,MAAM;EAAEC,iBAAiB;EAAEC,OAAO;EAAEC,cAAc;EAAEC,eAAe;EAAEC;AAAwC,CAAC,EAAE;EAC5M,MAAMC,SAAS,GAAGhB,MAAM,CAAM,IAAI,CAAC;EACnC,MAAMiB,aAAa,GAAGjB,MAAM,CAAgB,IAAI,CAAC;EACjD,MAAMkB,cAAc,GAAGlB,MAAM,CAAgB,IAAI,CAAC;EAClD,MAAMmB,gBAAgB,GAAGnB,MAAM,CAAU,KAAK,CAAC;EAC/C,MAAMoB,yBAAyB,GAAGpB,MAAM,CAAgB,IAAI,CAAC;EAC7D,MAAMqB,iBAAiB,GAAGrB,MAAM,CAACa,cAAc,CAAC;EAEhD,MAAMS,kBAAkB,GAAGtB,MAAM,CAACS,eAAe,CAAC;EAClD,MAAMc,SAAS,GAAGvB,MAAM,CAACU,MAAM,CAAC;EAChC,MAAMc,oBAAoB,GAAGxB,MAAM,CAACW,iBAAiB,CAAC;EACtD,MAAMc,kBAAkB,GAAGzB,MAAM,CAACc,eAAe,CAAC;EAClD,MAAMY,mBAAmB,GAAG1B,MAAM,CAACe,gBAAgB,CAAC;EACpD,MAAMY,kBAAkB,GAAG3B,MAAM,CAACO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AS,CAACa,OAAO,CAAC+C,GAAG,CAAC,eAAe,CAAC;UACtC5D,SAAS,CAACa,OAAO,CAAC+C,GAAG,CAAC,gBAAgB,CAAC;QACzC,CAAC,CAAC,OAAOxC,KAAK,EAAE;UACd;QAAA;QAEFjB,gBAAgB,CAACU,OAAO,GAAG,KAAK;MAClC;IACF,CAAC;EACH,CAAC,EAAE,CAACvB,MAAM,EAAEM,OAAO,CAAC,CAAC,CAAC,CAAC;AACzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","io","toast","logger","useSessionSocket","userId","activeSessionId","currentDeviceId","refreshSessions","logout","clearSessionState","baseURL","onRemoteSignOut","onSessionRemoved","socketRef","joinedRoomRef","refreshSessionsRef","logoutRef","clearSessionStateRef","onRemoteSignOutRef","onSessionRemovedRef","activeSessionIdRef","currentDeviceIdRef","current","emit","roomId","transports","socket","__DEV__","console","log","handleConnect","id","handleSessionUpdate","data","currentActiveSessionId","type","sessionId","info","error","Error","String","component","catch","debug","sessionIds","deviceId","includes","on","off"],"sourceRoot":"../../../../src","sources":["ui/hooks/useSessionSocket.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,OAAOC,EAAE,MAAM,kBAAkB;AACjC,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,MAAM,QAAQ,yBAAyB;AAchD,OAAO,SAASC,gBAAgBA,CAAC;EAAEC,MAAM;EAAEC,eAAe;EAAEC,eAAe;EAAEC,eAAe;EAAEC,MAAM;EAAEC,iBAAiB;EAAEC,OAAO;EAAEC,eAAe;EAAEC;AAAwC,CAAC,EAAE;EAC5L,MAAMC,SAAS,GAAGd,MAAM,CAAM,IAAI,CAAC;EACnC,MAAMe,aAAa,GAAGf,MAAM,CAAgB,IAAI,CAAC;;EAEjD;EACA,MAAMgB,kBAAkB,GAAGhB,MAAM,CAACQ,eAAe,CAAC;EAClD,MAAMS,SAAS,GAAGjB,MAAM,CAACS,MAAM,CAAC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