@oxyhq/services 5.17.17 → 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 -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/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/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 -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/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/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 -195
- 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 +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/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
|
@@ -1,53 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/** Auth store for Services SDK (sessions/tokens only). */
|
|
4
|
-
|
|
5
3
|
import { create } from 'zustand';
|
|
6
4
|
export const useAuthStore = create((set, get) => ({
|
|
5
|
+
user: null,
|
|
7
6
|
isAuthenticated: false,
|
|
8
|
-
isOnline: true,
|
|
9
|
-
// Assume online initially
|
|
10
7
|
isLoading: false,
|
|
11
8
|
error: null,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
set({
|
|
15
|
-
isOnline: online
|
|
16
|
-
});
|
|
17
|
-
// If we go offline, we can't be authenticated
|
|
18
|
-
if (!online) {
|
|
19
|
-
set({
|
|
20
|
-
isAuthenticated: false
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
loginSuccess: () => set({
|
|
9
|
+
lastUserFetch: null,
|
|
10
|
+
loginSuccess: user => set({
|
|
25
11
|
isLoading: false,
|
|
26
|
-
isAuthenticated:
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
isAuthenticated: true,
|
|
13
|
+
user,
|
|
14
|
+
lastUserFetch: Date.now()
|
|
29
15
|
}),
|
|
30
16
|
loginFailure: error => set({
|
|
31
17
|
isLoading: false,
|
|
32
|
-
isAuthenticated: false,
|
|
33
18
|
error
|
|
34
19
|
}),
|
|
35
20
|
logout: () => set({
|
|
21
|
+
user: null,
|
|
36
22
|
isAuthenticated: false,
|
|
37
|
-
|
|
38
|
-
identitySynced: false
|
|
23
|
+
lastUserFetch: null
|
|
39
24
|
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
setUser: user => set({
|
|
26
|
+
user,
|
|
27
|
+
lastUserFetch: Date.now()
|
|
43
28
|
}),
|
|
44
|
-
|
|
45
|
-
* Check if user can authenticate
|
|
46
|
-
* Requires both valid tokens (checked by caller) and network
|
|
47
|
-
*/
|
|
48
|
-
canAuthenticate: () => {
|
|
29
|
+
fetchUser: async (oxyServices, forceRefresh = false) => {
|
|
49
30
|
const state = get();
|
|
50
|
-
|
|
31
|
+
const now = Date.now();
|
|
32
|
+
const cacheAge = state.lastUserFetch ? now - state.lastUserFetch : Number.POSITIVE_INFINITY;
|
|
33
|
+
const cacheValid = cacheAge < 5 * 60 * 1000; // 5 minutes cache
|
|
34
|
+
|
|
35
|
+
// Use cached data if available and not forcing refresh
|
|
36
|
+
if (!forceRefresh && state.user && cacheValid) {
|
|
37
|
+
if (__DEV__) {
|
|
38
|
+
console.log('AuthStore: Using cached user data (age:', cacheAge, 'ms)');
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
set({
|
|
43
|
+
isLoading: true,
|
|
44
|
+
error: null
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
const user = await oxyServices.getCurrentUser();
|
|
48
|
+
set({
|
|
49
|
+
user,
|
|
50
|
+
isLoading: false,
|
|
51
|
+
isAuthenticated: true,
|
|
52
|
+
lastUserFetch: now
|
|
53
|
+
});
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to fetch user';
|
|
56
|
+
if (__DEV__) {
|
|
57
|
+
console.error('AuthStore: Error fetching user:', error);
|
|
58
|
+
}
|
|
59
|
+
set({
|
|
60
|
+
error: errorMessage,
|
|
61
|
+
isLoading: false
|
|
62
|
+
});
|
|
63
|
+
}
|
|
51
64
|
}
|
|
52
65
|
}));
|
|
53
66
|
//# sourceMappingURL=authStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["create","useAuthStore","set","get","
|
|
1
|
+
{"version":3,"names":["create","useAuthStore","set","get","user","isAuthenticated","isLoading","error","lastUserFetch","loginSuccess","Date","now","loginFailure","logout","setUser","fetchUser","oxyServices","forceRefresh","state","cacheAge","Number","POSITIVE_INFINITY","cacheValid","__DEV__","console","log","getCurrentUser","errorMessage","Error","message"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAiBhC,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAY,CAACE,GAAwC,EAAEC,GAAoB,MAAM;EACjHC,IAAI,EAAE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MAAEC,KAAK,EAAE;IAAK,CAAC,CAAC;IACrC,IAAI;MACF,MAAMH,IAAI,GAAG,MAAMY,WAAW,CAACU,cAAc,CAAC,CAAC;MAC/CxB,GAAG,CAAC;QAAEE,IAAI;QAAEE,SAAS,EAAE,KAAK;QAAED,eAAe,EAAE,IAAI;QAAEG,aAAa,EAAEG;MAAI,CAAC,CAAC;IAC5E,CAAC,CAAC,OAAOJ,KAAK,EAAE;MACd,MAAMoB,YAAY,GAAGpB,KAAK,YAAYqB,KAAK,GAAGrB,KAAK,CAACsB,OAAO,GAAG,sBAAsB;MACpF,IAAIN,OAAO,EAAE;QACbC,OAAO,CAACjB,KAAK,CAAC,iCAAiC,EAAEA,KAAK,CAAC;MACvD;MACAL,GAAG,CAAC;QAAEK,KAAK,EAAEoB,YAAY;QAAErB,SAAS,EAAE;MAAM,CAAC,CAAC;IAChD;EACF;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -10,7 +10,11 @@ import { StyleSheet } from 'react-native';
|
|
|
10
10
|
export const STEP_GAP = 12; // Vertical gap between ALL elements (illustration, title, description, textfield, buttons, etc.) - must be consistent everywhere
|
|
11
11
|
export const STEP_INNER_GAP = 12; // Gap within sections (headers, cards, etc.) - must match STEP_GAP for uniformity
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Re-export screen spacing constants from constants/spacing.ts
|
|
15
|
+
* This allows importing all spacing constants from a single location
|
|
16
|
+
*/
|
|
17
|
+
export { SCREEN_PADDING_HORIZONTAL, SCREEN_PADDING_VERTICAL, SECTION_GAP, SECTION_GAP_LARGE, COMPONENT_GAP, COMPONENT_GAP_SMALL, HEADER_PADDING_TOP_OVERVIEW, HEADER_PADDING_TOP_SETTINGS } from '../constants/spacing';
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* Reusable stylesheet for step components
|
|
@@ -26,7 +30,7 @@ export const stepStyles = StyleSheet.create({
|
|
|
26
30
|
},
|
|
27
31
|
sectionSpacing: {
|
|
28
32
|
// Layout removed - do NOT use for spacing, use explicit marginBottom: 0
|
|
29
|
-
// This should not add margins
|
|
33
|
+
// This is kept for backward compatibility but should not add margins
|
|
30
34
|
marginBottom: 0
|
|
31
35
|
},
|
|
32
36
|
header: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","STEP_GAP","STEP_INNER_GAP","stepStyles","create","container","width","maxWidth","alignSelf","sectionSpacing","marginBottom","header","alignItems","gap","title","textAlign","marginTop","subtitle","buttonContainer"],"sourceRoot":"../../../../src","sources":["ui/styles/spacing.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG,EAAE,CAAC,CAAC;AAC5B,OAAO,MAAMC,cAAc,GAAG,EAAE,CAAC,CAAC;;AAElC;;
|
|
1
|
+
{"version":3,"names":["StyleSheet","STEP_GAP","STEP_INNER_GAP","SCREEN_PADDING_HORIZONTAL","SCREEN_PADDING_VERTICAL","SECTION_GAP","SECTION_GAP_LARGE","COMPONENT_GAP","COMPONENT_GAP_SMALL","HEADER_PADDING_TOP_OVERVIEW","HEADER_PADDING_TOP_SETTINGS","stepStyles","create","container","width","maxWidth","alignSelf","sectionSpacing","marginBottom","header","alignItems","gap","title","textAlign","marginTop","subtitle","buttonContainer"],"sourceRoot":"../../../../src","sources":["ui/styles/spacing.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG,EAAE,CAAC,CAAC;AAC5B,OAAO,MAAMC,cAAc,GAAG,EAAE,CAAC,CAAC;;AAElC;AACA;AACA;AACA;AACA,SACIC,yBAAyB,EACzBC,uBAAuB,EACvBC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,mBAAmB,EACnBC,2BAA2B,EAC3BC,2BAA2B,QACxB,sBAAsB;;AAE7B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGX,UAAU,CAACY,MAAM,CAAC;EACxCC,SAAS,EAAE;IACP;IACAC,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE,GAAG;IACbC,SAAS,EAAE;EACf,CAAC;EACDC,cAAc,EAAE;IACZ;IACA;IACAC,YAAY,EAAE;EAClB,CAAC;EACDC,MAAM,EAAE;IACJC,UAAU,EAAE,YAAY;IACxBN,KAAK,EAAE,MAAM;IACbO,GAAG,EAAEnB;EACT,CAAC;EACDoB,KAAK,EAAE;IACHC,SAAS,EAAE,MAAM;IACjBL,YAAY,EAAE,CAAC;IACfM,SAAS,EAAE;EACf,CAAC;EACDC,QAAQ,EAAE;IACNF,SAAS,EAAE,MAAM;IACjBR,QAAQ,EAAE,GAAG;IACbC,SAAS,EAAE,YAAY;IACvBE,YAAY,EAAE,CAAC;IACfM,SAAS,EAAE;EACf,CAAC;EACDE,eAAe,EAAE;IACbF,SAAS,EAAE,CAAC;IACZN,YAAY,EAAE;EAClB;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useAccountStore } from '../stores/accountStore';
|
|
4
|
+
import { useAuthStore } from '../stores/authStore';
|
|
4
5
|
import { queryKeys, invalidateUserQueries, invalidateAccountQueries } from '../hooks/queries/queryKeys';
|
|
5
|
-
import { logger } from '../../utils/loggerUtils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Updates file visibility to public for avatar use.
|
|
@@ -29,7 +29,6 @@ export async function updateAvatarVisibility(fileId, oxyServices, contextName =
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* @deprecated Use refreshAccountInStore instead for full profile sync
|
|
33
32
|
* Refreshes avatar in accountStore with cache-busted URL to force image reload.
|
|
34
33
|
*
|
|
35
34
|
* @param sessionId - The session ID for the account to update
|
|
@@ -47,34 +46,6 @@ export function refreshAvatarInStore(sessionId, avatarFileId, oxyServices) {
|
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
/**
|
|
51
|
-
* Refreshes all user profile data in accountStore (username, displayName, avatar).
|
|
52
|
-
* This ensures accountStore stays in sync with profile changes.
|
|
53
|
-
*
|
|
54
|
-
* @param sessionId - The session ID for the account to update
|
|
55
|
-
* @param userData - The updated user data
|
|
56
|
-
* @param oxyServices - OxyServices instance to generate download URL
|
|
57
|
-
*/
|
|
58
|
-
export function refreshAccountInStore(sessionId, userData, oxyServices) {
|
|
59
|
-
const {
|
|
60
|
-
updateAccount
|
|
61
|
-
} = useAccountStore.getState();
|
|
62
|
-
const displayName = userData.name?.full || userData.name?.first || userData.username || 'Account';
|
|
63
|
-
const avatarUrl = userData.avatar ? oxyServices.getFileDownloadUrl(userData.avatar, 'thumb') + `?t=${Date.now()}` : undefined;
|
|
64
|
-
logger.debug('Refreshing account in store', {
|
|
65
|
-
component: 'AccountStore',
|
|
66
|
-
sessionId,
|
|
67
|
-
username: userData.username,
|
|
68
|
-
hasAvatar: !!userData.avatar
|
|
69
|
-
});
|
|
70
|
-
updateAccount(sessionId, {
|
|
71
|
-
username: userData.username,
|
|
72
|
-
displayName,
|
|
73
|
-
avatar: userData.avatar,
|
|
74
|
-
avatarUrl
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
49
|
/**
|
|
79
50
|
* Updates user profile with avatar and handles all side effects (query invalidation, accountStore update).
|
|
80
51
|
* This function can be used from within OxyContext provider without requiring useOxy hook.
|
|
@@ -83,18 +54,30 @@ export function refreshAccountInStore(sessionId, userData, oxyServices) {
|
|
|
83
54
|
* @param oxyServices - OxyServices instance
|
|
84
55
|
* @param activeSessionId - Active session ID
|
|
85
56
|
* @param queryClient - TanStack Query client
|
|
57
|
+
* @param syncSession - Optional function to sync session/refresh token when auth errors occur
|
|
86
58
|
* @returns Promise that resolves with updated user data
|
|
87
59
|
*/
|
|
88
|
-
export async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient,
|
|
89
|
-
const {
|
|
90
|
-
deviceId
|
|
91
|
-
} = options || {};
|
|
60
|
+
export async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient, syncSession) {
|
|
92
61
|
// Ensure we have a valid token before making the request
|
|
93
62
|
if (!oxyServices.hasValidToken() && activeSessionId) {
|
|
94
63
|
try {
|
|
95
|
-
await oxyServices.getTokenBySession(activeSessionId
|
|
64
|
+
await oxyServices.getTokenBySession(activeSessionId);
|
|
96
65
|
} catch (tokenError) {
|
|
97
|
-
|
|
66
|
+
const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
|
|
67
|
+
if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
|
|
68
|
+
if (syncSession) {
|
|
69
|
+
try {
|
|
70
|
+
await syncSession();
|
|
71
|
+
await oxyServices.getTokenBySession(activeSessionId);
|
|
72
|
+
} catch (syncError) {
|
|
73
|
+
throw new Error('Session needs to be synced. Please try again.');
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
throw tokenError;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
throw tokenError;
|
|
80
|
+
}
|
|
98
81
|
}
|
|
99
82
|
}
|
|
100
83
|
try {
|
|
@@ -106,9 +89,12 @@ export async function updateProfileWithAvatar(updates, oxyServices, activeSessio
|
|
|
106
89
|
queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
|
|
107
90
|
}
|
|
108
91
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
92
|
+
// Update authStore so frontend components see the changes immediately
|
|
93
|
+
useAuthStore.getState().setUser(data);
|
|
94
|
+
|
|
95
|
+
// If avatar was updated, refresh accountStore with cache-busted URL
|
|
96
|
+
if (updates.avatar && activeSessionId) {
|
|
97
|
+
refreshAvatarInStore(activeSessionId, updates.avatar, oxyServices);
|
|
112
98
|
}
|
|
113
99
|
|
|
114
100
|
// Invalidate all related queries to refresh everywhere
|
|
@@ -121,7 +107,18 @@ export async function updateProfileWithAvatar(updates, oxyServices, activeSessio
|
|
|
121
107
|
|
|
122
108
|
// Handle authentication errors
|
|
123
109
|
if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
|
|
124
|
-
|
|
110
|
+
if (activeSessionId && syncSession) {
|
|
111
|
+
try {
|
|
112
|
+
await syncSession();
|
|
113
|
+
await oxyServices.getTokenBySession(activeSessionId);
|
|
114
|
+
// Retry the update after getting token
|
|
115
|
+
return await updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient, syncSession);
|
|
116
|
+
} catch (retryError) {
|
|
117
|
+
throw new Error('Authentication failed. Please sign in again.');
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
throw new Error('No active session. Please sign in.');
|
|
121
|
+
}
|
|
125
122
|
}
|
|
126
123
|
throw error;
|
|
127
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAccountStore","queryKeys","invalidateUserQueries","invalidateAccountQueries","
|
|
1
|
+
{"version":3,"names":["useAccountStore","useAuthStore","queryKeys","invalidateUserQueries","invalidateAccountQueries","updateAvatarVisibility","fileId","oxyServices","contextName","startsWith","assetUpdateVisibility","visError","refreshAvatarInStore","sessionId","avatarFileId","updateAccount","getState","cacheBustedUrl","getFileDownloadUrl","Date","now","avatar","avatarUrl","updateProfileWithAvatar","updates","activeSessionId","queryClient","syncSession","hasValidToken","getTokenBySession","tokenError","errorMessage","Error","message","String","includes","syncError","data","updateProfile","setQueryData","accounts","current","users","profile","setUser","error","status","response","retryError"],"sourceRoot":"../../../../src","sources":["ui/utils/avatarUtils.ts"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,YAAY,QAAQ,qBAAqB;AAElD,SAASC,SAAS,EAAEC,qBAAqB,EAAEC,wBAAwB,QAAQ,4BAA4B;;AAEvG;AACA;AACA;A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AAK,GAAG,IAAIf,YAAY,CAACI,QAAQ,CAAC,yBAAyB,CAAC,IAAIJ,YAAY,CAACI,QAAQ,CAAC,yCAAyC,CAAC,EAAE;MAC1I,IAAIV,eAAe,IAAIE,WAAW,EAAE;QAClC,IAAI;UACF,MAAMA,WAAW,CAAC,CAAC;UACnB,MAAMpB,WAAW,CAACsB,iBAAiB,CAACJ,eAAe,CAAC;UACpD;UACA,OAAO,MAAMF,uBAAuB,CAACC,OAAO,EAAEjB,WAAW,EAAEkB,eAAe,EAAEC,WAAW,EAAEC,WAAW,CAAC;QACvG,CAAC,CAAC,OAAOqB,UAAU,EAAE;UACnB,MAAM,IAAIhB,KAAK,CAAC,8CAA8C,CAAC;QACjE;MACF,CAAC,MAAM;QACL,MAAM,IAAIA,KAAK,CAAC,oCAAoC,CAAC;MACvD;IACF;IAEA,MAAMa,KAAK;EACb;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MEMORY_STORAGE","store","Map","getItem","key","has","get","setItem","value","set","removeItem","delete","clear","createWebStorage","window","localStorage","asyncStorageInstance","createNativeStorage","asyncStorageModule","default","error","__DEV__","console","Error","isReactNative","navigator","product","createPlatformStorage","STORAGE_KEY_PREFIX","getStorageKeys","prefix","activeSessionId","sessionIds","language"],"sourceRoot":"../../../../src","sources":["ui/utils/storageHelpers.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["MEMORY_STORAGE","store","Map","getItem","key","has","get","setItem","value","set","removeItem","delete","clear","createWebStorage","window","localStorage","asyncStorageInstance","createNativeStorage","asyncStorageModule","default","error","__DEV__","console","Error","isReactNative","navigator","product","createPlatformStorage","STORAGE_KEY_PREFIX","getStorageKeys","prefix","activeSessionId","sessionIds","language"],"sourceRoot":"../../../../src","sources":["ui/utils/storageHelpers.ts"],"mappings":";;AAaA;AACA;AACA;AACA,MAAMA,cAAc,GAAGA,CAAA,KAAwB;EAC7C,MAAMC,KAAK,GAAG,IAAIC,GAAG,CA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
157
|
});
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Retry function with exponential backoff
|
|
163
|
+
* Re-exports retryAsync for backward compatibility
|
|
164
|
+
* @deprecated Use retryAsync from asyncUtils instead
|
|
165
|
+
*/
|
|
166
|
+
export { retryAsync as retryWithBackoff } from './asyncUtils';
|
|
160
167
|
//# sourceMappingURL=errorUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["logger","ErrorCodes","UNAUTHORIZED","FORBIDDEN","INVALID_TOKEN","MISSING_TOKEN","VALIDATION_ERROR","BAD_REQUEST","MISSING_PARAMETER","INVALID_FORMAT","NOT_FOUND","ALREADY_EXISTS","CONFLICT","INTERNAL_ERROR","SERVICE_UNAVAILABLE","TIMEOUT","NETWORK_ERROR","CONNECTION_FAILED","createApiError","message","code","status","details","handleHttpError","error","apiError","trim","Error","name","TypeError","includes","fetchError","response","getErrorCodeFromStatus","errorString","String","validateRequiredFields","data","fields","missing","filter","field","length","join","logError","context","component","method","stack"],"sourceRoot":"../../../src","sources":["utils/errorUtils.ts"],"mappings":";;AACA,SAASA,MAAM,QAAQ,eAAe;;AAEtC;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG;EACxB;EACAC,YAAY,EAAE,cAAc;EAC5BC,SAAS,EAAE,WAAW;EACtBC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAE9B;EACAC,gBAAgB,EAAE,kBAAkB;EACpCC,WAAW,EAAE,aAAa;EAC1BC,iBAAiB,EAAE,mBAAmB;EACtCC,cAAc,EAAE,gBAAgB;EAEhC;EACAC,SAAS,EAAE,WAAW;EACtBC,cAAc,EAAE,gBAAgB;EAChCC,QAAQ,EAAE,UAAU;EAEpB;EACAC,cAAc,EAAE,gBAAgB;EAChCC,mBAAmB,EAAE,qBAAqB;EAC1CC,OAAO,EAAE,SAAS;EAElB;EACAC,aAAa,EAAE,e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AACwB,KAAK,CAACW,MAAM,CAACX,KAAK,CAAC,EAAE;MAC1BsB,SAAS,EAAED,OAAO,IAAI,YAAY;MAClCE,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["logger","ErrorCodes","UNAUTHORIZED","FORBIDDEN","INVALID_TOKEN","MISSING_TOKEN","VALIDATION_ERROR","BAD_REQUEST","MISSING_PARAMETER","INVALID_FORMAT","NOT_FOUND","ALREADY_EXISTS","CONFLICT","INTERNAL_ERROR","SERVICE_UNAVAILABLE","TIMEOUT","NETWORK_ERROR","CONNECTION_FAILED","createApiError","message","code","status","details","handleHttpError","error","apiError","trim","Error","name","TypeError","includes","fetchError","response","getErrorCodeFromStatus","errorString","String","validateRequiredFields","data","fields","missing","filter","field","length","join","logError","context","component","method","stack","retryAsync","retryWithBackoff"],"sourceRoot":"../../../src","sources":["utils/errorUtils.ts"],"mappings":";;AACA,SAASA,MAAM,QAAQ,eAAe;;AAEtC;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG;EACxB;EACAC,YAAY,EAAE,cAAc;EAC5BC,SAAS,EAAE,WAAW;EACtBC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAE9B;EACAC,gBAAgB,EAAE,kBAAkB;EACpCC,WAAW,EAAE,aAAa;EAC1BC,iBAAiB,EAAE,mBAAmB;EACtCC,cAAc,EAAE,gBAAgB;EAEhC;EACAC,SAAS,EAAE,WAAW;EACtBC,cAAc,EAAE,gBAAgB;EAChCC,QAAQ,EAAE,UAAU;EAEpB;EACAC,cAAc,EAAE,gBAAgB;EAChCC,mBAAmB,EAAE,qBAAqB;EAC1CC,OAAO,EAAE,SAAS;EAElB;EACAC,aAAa,EAAE,eAAe;EAC9BC,iBAAiB,EAAE;AACrB,CAAU;;AAEV;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,OAAe,EACfC,IAAY,GAAGnB,UAAU,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C;EACJ;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASE,UAAU,IAAIC,gBAAgB,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -14,6 +14,12 @@ export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
14
14
|
*/
|
|
15
15
|
export const USERNAME_REGEX = /^[a-zA-Z0-9_-]{3,30}$/;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Password validation regex (at least 8 chars, 1 uppercase, 1 lowercase, 1 number)
|
|
19
|
+
*/
|
|
20
|
+
// At least 8 characters (tests expect len>=8 without complexity requirements)
|
|
21
|
+
export const PASSWORD_REGEX = /^.{8,}$/;
|
|
22
|
+
|
|
17
23
|
/**
|
|
18
24
|
* Validate email format
|
|
19
25
|
*/
|
|
@@ -28,6 +34,13 @@ export function isValidUsername(username) {
|
|
|
28
34
|
return USERNAME_REGEX.test(username);
|
|
29
35
|
}
|
|
30
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Validate password strength
|
|
39
|
+
*/
|
|
40
|
+
export function isValidPassword(password) {
|
|
41
|
+
return PASSWORD_REGEX.test(password);
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
/**
|
|
32
45
|
* Validate required string
|
|
33
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EMAIL_REGEX","USERNAME_REGEX","isValidEmail","email","test","isValidUsername","username","isRequiredString","value","trim","length","isRequiredNumber","Number","isNaN","isRequiredBoolean","isValidArray","Array","isArray","isValidObject","isValidUUID","uuid","UUID_REGEX","isValidURL","url","URL","isValidDate","dateString","date","Date","getTime","isValidFileSize","size","maxSize","isValidFileType","filename","allowedTypes","extension","split","pop","toLowerCase","includes","sanitizeString","input","replace","sanitizeHTML","isValidObjectId","id","OBJECT_ID_REGEX","validateAndSanitizeUserInput","type","sanitized"],"sourceRoot":"../../../src","sources":["utils/validationUtils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,4BAA4B;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,uBAAuB;;
|
|
1
|
+
{"version":3,"names":["EMAIL_REGEX","USERNAME_REGEX","PASSWORD_REGEX","isValidEmail","email","test","isValidUsername","username","isValidPassword","password","isRequiredString","value","trim","length","isRequiredNumber","Number","isNaN","isRequiredBoolean","isValidArray","Array","isArray","isValidObject","isValidUUID","uuid","UUID_REGEX","isValidURL","url","URL","isValidDate","dateString","date","Date","getTime","isValidFileSize","size","maxSize","isValidFileType","filename","allowedTypes","extension","split","pop","toLowerCase","includes","sanitizeString","input","replace","sanitizeHTML","isValidObjectId","id","OBJECT_ID_REGEX","validateAndSanitizeUserInput","type","sanitized"],"sourceRoot":"../../../src","sources":["utils/validationUtils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,4BAA4B;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,uBAAuB;;AAErD;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,SAAS;;AAEvC;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOJ,WAAW,CAACK,IAAI,CAACD,KAAK,CAAC;AAChC;;AAEA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAACC,QAAgB,EAAW;EACzD,OAAON,cAAc,CAACI,IAAI,CAACE,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,QAAgB,EAAW;EACzD,OAAOP,cAAc,CAACG,IAAI,CAACI,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAAc,EAAW;EACxD,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,IAAI,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAC7D;;AA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AGA,SAAS,GAAG,IAAI;IACnD,KAAK,UAAU;MACb,OAAO/C,eAAe,CAAC+C,SAAS,CAAC,GAAGA,SAAS,GAAG,IAAI;IACtD,KAAK,QAAQ;MACX,OAAO3C,gBAAgB,CAAC2C,SAAS,CAAC,GAAGA,SAAS,GAAG,IAAI;IACvD;MACE,OAAO,IAAI;EACf;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Domain Authentication Helper
|
|
3
|
+
*
|
|
4
|
+
* Provides a simplified API for cross-domain SSO authentication that automatically
|
|
5
|
+
* selects the best authentication method based on browser capabilities:
|
|
6
|
+
*
|
|
7
|
+
* 1. FedCM (if supported) - Modern, Google-style browser-native auth
|
|
8
|
+
* 2. Popup (fallback) - OAuth2-style popup window
|
|
9
|
+
* 3. Redirect (final fallback) - Traditional full-page redirect
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { CrossDomainAuth } from '@oxyhq/services';
|
|
14
|
+
*
|
|
15
|
+
* const auth = new CrossDomainAuth(oxyServices);
|
|
16
|
+
*
|
|
17
|
+
* // Automatic method selection
|
|
18
|
+
* const session = await auth.signIn();
|
|
19
|
+
*
|
|
20
|
+
* // Or use specific method
|
|
21
|
+
* const session = await auth.signInWithPopup();
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import type { OxyServices } from './OxyServices';
|
|
25
|
+
import type { SessionLoginResponse } from '../models/session';
|
|
26
|
+
export interface CrossDomainAuthOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Preferred authentication method
|
|
29
|
+
* - 'auto': Automatically select best method (default)
|
|
30
|
+
* - 'fedcm': Use FedCM (browser-native)
|
|
31
|
+
* - 'popup': Use popup window
|
|
32
|
+
* - 'redirect': Use full-page redirect
|
|
33
|
+
*/
|
|
34
|
+
method?: 'auto' | 'fedcm' | 'popup' | 'redirect';
|
|
35
|
+
/**
|
|
36
|
+
* Custom redirect URI (for redirect method)
|
|
37
|
+
*/
|
|
38
|
+
redirectUri?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to open signup page instead of login
|
|
41
|
+
*/
|
|
42
|
+
isSignup?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Popup window dimensions (for popup method)
|
|
45
|
+
*/
|
|
46
|
+
popupDimensions?: {
|
|
47
|
+
width?: number;
|
|
48
|
+
height?: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Callback when auth method is selected
|
|
52
|
+
*/
|
|
53
|
+
onMethodSelected?: (method: 'fedcm' | 'popup' | 'redirect') => void;
|
|
54
|
+
}
|
|
55
|
+
export declare class CrossDomainAuth {
|
|
56
|
+
private oxyServices;
|
|
57
|
+
constructor(oxyServices: OxyServices);
|
|
58
|
+
/**
|
|
59
|
+
* Sign in with automatic method selection
|
|
60
|
+
*
|
|
61
|
+
* Tries methods in this order:
|
|
62
|
+
* 1. FedCM (if supported and not in private browsing)
|
|
63
|
+
* 2. Popup (if not blocked)
|
|
64
|
+
* 3. Redirect (always works)
|
|
65
|
+
*
|
|
66
|
+
* @param options - Authentication options
|
|
67
|
+
* @returns Session with user data and access token
|
|
68
|
+
*/
|
|
69
|
+
signIn(options?: CrossDomainAuthOptions): Promise<SessionLoginResponse | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Automatic sign-in with progressive enhancement
|
|
72
|
+
*
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private autoSignIn;
|
|
76
|
+
/**
|
|
77
|
+
* Sign in using FedCM (Federated Credential Management)
|
|
78
|
+
*
|
|
79
|
+
* Best method - browser-native, no popups, Google-like experience
|
|
80
|
+
*/
|
|
81
|
+
signInWithFedCM(options?: CrossDomainAuthOptions): Promise<SessionLoginResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Sign in using popup window
|
|
84
|
+
*
|
|
85
|
+
* Good method - preserves app state, no full page reload
|
|
86
|
+
*/
|
|
87
|
+
signInWithPopup(options?: CrossDomainAuthOptions): Promise<SessionLoginResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Sign in using full-page redirect
|
|
90
|
+
*
|
|
91
|
+
* Fallback method - works everywhere but loses app state
|
|
92
|
+
*/
|
|
93
|
+
signInWithRedirect(options?: CrossDomainAuthOptions): void;
|
|
94
|
+
/**
|
|
95
|
+
* Handle redirect callback
|
|
96
|
+
*
|
|
97
|
+
* Call this on app startup to check if we're returning from auth redirect
|
|
98
|
+
*/
|
|
99
|
+
handleRedirectCallback(): SessionLoginResponse | null;
|
|
100
|
+
/**
|
|
101
|
+
* Silent sign-in (check for existing session)
|
|
102
|
+
*
|
|
103
|
+
* Tries to automatically sign in without user interaction.
|
|
104
|
+
* Works with both FedCM and popup/iframe methods.
|
|
105
|
+
*
|
|
106
|
+
* @returns Session if user is already signed in, null otherwise
|
|
107
|
+
*/
|
|
108
|
+
silentSignIn(): Promise<SessionLoginResponse | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Restore session from storage
|
|
111
|
+
*
|
|
112
|
+
* For redirect method - restores previously authenticated session from localStorage
|
|
113
|
+
*/
|
|
114
|
+
restoreSession(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Check if FedCM is supported in current browser
|
|
117
|
+
*/
|
|
118
|
+
isFedCMSupported(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Get recommended authentication method for current environment
|
|
121
|
+
*
|
|
122
|
+
* @returns Recommended method name and reason
|
|
123
|
+
*/
|
|
124
|
+
getRecommendedMethod(): {
|
|
125
|
+
method: 'fedcm' | 'popup' | 'redirect';
|
|
126
|
+
reason: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Initialize cross-domain auth on app startup
|
|
130
|
+
*
|
|
131
|
+
* This handles:
|
|
132
|
+
* 1. Redirect callback (if returning from auth.oxy.so)
|
|
133
|
+
* 2. Session restoration (from localStorage)
|
|
134
|
+
* 3. Silent sign-in (check for existing SSO session)
|
|
135
|
+
*
|
|
136
|
+
* @returns Session if user is authenticated, null otherwise
|
|
137
|
+
*/
|
|
138
|
+
initialize(): Promise<SessionLoginResponse | null>;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Helper function to create CrossDomainAuth instance
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* import { createCrossDomainAuth } from '@oxyhq/services';
|
|
146
|
+
*
|
|
147
|
+
* const oxyServices = new OxyServices({ baseURL: 'https://api.oxy.so' });
|
|
148
|
+
* const auth = createCrossDomainAuth(oxyServices);
|
|
149
|
+
*
|
|
150
|
+
* // On app startup
|
|
151
|
+
* const session = await auth.initialize();
|
|
152
|
+
* if (session) {
|
|
153
|
+
* console.log('User is signed in:', session.user);
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* // Sign in button click
|
|
157
|
+
* const session = await auth.signIn();
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare function createCrossDomainAuth(oxyServices: OxyServices): CrossDomainAuth;
|
|
161
|
+
//# sourceMappingURL=CrossDomainAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CrossDomainAuth.d.ts","sourceRoot":"","sources":["../../../src/core/CrossDomainAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAEjD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE;QAChB,KAAK,CA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HttpService {
|
|
39
39
|
private baseURL;
|
|
40
|
+
private tokenStore;
|
|
40
41
|
private cache;
|
|
41
42
|
private deduplicator;
|
|
42
43
|
private requestQueue;
|
|
@@ -64,7 +65,6 @@ export declare class HttpService {
|
|
|
64
65
|
private buildURL;
|
|
65
66
|
/**
|
|
66
67
|
* Get auth header with automatic token refresh
|
|
67
|
-
* Uses TokenService for all token operations
|
|
68
68
|
*/
|
|
69
69
|
private getAuthHeader;
|
|
70
70
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpService.d.ts","sourceRoot":"","sources":["../../../src/core/HttpService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"HttpService.d.ts","sourceRoot":"","sources":["../../../src/core/HttpService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAUtD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,aAAc,SAAQ,cAAc;IAC5C,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AA0CD;;;;;GAKG;AACH,qBAAa,W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,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;IAKlI;;;;;;;;;;;;OAYG;IACG,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;IAK9H,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;IAM5G,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,IAAI;IAIvD,WAAW,IAAI,IAAI;IAInB,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B,cAAc,IAAI,OAAO;IAIzB,UAAU,IAAI,MAAM;IAKpB,UAAU,IAAI,IAAI;IAIlB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIlC,aAAa;;;;;;IAWb,UAAU;;;;;;;;IAKV,MAAM,CAAC,qBAAqB,IAAI,IAAI;CAQrC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OxyServices Base Class
|
|
3
|
-
*
|
|
4
|
-
* Contains core infrastructure, HTTP client, request management, and error handling
|
|
5
|
-
*/
|
|
6
1
|
import type { OxyConfig as OxyConfigBase } from '../models/interfaces';
|
|
7
2
|
import { HttpService, type RequestOptions } from './HttpService';
|
|
8
3
|
export interface OxyConfig extends OxyConfigBase {
|
|
@@ -73,7 +68,6 @@ export declare class OxyServicesBase {
|
|
|
73
68
|
clearTokens(): void;
|
|
74
69
|
/**
|
|
75
70
|
* Get the current user ID from the access token
|
|
76
|
-
* Returns MongoDB ObjectId (never publicKey)
|
|
77
71
|
*/
|
|
78
72
|
getCurrentUserId(): string | null;
|
|
79
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxyServices.base.d.ts","sourceRoot":"","sources":["../../../src/core/OxyServices.base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OxyServices.base.d.ts","sourceRoot":"","sources":["../../../src/core/OxyServices.base.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAkB,MAAM,sBAAsB,CAAC;AAEvF,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAGjE,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD;;GAEG;AACH,qBAAa,eAAe;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;gBAEb,GAAG,IAAI,EAAE,GAAG,EAAE;IAa1B,MAAM,CAAC,qBAAqB,IAAI,IAAI;IAIpC;;;OAGG;IACU,WAAW,CAAC,CAAC,EACxB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,EACnD,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,GAAG,EACV,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC;IAcb;;OAEG;IACI,UAAU,IAAI,MAAM;IAI3B;;;OAGG;IACI,SAAS,IAAI,WAAW;IAI/B;;OAEG;IACI,UAAU;;;;;;;;IAIjB;;OAEG;IACI,UAAU,IAAI,IAAI;IAIzB;;OAEG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzC;;OAEG;IACI,aAAa;;;;;;IA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