@oxyhq/services 5.17.17 → 5.18.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 +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.features.js +372 -0
- package/lib/commonjs/core/mixins/OxyServices.features.js.map +1 -0
- 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 +28 -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/GroupedItem.js +11 -1
- package/lib/commonjs/ui/components/GroupedItem.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/SettingRow.js +17 -4
- package/lib/commonjs/ui/components/SettingRow.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/components/feedback/FormInput.js +72 -0
- package/lib/commonjs/ui/components/feedback/FormInput.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/ProgressIndicator.js +33 -0
- package/lib/commonjs/ui/components/feedback/ProgressIndicator.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/constants.js +59 -0
- package/lib/commonjs/ui/components/feedback/constants.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js +262 -0
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/index.js +54 -0
- package/lib/commonjs/ui/components/feedback/index.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/types.js +6 -0
- package/lib/commonjs/ui/components/feedback/types.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/useFeedbackForm.js +52 -0
- package/lib/commonjs/ui/components/feedback/useFeedbackForm.js.map +1 -0
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +282 -0
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -0
- package/lib/commonjs/ui/components/modals/index.js +14 -0
- package/lib/commonjs/ui/components/modals/index.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +309 -0
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +79 -0
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js +108 -0
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js +79 -0
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +176 -0
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/constants.js +53 -0
- package/lib/commonjs/ui/components/payment/constants.js.map +1 -0
- package/lib/commonjs/ui/components/payment/index.js +80 -0
- package/lib/commonjs/ui/components/payment/index.js.map +1 -0
- package/lib/commonjs/ui/components/payment/paymentStyles.js +409 -0
- package/lib/commonjs/ui/components/payment/paymentStyles.js.map +1 -0
- package/lib/commonjs/ui/components/payment/types.js +6 -0
- package/lib/commonjs/ui/components/payment/types.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +110 -199
- 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/index.js +26 -0
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +79 -72
- 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/useAsyncAction.js +95 -0
- package/lib/commonjs/ui/hooks/useAsyncAction.js.map +1 -0
- 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/useSettingToggle.js +126 -0
- package/lib/commonjs/ui/hooks/useSettingToggle.js.map +1 -0
- 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 +6 -1
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +6 -4
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +33 -30
- 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/FAQScreen.js +315 -0
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FeedbackScreen.js +73 -590
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +8 -7
- package/lib/commonjs/ui/screens/HelpSupportScreen.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/PaymentGatewayScreen.js +67 -1395
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.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/screens/ProfileScreen.js +13 -5
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +16 -10
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +23 -11
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.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.features.js +369 -0
- package/lib/module/core/mixins/OxyServices.features.js.map +1 -0
- 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 +16 -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/GroupedItem.js +11 -1
- package/lib/module/ui/components/GroupedItem.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/SettingRow.js +17 -4
- package/lib/module/ui/components/SettingRow.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/components/feedback/FormInput.js +67 -0
- package/lib/module/ui/components/feedback/FormInput.js.map +1 -0
- package/lib/module/ui/components/feedback/ProgressIndicator.js +28 -0
- package/lib/module/ui/components/feedback/ProgressIndicator.js.map +1 -0
- package/lib/module/ui/components/feedback/constants.js +55 -0
- package/lib/module/ui/components/feedback/constants.js.map +1 -0
- package/lib/module/ui/components/feedback/feedbackStyles.js +257 -0
- package/lib/module/ui/components/feedback/feedbackStyles.js.map +1 -0
- package/lib/module/ui/components/feedback/index.js +8 -0
- package/lib/module/ui/components/feedback/index.js.map +1 -0
- package/lib/module/ui/components/feedback/types.js +4 -0
- package/lib/module/ui/components/feedback/types.js.map +1 -0
- package/lib/module/ui/components/feedback/useFeedbackForm.js +47 -0
- package/lib/module/ui/components/feedback/useFeedbackForm.js.map +1 -0
- package/lib/module/ui/components/modals/DeleteAccountModal.js +276 -0
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -0
- package/lib/module/ui/components/modals/index.js +4 -0
- package/lib/module/ui/components/modals/index.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +303 -0
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentMethodStep.js +73 -0
- package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentReviewStep.js +102 -0
- package/lib/module/ui/components/payment/PaymentReviewStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentSuccessStep.js +73 -0
- package/lib/module/ui/components/payment/PaymentSuccessStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentSummaryStep.js +170 -0
- package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -0
- package/lib/module/ui/components/payment/constants.js +47 -0
- package/lib/module/ui/components/payment/constants.js.map +1 -0
- package/lib/module/ui/components/payment/index.js +10 -0
- package/lib/module/ui/components/payment/index.js.map +1 -0
- package/lib/module/ui/components/payment/paymentStyles.js +404 -0
- package/lib/module/ui/components/payment/paymentStyles.js.map +1 -0
- package/lib/module/ui/components/payment/types.js +4 -0
- package/lib/module/ui/components/payment/types.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +112 -191
- 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/index.js +2 -0
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +80 -72
- 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/useAsyncAction.js +89 -0
- package/lib/module/ui/hooks/useAsyncAction.js.map +1 -0
- 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/useSettingToggle.js +120 -0
- package/lib/module/ui/hooks/useSettingToggle.js.map +1 -0
- 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 +6 -1
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +6 -4
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +33 -30
- 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/FAQScreen.js +310 -0
- package/lib/module/ui/screens/FAQScreen.js.map +1 -0
- package/lib/module/ui/screens/FeedbackScreen.js +64 -581
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +8 -7
- package/lib/module/ui/screens/HelpSupportScreen.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/PaymentGatewayScreen.js +67 -1397
- package/lib/module/ui/screens/PaymentGatewayScreen.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/screens/ProfileScreen.js +13 -5
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +16 -10
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +23 -11
- package/lib/module/ui/screens/karma/KarmaCenterScreen.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.features.d.ts +229 -0
- package/lib/typescript/core/mixins/OxyServices.features.d.ts.map +1 -0
- 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 +291 -9
- 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/GroupedItem.d.ts +5 -1
- package/lib/typescript/ui/components/GroupedItem.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/SettingRow.d.ts +6 -0
- package/lib/typescript/ui/components/SettingRow.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/feedback/FormInput.d.ts +20 -0
- package/lib/typescript/ui/components/feedback/FormInput.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts +11 -0
- package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/constants.d.ts +5 -0
- package/lib/typescript/ui/components/feedback/constants.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts +280 -0
- package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/index.d.ts +7 -0
- package/lib/typescript/ui/components/feedback/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/types.d.ts +46 -0
- package/lib/typescript/ui/components/feedback/types.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts +9 -0
- package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts.map +1 -0
- package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts +19 -0
- package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts.map +1 -0
- package/lib/typescript/ui/components/modals/index.d.ts +2 -0
- package/lib/typescript/ui/components/modals/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts +21 -0
- package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts +14 -0
- package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts +16 -0
- package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts +10 -0
- package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts +15 -0
- package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/constants.d.ts +7 -0
- package/lib/typescript/ui/components/payment/constants.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/index.d.ts +9 -0
- package/lib/typescript/ui/components/payment/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/paymentStyles.d.ts +396 -0
- package/lib/typescript/ui/components/payment/paymentStyles.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/types.d.ts +40 -0
- package/lib/typescript/ui/components/payment/types.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- 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/useAsyncAction.d.ts +51 -0
- package/lib/typescript/ui/hooks/useAsyncAction.d.ts.map +1 -0
- 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/useSettingToggle.d.ts +55 -0
- package/lib/typescript/ui/hooks/useSettingToggle.d.ts.map +1 -0
- 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/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FAQScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/FAQScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/HelpSupportScreen.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/PaymentGatewayScreen.d.ts +3 -15
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.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.features.ts +428 -0
- 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 +33 -14
- 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/GroupedItem.tsx +19 -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/SettingRow.tsx +26 -4
- 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/feedback/FormInput.tsx +84 -0
- package/src/ui/components/feedback/ProgressIndicator.tsx +35 -0
- package/src/ui/components/feedback/constants.ts +22 -0
- package/src/ui/components/feedback/feedbackStyles.ts +247 -0
- package/src/ui/components/feedback/index.ts +6 -0
- package/src/ui/components/feedback/types.ts +52 -0
- package/src/ui/components/feedback/useFeedbackForm.ts +44 -0
- package/src/ui/components/modals/DeleteAccountModal.tsx +294 -0
- package/src/ui/components/modals/index.ts +1 -0
- package/src/ui/components/payment/PaymentDetailsStep.tsx +222 -0
- package/src/ui/components/payment/PaymentMethodStep.tsx +89 -0
- package/src/ui/components/payment/PaymentReviewStep.tsx +126 -0
- package/src/ui/components/payment/PaymentSuccessStep.tsx +71 -0
- package/src/ui/components/payment/PaymentSummaryStep.tsx +159 -0
- package/src/ui/components/payment/constants.ts +39 -0
- package/src/ui/components/payment/index.ts +9 -0
- package/src/ui/components/payment/paymentStyles.ts +397 -0
- package/src/ui/components/payment/types.ts +45 -0
- package/src/ui/components/types.tsx +6 -0
- package/src/ui/context/OxyContext.tsx +173 -195
- package/src/ui/context/hooks/useAuthOperations.ts +177 -36
- package/src/ui/context/hooks/useSessionManagement.ts +399 -0
- package/src/ui/hooks/index.ts +3 -1
- package/src/ui/hooks/mutations/useAccountMutations.ts +83 -76
- 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/useAsyncAction.ts +129 -0
- 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/useSettingToggle.ts +147 -0
- package/src/ui/hooks/useStorage.ts +24 -76
- package/src/ui/index.ts +22 -13
- package/src/ui/navigation/routes.ts +8 -2
- package/src/ui/screens/AccountCenterScreen.tsx +4 -4
- package/src/ui/screens/AccountOverviewScreen.tsx +36 -38
- package/src/ui/screens/AccountSettingsScreen.tsx +34 -37
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/FAQScreen.tsx +332 -0
- package/src/ui/screens/FeedbackScreen.tsx +91 -626
- package/src/ui/screens/HelpSupportScreen.tsx +7 -5
- package/src/ui/screens/OxyAuthScreen.tsx +138 -64
- package/src/ui/screens/PaymentGatewayScreen.tsx +96 -1275
- package/src/ui/screens/PrivacySettingsScreen.tsx +6 -12
- package/src/ui/screens/ProfileScreen.tsx +11 -6
- package/src/ui/screens/SavesCollectionsScreen.tsx +19 -10
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +10 -10
- 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
|
@@ -5,10 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAuthOperations = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _deviceManager = require("../../../utils/deviceManager");
|
|
8
9
|
var _sessionHelpers = require("../../utils/sessionHelpers");
|
|
9
10
|
var _errorHandlers = require("../../utils/errorHandlers");
|
|
11
|
+
var _crypto = require("../../../crypto");
|
|
12
|
+
const LOGIN_ERROR_CODE = 'LOGIN_ERROR';
|
|
10
13
|
const LOGOUT_ERROR_CODE = 'LOGOUT_ERROR';
|
|
11
14
|
const LOGOUT_ALL_ERROR_CODE = 'LOGOUT_ALL_ERROR';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Authentication operations using public key cryptography.
|
|
18
|
+
* Accepts public key as parameter - identity management is handled by the app layer.
|
|
19
|
+
*/
|
|
12
20
|
const useAuthOperations = ({
|
|
13
21
|
oxyServices,
|
|
14
22
|
storage,
|
|
@@ -28,15 +36,121 @@ const useAuthOperations = ({
|
|
|
28
36
|
setAuthState,
|
|
29
37
|
logger
|
|
30
38
|
}) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Internal function to perform challenge-response sign in (works offline)
|
|
41
|
+
*/
|
|
42
|
+
const performSignIn = (0, _react.useCallback)(async publicKey => {
|
|
43
|
+
const deviceFingerprintObj = _deviceManager.DeviceManager.getDeviceFingerprint();
|
|
44
|
+
const deviceFingerprint = JSON.stringify(deviceFingerprintObj);
|
|
45
|
+
const deviceInfo = await _deviceManager.DeviceManager.getDeviceInfo();
|
|
46
|
+
const deviceName = deviceInfo.deviceName || _deviceManager.DeviceManager.getDefaultDeviceName();
|
|
47
|
+
let challenge;
|
|
48
|
+
let isOffline = false;
|
|
49
|
+
|
|
50
|
+
// Try to request challenge from server (online)
|
|
37
51
|
try {
|
|
38
|
-
oxyServices.
|
|
39
|
-
|
|
52
|
+
const challengeResponse = await oxyServices.requestChallenge(publicKey);
|
|
53
|
+
challenge = challengeResponse.challenge;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
// Network error - generate challenge locally for offline sign-in
|
|
56
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
57
|
+
const isNetworkError = errorMessage.includes('Network') || errorMessage.includes('network') || errorMessage.includes('Failed to fetch') || errorMessage.includes('fetch failed') || error?.code === 'NETWORK_ERROR' || error?.status === 0;
|
|
58
|
+
if (isNetworkError) {
|
|
59
|
+
if (__DEV__ && logger) {
|
|
60
|
+
logger('Network unavailable, performing offline sign-in');
|
|
61
|
+
}
|
|
62
|
+
// Generate challenge locally
|
|
63
|
+
challenge = await _crypto.SignatureService.generateChallenge();
|
|
64
|
+
isOffline = true;
|
|
65
|
+
} else {
|
|
66
|
+
// Re-throw non-network errors
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Note: Biometric authentication check should be handled by the app layer
|
|
72
|
+
// (e.g., accounts app) before calling signIn. The biometric preference is stored
|
|
73
|
+
// in local storage as 'oxy_biometric_enabled' and can be checked there.
|
|
74
|
+
|
|
75
|
+
// Sign the challenge
|
|
76
|
+
const {
|
|
77
|
+
challenge: signature,
|
|
78
|
+
timestamp
|
|
79
|
+
} = await _crypto.SignatureService.signChallenge(challenge);
|
|
80
|
+
let fullUser;
|
|
81
|
+
let sessionResponse;
|
|
82
|
+
if (isOffline) {
|
|
83
|
+
// Offline sign-in: create local session and minimal user object
|
|
84
|
+
if (__DEV__ && logger) {
|
|
85
|
+
logger('Creating offline session');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Generate a local session ID
|
|
89
|
+
const localSessionId = `offline_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
90
|
+
const localDeviceId = `device_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
91
|
+
const expiresAt = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(); // 7 days
|
|
92
|
+
|
|
93
|
+
// Create minimal user object with publicKey as id
|
|
94
|
+
fullUser = {
|
|
95
|
+
id: publicKey,
|
|
96
|
+
// Use publicKey as id (per migration document)
|
|
97
|
+
publicKey,
|
|
98
|
+
username: '',
|
|
99
|
+
privacySettings: {}
|
|
100
|
+
};
|
|
101
|
+
sessionResponse = {
|
|
102
|
+
sessionId: localSessionId,
|
|
103
|
+
deviceId: localDeviceId,
|
|
104
|
+
expiresAt,
|
|
105
|
+
user: {
|
|
106
|
+
id: publicKey,
|
|
107
|
+
username: ''
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Store offline session locally
|
|
112
|
+
const offlineSession = {
|
|
113
|
+
sessionId: localSessionId,
|
|
114
|
+
deviceId: localDeviceId,
|
|
115
|
+
expiresAt,
|
|
116
|
+
lastActive: new Date().toISOString(),
|
|
117
|
+
userId: publicKey,
|
|
118
|
+
isCurrent: true
|
|
119
|
+
};
|
|
120
|
+
setActiveSessionId(localSessionId);
|
|
121
|
+
await saveActiveSessionId(localSessionId);
|
|
122
|
+
updateSessions([offlineSession], {
|
|
123
|
+
merge: true
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Mark session as offline for later sync
|
|
127
|
+
if (storage) {
|
|
128
|
+
await storage.setItem(`oxy_session_${localSessionId}_offline`, 'true');
|
|
129
|
+
}
|
|
130
|
+
if (__DEV__ && logger) {
|
|
131
|
+
logger('Offline sign-in successful');
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
// Online sign-in: use normal flow
|
|
135
|
+
// Verify and create session
|
|
136
|
+
sessionResponse = await oxyServices.verifyChallenge(publicKey, challenge, signature, timestamp, deviceName, deviceFingerprint);
|
|
137
|
+
|
|
138
|
+
// Get token for the session
|
|
139
|
+
try {
|
|
140
|
+
await oxyServices.getTokenBySession(sessionResponse.sessionId);
|
|
141
|
+
} catch (tokenError) {
|
|
142
|
+
const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
|
|
143
|
+
const status = tokenError?.status;
|
|
144
|
+
if (status === 404 || errorMessage.includes('404')) {
|
|
145
|
+
throw new Error(`Session was created but token could not be retrieved. Session ID: ${sessionResponse.sessionId.substring(0, 8)}...`);
|
|
146
|
+
}
|
|
147
|
+
throw tokenError;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Get full user data
|
|
151
|
+
fullUser = await oxyServices.getUserBySession(sessionResponse.sessionId);
|
|
152
|
+
|
|
153
|
+
// Fetch device sessions
|
|
40
154
|
let allDeviceSessions = [];
|
|
41
155
|
try {
|
|
42
156
|
allDeviceSessions = await (0, _sessionHelpers.fetchSessionsWithFallback)(oxyServices, sessionResponse.sessionId, {
|
|
@@ -45,17 +159,21 @@ const useAuthOperations = ({
|
|
|
45
159
|
logger
|
|
46
160
|
});
|
|
47
161
|
} catch (error) {
|
|
48
|
-
if (__DEV__) {
|
|
49
|
-
|
|
162
|
+
if (__DEV__ && logger) {
|
|
163
|
+
logger('Failed to fetch device sessions after login', error);
|
|
50
164
|
}
|
|
51
165
|
}
|
|
166
|
+
|
|
167
|
+
// Check for existing session for same user and switch to it to avoid duplicates
|
|
52
168
|
const existingSession = allDeviceSessions.find(session => session.userId?.toString() === fullUser.id?.toString() && session.sessionId !== sessionResponse.sessionId);
|
|
53
169
|
if (existingSession) {
|
|
170
|
+
// Switch to existing session instead of creating duplicate
|
|
54
171
|
try {
|
|
55
172
|
await oxyServices.logoutSession(sessionResponse.sessionId, sessionResponse.sessionId);
|
|
56
173
|
} catch (logoutError) {
|
|
57
|
-
if
|
|
58
|
-
|
|
174
|
+
// Non-critical - continue to switch session even if logout fails
|
|
175
|
+
if (__DEV__ && logger) {
|
|
176
|
+
logger('Failed to logout duplicate session, continuing with switch', logoutError);
|
|
59
177
|
}
|
|
60
178
|
}
|
|
61
179
|
await switchSession(existingSession.sessionId);
|
|
@@ -70,14 +188,27 @@ const useAuthOperations = ({
|
|
|
70
188
|
updateSessions(allDeviceSessions, {
|
|
71
189
|
merge: true
|
|
72
190
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
191
|
+
}
|
|
192
|
+
await applyLanguagePreference(fullUser);
|
|
193
|
+
loginSuccess(fullUser);
|
|
194
|
+
onAuthStateChange?.(fullUser);
|
|
195
|
+
return fullUser;
|
|
196
|
+
}, [applyLanguagePreference, logger, loginSuccess, onAuthStateChange, oxyServices, saveActiveSessionId, setActiveSessionId, switchSession, updateSessions, storage]);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Sign in with existing public key
|
|
200
|
+
*/
|
|
201
|
+
const signIn = (0, _react.useCallback)(async (publicKey, deviceName) => {
|
|
202
|
+
setAuthState({
|
|
203
|
+
isLoading: true,
|
|
204
|
+
error: null
|
|
205
|
+
});
|
|
206
|
+
try {
|
|
207
|
+
return await performSignIn(publicKey);
|
|
77
208
|
} catch (error) {
|
|
78
209
|
const message = (0, _errorHandlers.handleAuthError)(error, {
|
|
79
210
|
defaultMessage: 'Sign in failed',
|
|
80
|
-
code:
|
|
211
|
+
code: LOGIN_ERROR_CODE,
|
|
81
212
|
onError,
|
|
82
213
|
setAuthError: msg => setAuthState({
|
|
83
214
|
error: msg
|
|
@@ -91,7 +222,7 @@ const useAuthOperations = ({
|
|
|
91
222
|
isLoading: false
|
|
92
223
|
});
|
|
93
224
|
}
|
|
94
|
-
}, [
|
|
225
|
+
}, [setAuthState, performSignIn, loginFailure, onError, logger]);
|
|
95
226
|
|
|
96
227
|
/**
|
|
97
228
|
* Logout from session
|
|
@@ -165,7 +296,7 @@ const useAuthOperations = ({
|
|
|
165
296
|
}
|
|
166
297
|
}, [activeSessionId, clearSessionState, logger, onError, oxyServices, setAuthState]);
|
|
167
298
|
return {
|
|
168
|
-
|
|
299
|
+
signIn,
|
|
169
300
|
logout,
|
|
170
301
|
logoutAll
|
|
171
302
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_sessionHelpers","_errorHandlers","LOGOUT_ERROR_CODE","LOGOUT_ALL_ERROR_CODE","useAuthOperations","oxyServices","storage","sessions","activeSessionId","setActiveSessionId","updateSessions","saveActiveSessionId","clearSessionState","switchSession","applyLanguagePreference","onAuthStateChange","onError","loginSuccess","loginFailure","logoutStore","setAuthState","logger","
|
|
1
|
+
{"version":3,"names":["_react","require","_deviceManager","_sessionHelpers","_errorHandlers","_crypto","LOGIN_ERROR_CODE","LOGOUT_ERROR_CODE","LOGOUT_ALL_ERROR_CODE","useAuthOperations","oxyServices","storage","sessions","activeSessionId","setActiveSessionId","updateSessions","saveActiveSessionId","clearSessionState","switchSession","applyLanguagePreference","onAuthStateChange","onError","loginSuccess","loginFailure","logoutStore","setAuthState","logger","performSignIn","useCallback","publicKey","deviceFingerprintObj","DeviceManager","getDeviceFingerprint","deviceFingerprint","JSON","stringify","deviceInfo","getDeviceInfo","deviceName","getDefaultDeviceName","challenge","isOffline","challengeResponse","requestChallenge","error","errorMessage","Error","message","String","isNetworkError","includes","code","status","__DEV__","SignatureService","generateChallenge","signature","timestamp","signChallenge","fullUser","sessionResponse","localSessionId","Date","now","Math","random","toString","substr","localDeviceId","expiresAt","toISOString","id","username","privacySettings","sessionId","deviceId","user","offlineSession","lastActive","userId","isCurrent","merge","setItem","verifyChallenge","getTokenBySession","tokenError","substring","getUserBySession","allDeviceSessions","fetchSessionsWithFallback","fallbackDeviceId","fallbackUserId","existingSession","find","session","logoutSession","logoutError","filter","signIn","isLoading","handleAuthError","defaultMessage","setAuthError","msg","logout","targetSessionId","sessionToLogout","filteredSessions","length","isInvalid","isInvalidSessionError","undefined","logoutAll","logoutAllSessions","exports"],"sourceRoot":"../../../../../src","sources":["ui/context/hooks/useAuthOperations.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAGA,IAAAI,OAAA,GAAAJ,OAAA;AA+BA,MAAMK,gBAAgB,GAAG,aAAa;AACtC,MAAMC,iBAAiB,GAAG,cAAc;AACxC,MAAMC,qBAAqB,GAAG,kBAAkB;;AAEhD;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,WAAW;EACXC,OAAO;EACPC,QAAQ;EACRC,eAAe;EACfC,kBAAkB;EAClBC,cAAc;EACdC,mBAAmB;EACnBC,i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|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSessionManagement = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _sessionUtils = require("../../../utils/sessionUtils");
|
|
9
|
+
var _sessionHelpers = require("../../utils/sessionHelpers");
|
|
10
|
+
var _storageHelpers = require("../../utils/storageHelpers");
|
|
11
|
+
var _errorHandlers = require("../../utils/errorHandlers");
|
|
12
|
+
var _queryClient = require("../../hooks/queryClient");
|
|
13
|
+
const DEFAULT_SAVE_ERROR_MESSAGE = 'Failed to save session data';
|
|
14
|
+
const CLEAR_STORAGE_ERROR = 'Failed to clear storage';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Manage session state, persistence, and high-level multi-session operations.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Session management configuration
|
|
20
|
+
*/
|
|
21
|
+
const useSessionManagement = ({
|
|
22
|
+
oxyServices,
|
|
23
|
+
storage,
|
|
24
|
+
storageKeyPrefix,
|
|
25
|
+
loginSuccess,
|
|
26
|
+
logoutStore,
|
|
27
|
+
applyLanguagePreference,
|
|
28
|
+
onAuthStateChange,
|
|
29
|
+
onError,
|
|
30
|
+
setAuthError,
|
|
31
|
+
logger,
|
|
32
|
+
setTokenReady,
|
|
33
|
+
queryClient
|
|
34
|
+
}) => {
|
|
35
|
+
const [sessions, setSessions] = (0, _react.useState)([]);
|
|
36
|
+
const [activeSessionId, setActiveSessionId] = (0, _react.useState)(null);
|
|
37
|
+
const refreshInFlightRef = (0, _react.useRef)(null);
|
|
38
|
+
const removedSessionsRef = (0, _react.useRef)(new Set());
|
|
39
|
+
const lastRefreshRef = (0, _react.useRef)(0);
|
|
40
|
+
const storageKeys = (0, _react.useMemo)(() => (0, _storageHelpers.getStorageKeys)(storageKeyPrefix), [storageKeyPrefix]);
|
|
41
|
+
const saveSessionIds = (0, _react.useCallback)(async sessionIds => {
|
|
42
|
+
if (!storage) return;
|
|
43
|
+
try {
|
|
44
|
+
const uniqueIds = Array.from(new Set(sessionIds));
|
|
45
|
+
await storage.setItem(storageKeys.sessionIds, JSON.stringify(uniqueIds));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (logger) {
|
|
48
|
+
logger(DEFAULT_SAVE_ERROR_MESSAGE, error);
|
|
49
|
+
} else if (__DEV__) {
|
|
50
|
+
console.warn('Failed to save session IDs:', error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [logger, storage, storageKeys.sessionIds]);
|
|
54
|
+
const updateSessions = (0, _react.useCallback)((incoming, options = {}) => {
|
|
55
|
+
setSessions(prevSessions => {
|
|
56
|
+
const processed = options.merge ? (0, _sessionUtils.mergeSessions)(prevSessions, incoming, activeSessionId, false) : (0, _sessionUtils.normalizeAndSortSessions)(incoming, activeSessionId, false);
|
|
57
|
+
if (storage) {
|
|
58
|
+
void saveSessionIds(processed.map(session => session.sessionId));
|
|
59
|
+
}
|
|
60
|
+
if ((0, _sessionUtils.sessionsArraysEqual)(prevSessions, processed)) {
|
|
61
|
+
return prevSessions;
|
|
62
|
+
}
|
|
63
|
+
return processed;
|
|
64
|
+
});
|
|
65
|
+
}, [activeSessionId, saveSessionIds, storage]);
|
|
66
|
+
const saveActiveSessionId = (0, _react.useCallback)(async sessionId => {
|
|
67
|
+
if (!storage) return;
|
|
68
|
+
try {
|
|
69
|
+
await storage.setItem(storageKeys.activeSessionId, sessionId);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
(0, _errorHandlers.handleAuthError)(error, {
|
|
72
|
+
defaultMessage: DEFAULT_SAVE_ERROR_MESSAGE,
|
|
73
|
+
code: 'SESSION_PERSISTENCE_ERROR',
|
|
74
|
+
onError,
|
|
75
|
+
setAuthError,
|
|
76
|
+
logger
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [logger, onError, setAuthError, storage, storageKeys.activeSessionId]);
|
|
80
|
+
const removeActiveSessionId = (0, _react.useCallback)(async () => {
|
|
81
|
+
if (!storage) return;
|
|
82
|
+
try {
|
|
83
|
+
await storage.removeItem(storageKeys.activeSessionId);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
(0, _errorHandlers.handleAuthError)(error, {
|
|
86
|
+
defaultMessage: DEFAULT_SAVE_ERROR_MESSAGE,
|
|
87
|
+
code: 'SESSION_PERSISTENCE_ERROR',
|
|
88
|
+
onError,
|
|
89
|
+
setAuthError,
|
|
90
|
+
logger
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [logger, onError, setAuthError, storage, storageKeys.activeSessionId]);
|
|
94
|
+
const clearSessionStorage = (0, _react.useCallback)(async () => {
|
|
95
|
+
if (!storage) return;
|
|
96
|
+
try {
|
|
97
|
+
await storage.removeItem(storageKeys.activeSessionId);
|
|
98
|
+
await storage.removeItem(storageKeys.sessionIds);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
(0, _errorHandlers.handleAuthError)(error, {
|
|
101
|
+
defaultMessage: CLEAR_STORAGE_ERROR,
|
|
102
|
+
code: 'STORAGE_ERROR',
|
|
103
|
+
onError,
|
|
104
|
+
setAuthError,
|
|
105
|
+
logger
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, [logger, onError, setAuthError, storage, storageKeys.activeSessionId, storageKeys.sessionIds]);
|
|
109
|
+
const clearSessionState = (0, _react.useCallback)(async () => {
|
|
110
|
+
setSessions([]);
|
|
111
|
+
setActiveSessionId(null);
|
|
112
|
+
logoutStore();
|
|
113
|
+
|
|
114
|
+
// Clear TanStack Query cache (in-memory)
|
|
115
|
+
if (queryClient) {
|
|
116
|
+
queryClient.clear();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Clear persisted query cache
|
|
120
|
+
if (storage) {
|
|
121
|
+
try {
|
|
122
|
+
await (0, _queryClient.clearQueryCache)(storage);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (logger) {
|
|
125
|
+
logger('Failed to clear persisted query cache', error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
await clearSessionStorage();
|
|
130
|
+
onAuthStateChange?.(null);
|
|
131
|
+
}, [clearSessionStorage, logoutStore, onAuthStateChange, queryClient, storage, logger]);
|
|
132
|
+
const activateSession = (0, _react.useCallback)(async (sessionId, user) => {
|
|
133
|
+
await oxyServices.getTokenBySession(sessionId);
|
|
134
|
+
setTokenReady?.(true);
|
|
135
|
+
setActiveSessionId(sessionId);
|
|
136
|
+
loginSuccess(user);
|
|
137
|
+
await saveActiveSessionId(sessionId);
|
|
138
|
+
await applyLanguagePreference(user);
|
|
139
|
+
onAuthStateChange?.(user);
|
|
140
|
+
}, [applyLanguagePreference, loginSuccess, onAuthStateChange, oxyServices, saveActiveSessionId, setTokenReady]);
|
|
141
|
+
const trackRemovedSession = (0, _react.useCallback)(sessionId => {
|
|
142
|
+
removedSessionsRef.current.add(sessionId);
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
removedSessionsRef.current.delete(sessionId);
|
|
145
|
+
}, 5000);
|
|
146
|
+
}, []);
|
|
147
|
+
const findReplacementSession = (0, _react.useCallback)(async sessionIds => {
|
|
148
|
+
if (!sessionIds.length) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const validationResults = await (0, _sessionHelpers.validateSessionBatch)(oxyServices, sessionIds, {
|
|
152
|
+
maxConcurrency: 3
|
|
153
|
+
});
|
|
154
|
+
const validSession = validationResults.find(result => result.valid);
|
|
155
|
+
if (!validSession) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const validation = await oxyServices.validateSession(validSession.sessionId, {
|
|
159
|
+
useHeaderValidation: true
|
|
160
|
+
});
|
|
161
|
+
if (!validation?.valid || !validation.user) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const user = validation.user;
|
|
165
|
+
await activateSession(validSession.sessionId, user);
|
|
166
|
+
return user;
|
|
167
|
+
}, [activateSession, oxyServices]);
|
|
168
|
+
const switchSession = (0, _react.useCallback)(async sessionId => {
|
|
169
|
+
try {
|
|
170
|
+
const validation = await oxyServices.validateSession(sessionId, {
|
|
171
|
+
useHeaderValidation: true
|
|
172
|
+
});
|
|
173
|
+
if (!validation?.valid) {
|
|
174
|
+
throw new Error('Session is invalid or expired');
|
|
175
|
+
}
|
|
176
|
+
if (!validation.user) {
|
|
177
|
+
throw new Error('User data not available from session validation');
|
|
178
|
+
}
|
|
179
|
+
const user = validation.user;
|
|
180
|
+
await activateSession(sessionId, user);
|
|
181
|
+
try {
|
|
182
|
+
const deviceSessions = await (0, _sessionHelpers.fetchSessionsWithFallback)(oxyServices, sessionId, {
|
|
183
|
+
fallbackUserId: user.id,
|
|
184
|
+
logger
|
|
185
|
+
});
|
|
186
|
+
updateSessions(deviceSessions, {
|
|
187
|
+
merge: true
|
|
188
|
+
});
|
|
189
|
+
} catch (error) {
|
|
190
|
+
if (__DEV__) {
|
|
191
|
+
console.warn('Failed to synchronize sessions after switch:', error);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return user;
|
|
195
|
+
} catch (error) {
|
|
196
|
+
const invalidSession = (0, _errorHandlers.isInvalidSessionError)(error);
|
|
197
|
+
if (invalidSession) {
|
|
198
|
+
updateSessions(sessions.filter(session => session.sessionId !== sessionId), {
|
|
199
|
+
merge: false
|
|
200
|
+
});
|
|
201
|
+
if (sessionId === activeSessionId) {
|
|
202
|
+
const otherSessionIds = sessions.filter(session => session.sessionId !== sessionId && !removedSessionsRef.current.has(session.sessionId)).map(session => session.sessionId);
|
|
203
|
+
const replacementUser = await findReplacementSession(otherSessionIds);
|
|
204
|
+
if (replacementUser) {
|
|
205
|
+
return replacementUser;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
(0, _errorHandlers.handleAuthError)(error, {
|
|
210
|
+
defaultMessage: 'Failed to switch session',
|
|
211
|
+
code: invalidSession ? 'INVALID_SESSION' : 'SESSION_SWITCH_ERROR',
|
|
212
|
+
onError,
|
|
213
|
+
setAuthError,
|
|
214
|
+
logger
|
|
215
|
+
});
|
|
216
|
+
throw error instanceof Error ? error : new Error('Failed to switch session');
|
|
217
|
+
}
|
|
218
|
+
}, [activateSession, activeSessionId, findReplacementSession, logger, loginSuccess, onError, oxyServices, sessions, setAuthError, updateSessions]);
|
|
219
|
+
const refreshSessions = (0, _react.useCallback)(async activeUserId => {
|
|
220
|
+
if (!activeSessionId) return;
|
|
221
|
+
if (refreshInFlightRef.current) {
|
|
222
|
+
await refreshInFlightRef.current;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const now = Date.now();
|
|
226
|
+
if (now - lastRefreshRef.current < 500) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
lastRefreshRef.current = now;
|
|
230
|
+
const refreshPromise = (async () => {
|
|
231
|
+
try {
|
|
232
|
+
const deviceSessions = await (0, _sessionHelpers.fetchSessionsWithFallback)(oxyServices, activeSessionId, {
|
|
233
|
+
fallbackUserId: activeUserId,
|
|
234
|
+
logger
|
|
235
|
+
});
|
|
236
|
+
updateSessions(deviceSessions, {
|
|
237
|
+
merge: true
|
|
238
|
+
});
|
|
239
|
+
} catch (error) {
|
|
240
|
+
if ((0, _errorHandlers.isInvalidSessionError)(error)) {
|
|
241
|
+
const otherSessions = sessions.filter(session => session.sessionId !== activeSessionId && !removedSessionsRef.current.has(session.sessionId)).map(session => session.sessionId);
|
|
242
|
+
const replacementUser = await findReplacementSession(otherSessions);
|
|
243
|
+
if (!replacementUser) {
|
|
244
|
+
await clearSessionState();
|
|
245
|
+
}
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
(0, _errorHandlers.handleAuthError)(error, {
|
|
249
|
+
defaultMessage: 'Failed to refresh sessions',
|
|
250
|
+
code: 'SESSION_REFRESH_ERROR',
|
|
251
|
+
onError,
|
|
252
|
+
setAuthError,
|
|
253
|
+
logger
|
|
254
|
+
});
|
|
255
|
+
} finally {
|
|
256
|
+
refreshInFlightRef.current = null;
|
|
257
|
+
lastRefreshRef.current = Date.now();
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
refreshInFlightRef.current = refreshPromise;
|
|
261
|
+
await refreshPromise;
|
|
262
|
+
}, [activeSessionId, clearSessionState, findReplacementSession, logger, onError, oxyServices, sessions, setAuthError, updateSessions]);
|
|
263
|
+
const isRefreshInFlight = Boolean(refreshInFlightRef.current);
|
|
264
|
+
return {
|
|
265
|
+
sessions,
|
|
266
|
+
activeSessionId,
|
|
267
|
+
setActiveSessionId,
|
|
268
|
+
updateSessions,
|
|
269
|
+
switchSession,
|
|
270
|
+
refreshSessions,
|
|
271
|
+
clearSessionState,
|
|
272
|
+
saveActiveSessionId,
|
|
273
|
+
trackRemovedSession,
|
|
274
|
+
storageKeys,
|
|
275
|
+
isRefreshInFlight
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
exports.useSessionManagement = useSessionManagement;
|
|
279
|
+
//# sourceMappingURL=useSessionManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_sessionUtils","_sessionHelpers","_storageHelpers","_errorHandlers","_queryClient","DEFAULT_SAVE_ERROR_MESSAGE","CLEAR_STORAGE_ERROR","useSessionManagement","oxyServices","storage","storageKeyPrefix","loginSuccess","logoutStore","applyLanguagePreference","onAuthStateChange","onError","setAuthError","logger","setTokenReady","queryClient","sessions","setSessions","useState","activeSessionId","setActiveSessionId","refreshInFlightRef","useRef","removedSessionsRef","Set","lastRefreshRef","storageKeys","useMemo","getStorageKeys","saveSessionIds","useCallback","sessionIds","uniqueIds","Array","from","setItem","JSON","stringify","error","__DEV__","console","warn","updateSessions","incoming","options","prevSessions","processed","merge","mergeSessions","normalizeAndSortSessions","map","session","sessionId","sessionsArraysEqual","saveActiveSessionId","handleAuthError","defaultMessage","code","removeActiveSessionId","removeItem","clearSessionStorage","clearSessionState","clear","clearQueryCache","activateSession","user","getTokenBySession","trackRemovedSession","current","add","setTimeout","delete","findReplacementSession","length","validationResults","validateSessionBatch","maxConcurrency","validSession","find","result","valid","validation","validateSession","useHeaderValidation","switchSession","Error","deviceSessions","fetchSessionsWithFallback","fallbackUserId","id","invalidSession","isInvalidSessionError","filter","otherSessionIds","has","replacementUser","refreshSessions","activeUserId","now","Date","refreshPromise","otherSessions","isRefreshInFlight","Boolean","exports"],"sourceRoot":"../../../../../src","sources":["ui/context/hooks/useSessionManagement.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAGA,IAAAK,YAAA,GAAAL,OAAA;AA+BA,MAAMM,0BAA0B,GAAG,6BAA6B;AAChE,MAAMC,mBAAmB,GAAG,yBAAyB;;AAErD;AACA;AACA;AACA;AACA;AACO,MAAMC,oBAAoB,GAAGA,CAAC;EACnCC,WAAW;EACXC,OAAO;EACPC,gBAAgB;EAChBC,YAAY;EACZC,WAAW;EACXC,uBAAuB;EACvBC,iBAAiB;EACjBC,OAAO;EACPC,YAAY;EACZC,MAAM;EACNC,aAAa;EACbC;AAC2B,CAAC,KAAiC;EAC7D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EAAkB,EAAE,CAAC;EAC7D,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAG,IAAAF,eAAQ,EAAgB,IAAI,CAAC;EAE3E,MAAMG,kBAAkB,GAAG,IAAAC,aAAM,EAAuB,IAAI,CAAC;EAC7D,MAAMC,kBAAkB,GAAG,IAAAD,aAAM,EAAc,IAAIE,GAAG,CAAC,CAAC,CAAC;EACzD,MAAMC,cAAc,GAAG,IAAAH,aAAM,EAAS,CAAC,CAAC;EAExC,MAAMI,WAAW,GAAG,IAAAC,cAAO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,WAAW,EACXY,QAAQ,EACRJ,YAAY,EACZ8B,cAAc,CAElB,CAAC;EAED,MAAM4D,iBAAiB,GAAGC,OAAO,CAAClF,kBAAkB,CAAC+C,OAAO,CAAC;EAE7D,OAAO;IACLpD,QAAQ;IACRG,eAAe;IACfC,kBAAkB;IAClBsB,cAAc;IACd0C,aAAa;IACbY,eAAe;IACfnC,iBAAiB;IACjBP,mBAAmB;IACnBa,mBAAmB;IACnBzC,WAAW;IACX4E;EACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAArG,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -3,12 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "executeWithToast", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useAsyncAction.executeWithToast;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "setOxyFileUrlInstance", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
9
15
|
return _useFileDownloadUrl.setOxyFileUrlInstance;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "useAsyncAction", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useAsyncAction.useAsyncAction;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
12
24
|
Object.defineProperty(exports, "useFileDownloadUrl", {
|
|
13
25
|
enumerable: true,
|
|
14
26
|
get: function () {
|
|
@@ -27,6 +39,18 @@ Object.defineProperty(exports, "useFollowerCounts", {
|
|
|
27
39
|
return _useFollow.useFollowerCounts;
|
|
28
40
|
}
|
|
29
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "useSettingToggle", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _useSettingToggle.useSettingToggle;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "useSettingToggles", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _useSettingToggle.useSettingToggles;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
30
54
|
Object.defineProperty(exports, "useThemeColors", {
|
|
31
55
|
enumerable: true,
|
|
32
56
|
get: function () {
|
|
@@ -43,4 +67,6 @@ var _useFollow = require("./useFollow");
|
|
|
43
67
|
var _useFileDownloadUrl = require("./useFileDownloadUrl");
|
|
44
68
|
var _useThemeStyles = require("./useThemeStyles");
|
|
45
69
|
var _useThemeColors = require("./useThemeColors");
|
|
70
|
+
var _useAsyncAction = require("./useAsyncAction");
|
|
71
|
+
var _useSettingToggle = require("./useSettingToggle");
|
|
46
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useFollow","require","_useFileDownloadUrl","_useThemeStyles","_useThemeColors"],"sourceRoot":"../../../../src","sources":["ui/hooks/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_useFollow","require","_useFileDownloadUrl","_useThemeStyles","_useThemeColors","_useAsyncAction","_useSettingToggle"],"sourceRoot":"../../../../src","sources":["ui/hooks/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA","ignoreList":[]}
|