@oxyhq/services 5.16.44 → 5.17.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 +29 -10
- package/lib/commonjs/core/OxyServices.js +1 -1
- package/lib/commonjs/core/index.js +20 -15
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.auth.js +36 -53
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.user.js +10 -17
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/core/services/TokenService.js +27 -13
- package/lib/commonjs/core/services/TokenService.js.map +1 -1
- package/lib/commonjs/crypto/index.js +0 -16
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/crypto/keyManager.js +21 -22
- package/lib/commonjs/crypto/keyManager.js.map +1 -1
- package/lib/commonjs/crypto/polyfill.js +1 -10
- package/lib/commonjs/crypto/polyfill.js.map +1 -1
- package/lib/commonjs/crypto/signatureService.js +18 -32
- package/lib/commonjs/crypto/signatureService.js.map +1 -1
- package/lib/commonjs/index.js +13 -134
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/interfaces.js +0 -7
- package/lib/commonjs/models/interfaces.js.map +1 -1
- package/lib/commonjs/node/index.js +1 -10
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -9
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +779 -450
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +551 -0
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -0
- package/lib/commonjs/ui/context/hooks/useDeviceManagement.js +73 -0
- package/lib/commonjs/ui/context/hooks/useDeviceManagement.js.map +1 -0
- package/lib/commonjs/ui/context/hooks/useStorage.js +79 -0
- package/lib/commonjs/ui/context/hooks/useStorage.js.map +1 -0
- package/lib/commonjs/ui/hooks/index.js +0 -20
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/index.js +0 -12
- package/lib/commonjs/ui/hooks/mutations/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +23 -74
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/index.js +0 -12
- package/lib/commonjs/ui/hooks/queries/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -3
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +28 -64
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +6 -4
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useDeviceManagement.js +73 -0
- package/lib/commonjs/ui/hooks/useDeviceManagement.js.map +1 -0
- package/lib/commonjs/ui/hooks/useProfileEditing.js +5 -3
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +284 -0
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -0
- package/lib/commonjs/ui/index.js +2 -10
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +1 -5
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -9
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +19 -37
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -5
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +15 -2
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +97 -76
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +6 -6
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +6 -54
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/spacing.js +2 -54
- package/lib/commonjs/ui/styles/spacing.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +12 -9
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/commonjs/ui/utils/sessionHelpers.js +1 -7
- package/lib/commonjs/ui/utils/sessionHelpers.js.map +1 -1
- package/lib/commonjs/utils/deviceManager.js +177 -0
- package/lib/commonjs/utils/deviceManager.js.map +1 -0
- package/lib/commonjs/utils/errorUtils.js +0 -13
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +7 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/sessionUtils.js +1 -8
- package/lib/commonjs/utils/sessionUtils.js.map +1 -1
- package/lib/commonjs/utils/validationUtils.js +1 -15
- package/lib/commonjs/utils/validationUtils.js.map +1 -1
- package/lib/module/core/OxyServices.js +1 -1
- package/lib/module/core/index.js +4 -6
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.auth.js +36 -53
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.user.js +10 -17
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/core/services/TokenService.js +27 -13
- package/lib/module/core/services/TokenService.js.map +1 -1
- package/lib/module/crypto/index.js +0 -3
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/crypto/keyManager.js +21 -22
- package/lib/module/crypto/keyManager.js.map +1 -1
- package/lib/module/crypto/polyfill.js +1 -2
- package/lib/module/crypto/polyfill.js.map +1 -1
- package/lib/module/crypto/signatureService.js +18 -32
- package/lib/module/crypto/signatureService.js.map +1 -1
- package/lib/module/index.js +7 -19
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/interfaces.js +0 -7
- package/lib/module/models/interfaces.js.map +1 -1
- package/lib/module/node/index.js +0 -3
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +2 -6
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +779 -450
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +545 -0
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -0
- package/lib/module/ui/context/hooks/useDeviceManagement.js +68 -0
- package/lib/module/ui/context/hooks/useDeviceManagement.js.map +1 -0
- package/lib/module/ui/context/hooks/useStorage.js +74 -0
- package/lib/module/ui/context/hooks/useStorage.js.map +1 -0
- package/lib/module/ui/hooks/index.js +0 -1
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/mutations/index.js +1 -1
- package/lib/module/ui/hooks/mutations/index.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +21 -71
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/index.js +1 -1
- package/lib/module/ui/hooks/queries/index.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +1 -3
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +27 -61
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +6 -4
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/useDeviceManagement.js +68 -0
- package/lib/module/ui/hooks/useDeviceManagement.js.map +1 -0
- package/lib/module/ui/hooks/useProfileEditing.js +5 -3
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +279 -0
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -0
- package/lib/module/ui/index.js +1 -2
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +1 -5
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +4 -9
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +19 -37
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +15 -2
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +98 -77
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +6 -6
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +6 -54
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/spacing.js +2 -6
- package/lib/module/ui/styles/spacing.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +12 -9
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/ui/utils/sessionHelpers.js +1 -7
- package/lib/module/ui/utils/sessionHelpers.js.map +1 -1
- package/lib/module/utils/deviceManager.js +171 -0
- package/lib/module/utils/deviceManager.js.map +1 -0
- package/lib/module/utils/errorUtils.js +0 -7
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/index.js +1 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/sessionUtils.js +1 -8
- package/lib/module/utils/sessionUtils.js.map +1 -1
- package/lib/module/utils/validationUtils.js +0 -13
- package/lib/module/utils/validationUtils.js.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +1 -1
- package/lib/typescript/core/index.d.ts +3 -3
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +21 -44
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +8 -15
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/core/services/TokenService.d.ts.map +1 -1
- package/lib/typescript/crypto/index.d.ts +0 -1
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/keyManager.d.ts +2 -15
- package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
- package/lib/typescript/crypto/polyfill.d.ts +1 -2
- package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
- package/lib/typescript/crypto/signatureService.d.ts +0 -13
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +7 -12
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +36 -5
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +18 -3
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +0 -1
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts +0 -5
- package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/helpers.d.ts +2 -2
- package/lib/typescript/ui/components/TextField/types.d.ts +0 -1
- package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +28 -5
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +59 -0
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -0
- package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts +27 -0
- package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts.map +1 -0
- package/lib/typescript/ui/context/hooks/useStorage.d.ts +22 -0
- package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/index.d.ts +0 -1
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/index.d.ts +1 -1
- package/lib/typescript/ui/hooks/mutations/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +8 -19
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts +1 -1
- package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/index.d.ts +1 -1
- package/lib/typescript/ui/hooks/queries/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/queryKeys.d.ts +0 -2
- package/lib/typescript/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +5 -17
- 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/useDeviceManagement.d.ts +27 -0
- package/lib/typescript/ui/hooks/useDeviceManagement.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts +41 -0
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +0 -1
- 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/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +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/authStore.d.ts +1 -8
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/spacing.d.ts +0 -5
- package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +4 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/ui/utils/sessionHelpers.d.ts +0 -1
- package/lib/typescript/ui/utils/sessionHelpers.d.ts.map +1 -1
- package/lib/typescript/utils/deviceManager.d.ts +66 -0
- package/lib/typescript/utils/deviceManager.d.ts.map +1 -0
- package/lib/typescript/utils/errorUtils.d.ts +0 -6
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/sessionUtils.d.ts.map +1 -1
- package/lib/typescript/utils/validationUtils.d.ts +0 -8
- package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/core/OxyServices.ts +1 -1
- package/src/core/index.ts +5 -8
- package/src/core/mixins/OxyServices.auth.ts +44 -87
- package/src/core/mixins/OxyServices.user.ts +10 -18
- package/src/core/services/TokenService.ts +27 -16
- package/src/crypto/index.ts +1 -3
- package/src/crypto/keyManager.ts +21 -30
- package/src/crypto/polyfill.ts +1 -2
- package/src/crypto/signatureService.ts +19 -43
- package/src/index.ts +6 -41
- package/src/models/interfaces.ts +39 -12
- package/src/models/session.ts +19 -7
- package/src/node/index.ts +0 -3
- package/src/ui/components/BottomSheetRouter.tsx +1 -6
- package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
- package/src/ui/components/TextField/helpers.tsx +2 -2
- package/src/ui/components/TextField/types.tsx +1 -1
- package/src/ui/context/OxyContext.tsx +831 -463
- package/src/ui/context/hooks/useAuthOperations.ts +620 -0
- package/src/ui/context/hooks/useDeviceManagement.ts +108 -0
- package/src/ui/context/hooks/useStorage.ts +104 -0
- package/src/ui/hooks/index.ts +1 -2
- package/src/ui/hooks/mutations/index.ts +0 -2
- package/src/ui/hooks/mutations/useAccountMutations.ts +20 -66
- package/src/ui/hooks/queries/index.ts +0 -2
- package/src/ui/hooks/queries/queryKeys.ts +0 -2
- package/src/ui/hooks/queries/useAccountQueries.ts +19 -53
- package/src/ui/hooks/queries/useServicesQueries.ts +5 -5
- package/src/ui/hooks/useDeviceManagement.ts +108 -0
- package/src/ui/hooks/useProfileEditing.ts +3 -3
- package/src/ui/hooks/useSessionManagement.ts +405 -0
- package/src/ui/index.ts +1 -2
- package/src/ui/navigation/routes.ts +2 -6
- package/src/ui/screens/AccountCenterScreen.tsx +4 -9
- package/src/ui/screens/AccountSettingsScreen.tsx +31 -49
- package/src/ui/screens/AccountSwitcherScreen.tsx +5 -5
- package/src/ui/screens/OxyAuthScreen.tsx +19 -4
- package/src/ui/screens/PrivacySettingsScreen.tsx +101 -67
- package/src/ui/screens/ProfileScreen.tsx +10 -10
- package/src/ui/stores/authStore.ts +8 -48
- package/src/ui/styles/spacing.ts +2 -15
- package/src/ui/utils/avatarUtils.ts +21 -19
- package/src/ui/utils/sessionHelpers.ts +0 -7
- package/src/utils/__tests__/validationUtils.test.ts +1 -16
- package/src/utils/deviceManager.ts +198 -0
- package/src/utils/errorUtils.ts +1 -8
- package/src/utils/index.ts +2 -1
- package/src/utils/sessionUtils.ts +0 -8
- package/src/utils/validationUtils.ts +0 -12
- package/lib/commonjs/adapters/expo/crypto.js +0 -56
- package/lib/commonjs/adapters/expo/crypto.js.map +0 -1
- package/lib/commonjs/adapters/expo/fetch.js +0 -30
- package/lib/commonjs/adapters/expo/fetch.js.map +0 -1
- package/lib/commonjs/adapters/expo/index.js +0 -48
- package/lib/commonjs/adapters/expo/index.js.map +0 -1
- package/lib/commonjs/adapters/expo/storage.js +0 -201
- package/lib/commonjs/adapters/expo/storage.js.map +0 -1
- package/lib/commonjs/adapters/index.js +0 -48
- package/lib/commonjs/adapters/index.js.map +0 -1
- package/lib/commonjs/adapters/node/crypto.js +0 -40
- package/lib/commonjs/adapters/node/crypto.js.map +0 -1
- package/lib/commonjs/adapters/node/fetch.js +0 -62
- package/lib/commonjs/adapters/node/fetch.js.map +0 -1
- package/lib/commonjs/adapters/node/index.js +0 -34
- package/lib/commonjs/adapters/node/index.js.map +0 -1
- package/lib/commonjs/adapters/node/storage.js +0 -163
- package/lib/commonjs/adapters/node/storage.js.map +0 -1
- package/lib/commonjs/core/identity-session/DeviceManager.js +0 -237
- package/lib/commonjs/core/identity-session/DeviceManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/lib/commonjs/core/identity-session/IdentityManager.js +0 -400
- package/lib/commonjs/core/identity-session/IdentityManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/IdentitySessionCore.js +0 -394
- package/lib/commonjs/core/identity-session/IdentitySessionCore.js.map +0 -1
- package/lib/commonjs/core/identity-session/RefreshManager.js +0 -137
- package/lib/commonjs/core/identity-session/RefreshManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/SessionManager.js +0 -427
- package/lib/commonjs/core/identity-session/SessionManager.js.map +0 -1
- package/lib/commonjs/core/identity-session/createIdentitySessionCore.js +0 -24
- package/lib/commonjs/core/identity-session/createIdentitySessionCore.js.map +0 -1
- package/lib/commonjs/core/identity-session/errors.js +0 -176
- package/lib/commonjs/core/identity-session/errors.js.map +0 -1
- package/lib/commonjs/core/identity-session/index.js +0 -80
- package/lib/commonjs/core/identity-session/index.js.map +0 -1
- package/lib/commonjs/core/identity-session/types.js +0 -2
- package/lib/commonjs/core/identity-session/types.js.map +0 -1
- package/lib/commonjs/crypto/README.md +0 -142
- package/lib/commonjs/crypto/core.js +0 -147
- package/lib/commonjs/crypto/core.js.map +0 -1
- package/lib/commonjs/node/signatureService.js +0 -107
- package/lib/commonjs/node/signatureService.js.map +0 -1
- package/lib/commonjs/ui/hooks/auth/index.js +0 -37
- package/lib/commonjs/ui/hooks/auth/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js +0 -171
- package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js.map +0 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -52
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/commonjs/ui/hooks/useIdentityTransfer.js +0 -125
- package/lib/commonjs/ui/hooks/useIdentityTransfer.js.map +0 -1
- package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js +0 -81
- package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js.map +0 -1
- package/lib/commonjs/ui/hooks/useTransferQueries.js +0 -85
- package/lib/commonjs/ui/hooks/useTransferQueries.js.map +0 -1
- package/lib/commonjs/ui/stores/transferStore.js +0 -157
- package/lib/commonjs/ui/stores/transferStore.js.map +0 -1
- package/lib/module/adapters/expo/crypto.js +0 -51
- package/lib/module/adapters/expo/crypto.js.map +0 -1
- package/lib/module/adapters/expo/fetch.js +0 -26
- package/lib/module/adapters/expo/fetch.js.map +0 -1
- package/lib/module/adapters/expo/index.js +0 -45
- package/lib/module/adapters/expo/index.js.map +0 -1
- package/lib/module/adapters/expo/storage.js +0 -198
- package/lib/module/adapters/expo/storage.js.map +0 -1
- package/lib/module/adapters/index.js +0 -45
- package/lib/module/adapters/index.js.map +0 -1
- package/lib/module/adapters/node/crypto.js +0 -36
- package/lib/module/adapters/node/crypto.js.map +0 -1
- package/lib/module/adapters/node/fetch.js +0 -57
- package/lib/module/adapters/node/fetch.js.map +0 -1
- package/lib/module/adapters/node/index.js +0 -31
- package/lib/module/adapters/node/index.js.map +0 -1
- package/lib/module/adapters/node/storage.js +0 -159
- package/lib/module/adapters/node/storage.js.map +0 -1
- package/lib/module/core/identity-session/DeviceManager.js +0 -232
- package/lib/module/core/identity-session/DeviceManager.js.map +0 -1
- package/lib/module/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/lib/module/core/identity-session/IdentityManager.js +0 -395
- package/lib/module/core/identity-session/IdentityManager.js.map +0 -1
- package/lib/module/core/identity-session/IdentitySessionCore.js +0 -390
- package/lib/module/core/identity-session/IdentitySessionCore.js.map +0 -1
- package/lib/module/core/identity-session/RefreshManager.js +0 -132
- package/lib/module/core/identity-session/RefreshManager.js.map +0 -1
- package/lib/module/core/identity-session/SessionManager.js +0 -422
- package/lib/module/core/identity-session/SessionManager.js.map +0 -1
- package/lib/module/core/identity-session/createIdentitySessionCore.js +0 -21
- package/lib/module/core/identity-session/createIdentitySessionCore.js.map +0 -1
- package/lib/module/core/identity-session/errors.js +0 -170
- package/lib/module/core/identity-session/errors.js.map +0 -1
- package/lib/module/core/identity-session/index.js +0 -17
- package/lib/module/core/identity-session/index.js.map +0 -1
- package/lib/module/core/identity-session/types.js +0 -2
- package/lib/module/core/identity-session/types.js.map +0 -1
- package/lib/module/crypto/README.md +0 -142
- package/lib/module/crypto/core.js +0 -133
- package/lib/module/crypto/core.js.map +0 -1
- package/lib/module/node/signatureService.js +0 -101
- package/lib/module/node/signatureService.js.map +0 -1
- package/lib/module/ui/hooks/auth/index.js +0 -7
- package/lib/module/ui/hooks/auth/index.js.map +0 -1
- package/lib/module/ui/hooks/auth/useUsernameValidation.js +0 -167
- package/lib/module/ui/hooks/auth/useUsernameValidation.js.map +0 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +0 -48
- package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
- package/lib/module/ui/hooks/useIdentityTransfer.js +0 -121
- package/lib/module/ui/hooks/useIdentityTransfer.js.map +0 -1
- package/lib/module/ui/hooks/useTransferCodesPersistence.js +0 -77
- package/lib/module/ui/hooks/useTransferCodesPersistence.js.map +0 -1
- package/lib/module/ui/hooks/useTransferQueries.js +0 -80
- package/lib/module/ui/hooks/useTransferQueries.js.map +0 -1
- package/lib/module/ui/stores/transferStore.js +0 -152
- package/lib/module/ui/stores/transferStore.js.map +0 -1
- package/lib/typescript/adapters/expo/crypto.d.ts +0 -17
- package/lib/typescript/adapters/expo/crypto.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/fetch.d.ts +0 -16
- package/lib/typescript/adapters/expo/fetch.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/index.d.ts +0 -23
- package/lib/typescript/adapters/expo/index.d.ts.map +0 -1
- package/lib/typescript/adapters/expo/storage.d.ts +0 -23
- package/lib/typescript/adapters/expo/storage.d.ts.map +0 -1
- package/lib/typescript/adapters/index.d.ts +0 -17
- package/lib/typescript/adapters/index.d.ts.map +0 -1
- package/lib/typescript/adapters/node/crypto.d.ts +0 -17
- package/lib/typescript/adapters/node/crypto.d.ts.map +0 -1
- package/lib/typescript/adapters/node/fetch.d.ts +0 -16
- package/lib/typescript/adapters/node/fetch.d.ts.map +0 -1
- package/lib/typescript/adapters/node/index.d.ts +0 -23
- package/lib/typescript/adapters/node/index.d.ts.map +0 -1
- package/lib/typescript/adapters/node/storage.d.ts +0 -23
- package/lib/typescript/adapters/node/storage.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/DeviceManager.d.ts +0 -64
- package/lib/typescript/core/identity-session/DeviceManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/IdentityManager.d.ts +0 -88
- package/lib/typescript/core/identity-session/IdentityManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts +0 -141
- package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/RefreshManager.d.ts +0 -36
- package/lib/typescript/core/identity-session/RefreshManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/SessionManager.d.ts +0 -104
- package/lib/typescript/core/identity-session/SessionManager.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts +0 -11
- package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/errors.d.ts +0 -63
- package/lib/typescript/core/identity-session/errors.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/index.d.ts +0 -14
- package/lib/typescript/core/identity-session/index.d.ts.map +0 -1
- package/lib/typescript/core/identity-session/types.d.ts +0 -196
- package/lib/typescript/core/identity-session/types.d.ts.map +0 -1
- package/lib/typescript/crypto/core.d.ts +0 -56
- package/lib/typescript/crypto/core.d.ts.map +0 -1
- package/lib/typescript/node/signatureService.d.ts +0 -55
- package/lib/typescript/node/signatureService.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/auth/index.d.ts +0 -6
- package/lib/typescript/ui/hooks/auth/index.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts +0 -32
- package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -18
- package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts +0 -24
- package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts +0 -6
- package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts.map +0 -1
- package/lib/typescript/ui/hooks/useTransferQueries.d.ts +0 -26
- package/lib/typescript/ui/hooks/useTransferQueries.d.ts.map +0 -1
- package/lib/typescript/ui/stores/transferStore.d.ts +0 -36
- package/lib/typescript/ui/stores/transferStore.d.ts.map +0 -1
- package/src/adapters/expo/crypto.ts +0 -55
- package/src/adapters/expo/fetch.ts +0 -28
- package/src/adapters/expo/index.ts +0 -51
- package/src/adapters/expo/storage.ts +0 -228
- package/src/adapters/index.ts +0 -48
- package/src/adapters/node/crypto.ts +0 -39
- package/src/adapters/node/fetch.ts +0 -59
- package/src/adapters/node/index.ts +0 -37
- package/src/adapters/node/storage.ts +0 -170
- package/src/core/identity-session/DeviceManager.ts +0 -273
- package/src/core/identity-session/INTEGRATION_GUIDE.md +0 -287
- package/src/core/identity-session/IdentityManager.ts +0 -474
- package/src/core/identity-session/IdentitySessionCore.ts +0 -464
- package/src/core/identity-session/RefreshManager.ts +0 -189
- package/src/core/identity-session/SessionManager.ts +0 -500
- package/src/core/identity-session/createIdentitySessionCore.ts +0 -19
- package/src/core/identity-session/errors.ts +0 -197
- package/src/core/identity-session/index.ts +0 -15
- package/src/core/identity-session/types.ts +0 -188
- package/src/crypto/README.md +0 -142
- package/src/crypto/__tests__/core.test.ts +0 -203
- package/src/crypto/core.ts +0 -142
- package/src/node/signatureService.ts +0 -126
- package/src/ui/hooks/auth/index.ts +0 -9
- package/src/ui/hooks/auth/useUsernameValidation.ts +0 -177
- package/src/ui/hooks/useAvatarPicker.ts +0 -62
- package/src/ui/hooks/useIdentityTransfer.ts +0 -135
- package/src/ui/hooks/useTransferCodesPersistence.ts +0 -80
- package/src/ui/hooks/useTransferQueries.ts +0 -102
- package/src/ui/stores/transferStore.ts +0 -201
|
@@ -5,81 +5,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAuthStore = void 0;
|
|
7
7
|
var _zustand = require("zustand");
|
|
8
|
-
const useAuthStore = exports.useAuthStore = (0, _zustand.create)(
|
|
9
|
-
user: null,
|
|
8
|
+
const useAuthStore = exports.useAuthStore = (0, _zustand.create)(set => ({
|
|
10
9
|
isAuthenticated: false,
|
|
11
10
|
isLoading: false,
|
|
12
11
|
error: null,
|
|
13
|
-
lastUserFetch: null,
|
|
14
12
|
// Identity sync state (offline-first)
|
|
15
|
-
isIdentitySynced:
|
|
16
|
-
//
|
|
13
|
+
isIdentitySynced: false,
|
|
14
|
+
// Registration/identity sync not confirmed until done
|
|
17
15
|
isSyncing: false,
|
|
18
|
-
loginSuccess:
|
|
16
|
+
loginSuccess: () => set({
|
|
19
17
|
isLoading: false,
|
|
20
18
|
isAuthenticated: true,
|
|
21
|
-
|
|
22
|
-
lastUserFetch: Date.now(),
|
|
23
|
-
isIdentitySynced: true // If login succeeded, identity is synced
|
|
19
|
+
isIdentitySynced: true // If login succeeded, registration is complete
|
|
24
20
|
}),
|
|
25
21
|
loginFailure: error => set({
|
|
26
22
|
isLoading: false,
|
|
27
23
|
error
|
|
28
24
|
}),
|
|
29
25
|
logout: () => set({
|
|
30
|
-
user: null,
|
|
31
26
|
isAuthenticated: false,
|
|
32
|
-
lastUserFetch: null,
|
|
33
|
-
// Reset identity sync state when logging out (for accounts app, identity = account)
|
|
34
|
-
isIdentitySynced: false,
|
|
35
27
|
isSyncing: false
|
|
36
28
|
}),
|
|
37
|
-
setUser: user => set({
|
|
38
|
-
user,
|
|
39
|
-
lastUserFetch: Date.now()
|
|
40
|
-
}),
|
|
41
29
|
// Identity sync actions
|
|
42
30
|
setIdentitySynced: synced => set({
|
|
43
31
|
isIdentitySynced: synced
|
|
44
32
|
}),
|
|
45
33
|
setSyncing: syncing => set({
|
|
46
34
|
isSyncing: syncing
|
|
47
|
-
})
|
|
48
|
-
fetchUser: async (oxyServices, forceRefresh = false) => {
|
|
49
|
-
const state = get();
|
|
50
|
-
const now = Date.now();
|
|
51
|
-
const cacheAge = state.lastUserFetch ? now - state.lastUserFetch : Number.POSITIVE_INFINITY;
|
|
52
|
-
const cacheValid = cacheAge < 5 * 60 * 1000; // 5 minutes cache
|
|
53
|
-
|
|
54
|
-
// Use cached data if available and not forcing refresh
|
|
55
|
-
if (!forceRefresh && state.user && cacheValid) {
|
|
56
|
-
if (__DEV__) {
|
|
57
|
-
console.log('AuthStore: Using cached user data (age:', cacheAge, 'ms)');
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
set({
|
|
62
|
-
isLoading: true,
|
|
63
|
-
error: null
|
|
64
|
-
});
|
|
65
|
-
try {
|
|
66
|
-
const user = await oxyServices.getCurrentUser();
|
|
67
|
-
set({
|
|
68
|
-
user,
|
|
69
|
-
isLoading: false,
|
|
70
|
-
isAuthenticated: true,
|
|
71
|
-
lastUserFetch: now
|
|
72
|
-
});
|
|
73
|
-
} catch (error) {
|
|
74
|
-
const errorMessage = error instanceof Error ? error.message : 'Failed to fetch user';
|
|
75
|
-
if (__DEV__) {
|
|
76
|
-
console.error('AuthStore: Error fetching user:', error);
|
|
77
|
-
}
|
|
78
|
-
set({
|
|
79
|
-
error: errorMessage,
|
|
80
|
-
isLoading: false
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
35
|
+
})
|
|
84
36
|
}));
|
|
85
37
|
//# sourceMappingURL=authStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_zustand","require","useAuthStore","exports","create","set","
|
|
1
|
+
{"version":3,"names":["_zustand","require","useAuthStore","exports","create","set","isAuthenticated","isLoading","error","isIdentitySynced","isSyncing","loginSuccess","loginFailure","logout","setIdentitySynced","synced","setSyncing","syncing"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAoBO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,eAAM,EAAaC,GAAwC,KAAM;EAC3FC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,IAAI;EAEX;EACAC,gBAAgB,EAAE,KAAK;EAAE;EACzBC,SAAS,EAAE,KAAK;EAEhBC,YAAY,EAAEA,CAAA,KAAMN,GAAG,CAAC;IACtBE,SAAS,EAAE,KAAK;IAChBD,eAAe,EAAE,IAAI;IACrBG,gBAAgB,EAAE,IAAI,CAAE;EAC1B,CAAC,CAAC;EACFG,YAAY,EAAGJ,KAAa,IAAKH,GAAG,CAAC;IAAEE,SAAS,EAAE,KAAK;IAAEC;EAAM,CAAC,CAAC;EACjEK,MAAM,EAAEA,CAAA,KAAMR,GAAG,CAAC;IAChBC,eAAe,EAAE,KAAK;IACtBI,SAAS,EAAE;EACb,CAAC,CAAC;EAEF;EACAI,iBAAiB,EAAGC,MAAe,IAAKV,GAAG,CAAC;IAAEI,gBAAgB,EAAEM;EAAO,CAAC,CAAC;EACzEC,UAAU,EAAGC,OAAgB,IAAKZ,GAAG,CAAC;IAAEK,SAAS,EAAEO;EAAQ,CAAC;AAC9D,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,57 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "COMPONENT_GAP", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _spacing.COMPONENT_GAP;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "COMPONENT_GAP_SMALL", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _spacing.COMPONENT_GAP_SMALL;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "HEADER_PADDING_TOP_OVERVIEW", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _spacing.HEADER_PADDING_TOP_OVERVIEW;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "HEADER_PADDING_TOP_SETTINGS", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _spacing.HEADER_PADDING_TOP_SETTINGS;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "SCREEN_PADDING_HORIZONTAL", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _spacing.SCREEN_PADDING_HORIZONTAL;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "SCREEN_PADDING_VERTICAL", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _spacing.SCREEN_PADDING_VERTICAL;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "SECTION_GAP", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _spacing.SECTION_GAP;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "SECTION_GAP_LARGE", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _spacing.SECTION_GAP_LARGE;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
6
|
exports.stepStyles = exports.STEP_INNER_GAP = exports.STEP_GAP = void 0;
|
|
55
7
|
var _reactNative = require("react-native");
|
|
56
|
-
var _spacing = require("../constants/spacing");
|
|
57
8
|
/**
|
|
58
9
|
* Shared spacing constants for authentication screens
|
|
59
10
|
* These values ensure consistent vertical spacing across all step components
|
|
@@ -62,10 +13,7 @@ var _spacing = require("../constants/spacing");
|
|
|
62
13
|
const STEP_GAP = exports.STEP_GAP = 12; // Vertical gap between ALL elements (illustration, title, description, textfield, buttons, etc.) - must be consistent everywhere
|
|
63
14
|
const STEP_INNER_GAP = exports.STEP_INNER_GAP = 12; // Gap within sections (headers, cards, etc.) - must match STEP_GAP for uniformity
|
|
64
15
|
|
|
65
|
-
|
|
66
|
-
* Re-export screen spacing constants from constants/spacing.ts
|
|
67
|
-
* This allows importing all spacing constants from a single location
|
|
68
|
-
*/
|
|
16
|
+
// Import spacing constants directly from '../constants/spacing' where needed.
|
|
69
17
|
|
|
70
18
|
/**
|
|
71
19
|
* Reusable stylesheet for step components
|
|
@@ -81,7 +29,7 @@ const stepStyles = exports.stepStyles = _reactNative.StyleSheet.create({
|
|
|
81
29
|
},
|
|
82
30
|
sectionSpacing: {
|
|
83
31
|
// Layout removed - do NOT use for spacing, use explicit marginBottom: 0
|
|
84
|
-
// This
|
|
32
|
+
// This should not add margins
|
|
85
33
|
marginBottom: 0
|
|
86
34
|
},
|
|
87
35
|
header: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","STEP_GAP","exports","STEP_INNER_GAP","stepStyles","StyleSheet","create","container","width","maxWidth","alignSelf","sectionSpacing","marginBottom","header","alignItems","gap","title","textAlign","marginTop","subtitle","buttonContainer"],"sourceRoot":"../../../../src","sources":["ui/styles/spacing.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,EAAE,CAAC,CAAC;AACrB,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,EAAE,CAAC,CAAC;;AAElC;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAGC,uBAAU,CAACC,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,EAAEZ;EACT,CAAC;EACDa,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":[]}
|
|
@@ -7,7 +7,6 @@ exports.refreshAvatarInStore = refreshAvatarInStore;
|
|
|
7
7
|
exports.updateAvatarVisibility = updateAvatarVisibility;
|
|
8
8
|
exports.updateProfileWithAvatar = updateProfileWithAvatar;
|
|
9
9
|
var _accountStore = require("../stores/accountStore");
|
|
10
|
-
var _authStore = require("../stores/authStore");
|
|
11
10
|
var _queryKeys = require("../hooks/queries/queryKeys");
|
|
12
11
|
/**
|
|
13
12
|
* Updates file visibility to public for avatar use.
|
|
@@ -62,18 +61,22 @@ function refreshAvatarInStore(sessionId, avatarFileId, oxyServices) {
|
|
|
62
61
|
* @param syncIdentity - Optional sync identity function for handling auth errors
|
|
63
62
|
* @returns Promise that resolves with updated user data
|
|
64
63
|
*/
|
|
65
|
-
async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient,
|
|
64
|
+
async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient, options) {
|
|
65
|
+
const {
|
|
66
|
+
syncIdentity,
|
|
67
|
+
deviceId
|
|
68
|
+
} = options || {};
|
|
66
69
|
// Ensure we have a valid token before making the request
|
|
67
70
|
if (!oxyServices.hasValidToken() && activeSessionId) {
|
|
68
71
|
try {
|
|
69
|
-
await oxyServices.getTokenBySession(activeSessionId);
|
|
72
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
70
73
|
} catch (tokenError) {
|
|
71
74
|
const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
|
|
72
75
|
if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
|
|
73
76
|
if (syncIdentity) {
|
|
74
77
|
try {
|
|
75
78
|
await syncIdentity();
|
|
76
|
-
await oxyServices.getTokenBySession(activeSessionId);
|
|
79
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
77
80
|
} catch (syncError) {
|
|
78
81
|
throw new Error('Session needs to be synced. Please try again.');
|
|
79
82
|
}
|
|
@@ -94,9 +97,6 @@ async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, qu
|
|
|
94
97
|
queryClient.setQueryData(_queryKeys.queryKeys.users.profile(activeSessionId), data);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
// Update authStore so frontend components see the changes immediately
|
|
98
|
-
_authStore.useAuthStore.getState().setUser(data);
|
|
99
|
-
|
|
100
100
|
// If avatar was updated, refresh accountStore with cache-busted URL
|
|
101
101
|
if (updates.avatar && activeSessionId) {
|
|
102
102
|
refreshAvatarInStore(activeSessionId, updates.avatar, oxyServices);
|
|
@@ -115,9 +115,12 @@ async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, qu
|
|
|
115
115
|
if (activeSessionId && syncIdentity) {
|
|
116
116
|
try {
|
|
117
117
|
await syncIdentity();
|
|
118
|
-
await oxyServices.getTokenBySession(activeSessionId);
|
|
118
|
+
await oxyServices.getTokenBySession(activeSessionId, deviceId);
|
|
119
119
|
// Retry the update after getting token
|
|
120
|
-
return await updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient,
|
|
120
|
+
return await updateProfileWithAvatar(updates, oxyServices, activeSessionId, queryClient, {
|
|
121
|
+
syncIdentity,
|
|
122
|
+
deviceId
|
|
123
|
+
});
|
|
121
124
|
} catch (retryError) {
|
|
122
125
|
throw new Error('Authentication failed. Please sign in again.');
|
|
123
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_accountStore","require","
|
|
1
|
+
{"version":3,"names":["_accountStore","require","_queryKeys","updateAvatarVisibility","fileId","oxyServices","contextName","startsWith","assetUpdateVisibility","visError","refreshAvatarInStore","sessionId","avatarFileId","updateAccount","useAccountStore","getState","cacheBustedUrl","getFileDownloadUrl","Date","now","avatar","avatarUrl","updateProfileWithAvatar","updates","activeSessionId","queryClient","options","syncIdentity","deviceId","hasValidToken","getTokenBySession","tokenError","errorMessage","Error","message","String","includes","syncError","data","updateProfile","setQueryData","queryKeys","accounts","current","users","profile","invalidateUserQueries","invalidateAccountQueries","error","status","response","retryError"],"sourceRoot":"../../../../src","sources":["ui/utils/avatarUtils.ts"],"mappings":";;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,sBAAsBA,CAC1CC,MAA0B,EAC1BC,WAAwB,EACxBC,WAAmB,GAAG,aAAa,EACpB;EACf;EACA,IAAI,CAACF,MAAM,IAAIA,MAAM,CAACG,UAAU,CAAC,OAAO,CAAC,EAAE;IACzC;EACF;EAEA,IAAI;IACF,MAAMF,WAAW,CAACG,qBAAqB,CAACJ,MAAM,EAAE,QAAQ,CAAC;IACzD;EACF,CAAC,CAAC,OAAOK,QAAa,EAAE;IACtB;IACA;IACA;EAAA;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAClCC,SAAiB,EACjBC,YAAoB,EACpBP,WAAwB,EAClB;EACN,MAAM;IAAEQ;EAAc,CAAC,GAAGC,6BAAe,CAACC,QAAQ,CAAC,CAAC;EACpD,MAAMC,cAAc,GAAGX,WAAW,CAACY,kBAAkB,CAACL,YAAY,EAAE,OAAO,CAAC,GAAG,MAAMM,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE;EACjGN,aAAa,CAACF,SAAS,EAAE;IACvBS,MAAM,EAAER,YAAY;IACpBS,SAAS,EAAEL;EACb,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeM,uBAAuBA,CAC3CC,OAAsB,EACtBlB,WAAwB,EAC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CAACc,eAAe,EAAED,OAAO,CAACH,MAAM,EAAEf,WAAW,CAAC;IACpE;;IAEA;IACA,IAAAyC,gCAAqB,EAACrB,WAAW,CAAC;IAClC,IAAAsB,mCAAwB,EAACtB,WAAW,CAAC;IAErC,OAAOa,IAAI;EACb,CAAC,CAAC,OAAOU,KAAU,EAAE;IACnB,MAAMhB,YAAY,GAAGgB,KAAK,EAAEd,OAAO,IAAI,EAAE;IACzC,MAAMe,MAAM,GAAGD,KAAK,EAAEC,MAAM,IAAID,KAAK,EAAEE,QAAQ,EAAED,MAAM;;IAEvD;IACE,IAAIA,MAAM,KAAK,GAAG,IAAIjB,YAAY,CAACI,QAAQ,CAAC,yBAAyB,CAAC,IAAIJ,YAAY,CAACI,QAAQ,CAAC,yCAAyC,CAAC,EAAE;MAC1I,IAAIZ,eAAe,IAAIG,YAAY,EAAE;QACnC,IAAI;UACF,MAAMA,YAAY,CAAC,CAAC;UACpB,MAAMtB,WAAW,CAACyB,iBAAiB,CAACN,eAAe,EAAEI,QAAQ,CAAC;UAC9D;UACA,OAAO,MAAMN,uBAAuB,CAClCC,OAAO,EACPlB,WAAW,EACXmB,eAAe,EACfC,WAAW,EACX;YAAEE,YAAY;YAAEC;UAAS,CAC3B,CAAC;QACH,CAAC,CAAC,OAAOuB,UAAU,EAAE;UACnB,MAAM,IAAIlB,KAAK,CAAC,8CAA8C,CAAC;QACjE;MACF,CAAC,MAAM;QACP,MAAM,IAAIA,KAAK,CAAC,oCAAoC,CAAC;MACvD;IACF;IAEA,MAAMe,KAAK;EACb;AACF","ignoreList":[]}
|
|
@@ -19,13 +19,7 @@ const mapSessionsToClient = (sessions, fallbackDeviceId, fallbackUserId) => {
|
|
|
19
19
|
expiresAt: session.expiresAt || new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000).toISOString(),
|
|
20
20
|
lastActive: session.lastActive || now.toISOString(),
|
|
21
21
|
userId: session.user?.id || session.userId || (session.user?._id ? session.user._id.toString() : undefined) || fallbackUserId || '',
|
|
22
|
-
isCurrent: Boolean(session.isCurrent)
|
|
23
|
-
deviceInfo: session.deviceInfo || {
|
|
24
|
-
deviceName: '',
|
|
25
|
-
deviceType: 'unknown',
|
|
26
|
-
platform: 'unknown',
|
|
27
|
-
lastActive: session.lastActive || now.toISOString()
|
|
28
|
-
}
|
|
22
|
+
isCurrent: Boolean(session.isCurrent)
|
|
29
23
|
}));
|
|
30
24
|
};
|
|
31
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mapSessionsToClient","sessions","fallbackDeviceId","fallbackUserId","now","Date","map","session","sessionId","deviceId","expiresAt","getTime","toISOString","lastActive","userId","user","id","_id","toString","undefined","isCurrent","Boolean","
|
|
1
|
+
{"version":3,"names":["mapSessionsToClient","sessions","fallbackDeviceId","fallbackUserId","now","Date","map","session","sessionId","deviceId","expiresAt","getTime","toISOString","lastActive","userId","user","id","_id","toString","undefined","isCurrent","Boolean","exports","fetchSessionsWithFallback","oxyServices","logger","deviceSessions","getDeviceSessions","error","__DEV__","userSessions","getSessionsBySessionId","validateSessionBatch","sessionIds","useHeaderValidation","maxConcurrency","length","uniqueSessionIds","Array","from","Set","safeConcurrency","Math","max","min","results","index","worker","currentIndex","validation","validateSession","valid","push","raw","Promise","all"],"sourceRoot":"../../../../src","sources":["ui/utils/sessionHelpers.ts"],"mappings":";;;;;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAGA,CACjCC,QAAyB,EACzBC,gBAAyB,EACzBC,cAAuB,KACH;EACpB,MAAMC,GAAG,GAAG,IAAIC,IAAI,CAAC,CAAC;EAEtB,OAAOJ,QAAQ,CAACK,GAAG,CAAEC,OAAO,KAAM;IAChCC,SAAS,EAAED,OAAO,CAACC,SAAS;IAC5BC,QAAQ,EAAEF,OAAO,CAACE,QAAQ,IAAIP,gBAAgB,IAAI,EAAE;IACpDQ,SAAS,EAAEH,OAAO,CAACG,SAAS,IAAI,IAAIL,IAAI,CAACD,GA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O,CAACC,GAAG,CAACjB,KAAK,CAACC,IAAI,CAAC;IAAEH,MAAM,EAAEK;EAAgB,CAAC,EAAEM,MAAM,CAAC,CAAC;EAElE,OAAOF,OAAO;AAChB,CAAC;AAACvB,OAAA,CAAAU,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DeviceManager = void 0;
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
|
+
/**
|
|
9
|
+
* Client-side device management utility
|
|
10
|
+
* Handles persistent device identification across app sessions
|
|
11
|
+
*/
|
|
12
|
+
class DeviceManager {
|
|
13
|
+
static DEVICE_KEY = 'oxy_device_info';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Check if we're in React Native environment
|
|
17
|
+
*/
|
|
18
|
+
static isReactNative() {
|
|
19
|
+
return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get appropriate storage for the platform
|
|
24
|
+
*/
|
|
25
|
+
static async getStorage() {
|
|
26
|
+
if (this.isReactNative()) {
|
|
27
|
+
try {
|
|
28
|
+
const asyncStorageModule = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-async-storage/async-storage')));
|
|
29
|
+
const storage = asyncStorageModule.default;
|
|
30
|
+
return {
|
|
31
|
+
getItem: storage.getItem.bind(storage),
|
|
32
|
+
setItem: storage.setItem.bind(storage),
|
|
33
|
+
removeItem: storage.removeItem.bind(storage)
|
|
34
|
+
};
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('AsyncStorage not available in React Native:', error);
|
|
37
|
+
throw new Error('AsyncStorage is required in React Native environment');
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// Use localStorage for web
|
|
41
|
+
return {
|
|
42
|
+
getItem: async key => localStorage.getItem(key),
|
|
43
|
+
setItem: async (key, value) => localStorage.setItem(key, value),
|
|
44
|
+
removeItem: async key => localStorage.removeItem(key)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get or create device fingerprint for current device
|
|
51
|
+
*/
|
|
52
|
+
static getDeviceFingerprint() {
|
|
53
|
+
const fingerprint = {
|
|
54
|
+
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'unknown',
|
|
55
|
+
platform: typeof navigator !== 'undefined' ? navigator.platform : 'unknown',
|
|
56
|
+
language: typeof navigator !== 'undefined' ? navigator.language : undefined,
|
|
57
|
+
timezone: typeof Intl !== 'undefined' ? Intl.DateTimeFormat().resolvedOptions().timeZone : undefined
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Add screen info if available
|
|
61
|
+
if (typeof screen !== 'undefined') {
|
|
62
|
+
fingerprint.screen = {
|
|
63
|
+
width: screen.width,
|
|
64
|
+
height: screen.height,
|
|
65
|
+
colorDepth: screen.colorDepth
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return fingerprint;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get stored device info or create new one
|
|
73
|
+
*/
|
|
74
|
+
static async getDeviceInfo() {
|
|
75
|
+
try {
|
|
76
|
+
const storage = await this.getStorage();
|
|
77
|
+
const stored = await storage.getItem(this.DEVICE_KEY);
|
|
78
|
+
if (stored) {
|
|
79
|
+
const deviceInfo = JSON.parse(stored);
|
|
80
|
+
|
|
81
|
+
// Update last used timestamp
|
|
82
|
+
deviceInfo.lastUsed = new Date().toISOString();
|
|
83
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
84
|
+
return deviceInfo;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Create new device info
|
|
88
|
+
return await this.createNewDeviceInfo();
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Error getting device info:', error);
|
|
91
|
+
return await this.createNewDeviceInfo();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Create new device info and store it
|
|
97
|
+
*/
|
|
98
|
+
static async createNewDeviceInfo() {
|
|
99
|
+
const deviceInfo = {
|
|
100
|
+
deviceId: this.generateDeviceId(),
|
|
101
|
+
fingerprint: JSON.stringify(this.getDeviceFingerprint()),
|
|
102
|
+
createdAt: new Date().toISOString(),
|
|
103
|
+
lastUsed: new Date().toISOString()
|
|
104
|
+
};
|
|
105
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
106
|
+
return deviceInfo;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Save device info to storage
|
|
111
|
+
*/
|
|
112
|
+
static async saveDeviceInfo(deviceInfo) {
|
|
113
|
+
try {
|
|
114
|
+
const storage = await this.getStorage();
|
|
115
|
+
await storage.setItem(this.DEVICE_KEY, JSON.stringify(deviceInfo));
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('Error saving device info:', error);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Update device name
|
|
123
|
+
*/
|
|
124
|
+
static async updateDeviceName(deviceName) {
|
|
125
|
+
try {
|
|
126
|
+
const deviceInfo = await this.getDeviceInfo();
|
|
127
|
+
deviceInfo.deviceName = deviceName;
|
|
128
|
+
await this.saveDeviceInfo(deviceInfo);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('Error updating device name:', error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Clear stored device info (useful for testing or reset)
|
|
136
|
+
*/
|
|
137
|
+
static async clearDeviceInfo() {
|
|
138
|
+
try {
|
|
139
|
+
const storage = await this.getStorage();
|
|
140
|
+
await storage.removeItem(this.DEVICE_KEY);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error('Error clearing device info:', error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Generate a unique device ID
|
|
148
|
+
*/
|
|
149
|
+
static generateDeviceId() {
|
|
150
|
+
// Use crypto.getRandomValues if available, otherwise fallback to Math.random
|
|
151
|
+
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
152
|
+
const array = new Uint8Array(32);
|
|
153
|
+
crypto.getRandomValues(array);
|
|
154
|
+
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
|
155
|
+
} else {
|
|
156
|
+
// Fallback for environments without crypto.getRandomValues
|
|
157
|
+
return 'device_' + Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get a user-friendly device name based on platform
|
|
163
|
+
*/
|
|
164
|
+
static getDefaultDeviceName() {
|
|
165
|
+
const fingerprint = this.getDeviceFingerprint();
|
|
166
|
+
const platform = (fingerprint.platform || '').toLowerCase();
|
|
167
|
+
if (platform.includes('win')) return 'Windows Computer';
|
|
168
|
+
if (platform.includes('mac')) return 'Mac Computer';
|
|
169
|
+
if (platform.includes('linux')) return 'Linux Computer';
|
|
170
|
+
if (platform.includes('iphone')) return 'iPhone';
|
|
171
|
+
if (platform.includes('ipad')) return 'iPad';
|
|
172
|
+
if (platform.includes('android')) return 'Android Device';
|
|
173
|
+
return 'Unknown Device';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.DeviceManager = DeviceManager;
|
|
177
|
+
//# sourceMappingURL=deviceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeviceManager","DEVICE_KEY","isReactNative","navigator","product","getStorage","asyncStorageModule","Promise","resolve","then","_interopRequireWildcard","require","storage","default","getItem","bind","setItem","removeItem","error","console","Error","key","localStorage","value","getDeviceFingerprint","fingerprint","userAgent","platform","language","undefined","timezone","Intl","DateTimeFormat","resolvedOptions","timeZone","screen","width","height","colorDepth","getDeviceInfo","stored","deviceInfo","JSON","parse","lastUsed","Date","toISOString","saveDeviceInfo","createNewDeviceInfo","deviceId","generateDeviceId","stringify","createdAt","updateDeviceName","deviceName","clearDeviceInfo","crypto","getRandomValues","array","Uint8Array","Array","from","byte","toString","padStart","join","now","Math","random","substr","getDefaultDeviceName","toLowerCase","includes","exports"],"sourceRoot":"../../../src","sources":["utils/deviceManager.ts"],"mappings":";;;;;;;AAoBA;AACA;AACA;AACA;AACO,MAAMA,aAAa,CAAC;EACzB,OAAeC,UAAU,GAAG,iBAAiB;;EAE7C;AACF;AACA;EACE,OAAeC,aAAaA,CAAA,EAAY;IACtC,OAAO,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,OAAO,KAAK,aAAa;EAChF;;EAEA;AACF;AACA;EACE,aAAqBC,UAAUA,CAAA,EAI5B;IACD,IAAI,IAAI,CAACH,aAAa,CAAC,CAAC,EAAE;MACxB,IAAI;QACF,MAAMI,kBAAkB,GAAG,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAC,uBAAA,CAAAC,OAAA,CAAa,2CAA2C,GAAC;QACpF,MAAMC,OAAO,GAAIN,kBAAkB,CAACO,OAA6F;QACjI,OAAO;UACLC,OAAO,EAAEF,OAAO,CAACE,OAAO,CAACC,IAAI,CAACH,OAAO,CAAC;UACtCI,OAAO,EAAE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AAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;IAC/E,CAAC,MAAM;MACL;MACA,OAAO,SAAS,GAAGpB,IAAI,CAACqB,GAAG,CAAC,CAAC,CAACH,QAAQ,CAAC,EAAE,CAAC,GAAGI,IAAI,CAACC,MAAM,CAAC,CAAC,CAACL,QAAQ,CAAC,EAAE,CAAC,CAACM,MAAM,CAAC,CAAC,CAAC;IACnF;EACF;;EAEA;AACF;AACA;EACE,OAAOC,oBAAoBA,CAAA,EAAW;IACpC,MAAM7C,WAAW,GAAG,IAAI,CAACD,oBAAoB,CAAC,CAAC;IAC/C,MAAMG,QAAQ,GAAG,CAACF,WAAW,CAACE,QAAQ,IAAI,EAAE,EAAE4C,WAAW,CAAC,CAAC;IAE3D,IAAI5C,QAAQ,CAAC6C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,kBAAkB;IACvD,IAAI7C,QAAQ,CAAC6C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,cAAc;IACnD,IAAI7C,QAAQ,CAAC6C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,gBAAgB;IACvD,IAAI7C,QAAQ,CAAC6C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,QAAQ;IAChD,IAAI7C,QAAQ,CAAC6C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,MAAM;IAC5C,IAAI7C,QAAQ,CAAC6C,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,gBAAgB;IAEzD,OAAO,gBAAgB;EACzB;AACF;AAACC,OAAA,CAAAzE,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -8,15 +8,8 @@ exports.createApiError = createApiError;
|
|
|
8
8
|
exports.getErrorCodeFromStatus = getErrorCodeFromStatus;
|
|
9
9
|
exports.handleHttpError = handleHttpError;
|
|
10
10
|
exports.logError = logError;
|
|
11
|
-
Object.defineProperty(exports, "retryWithBackoff", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () {
|
|
14
|
-
return _asyncUtils.retryAsync;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
11
|
exports.validateRequiredFields = validateRequiredFields;
|
|
18
12
|
var _loggerUtils = require("./loggerUtils");
|
|
19
|
-
var _asyncUtils = require("./asyncUtils");
|
|
20
13
|
/**
|
|
21
14
|
* Error handling utilities for consistent error processing
|
|
22
15
|
*/
|
|
@@ -172,10 +165,4 @@ function logError(error, context) {
|
|
|
172
165
|
});
|
|
173
166
|
}
|
|
174
167
|
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Retry function with exponential backoff
|
|
178
|
-
* Re-exports retryAsync for backward compatibility
|
|
179
|
-
* @deprecated Use retryAsync from asyncUtils instead
|
|
180
|
-
*/
|
|
181
168
|
//# sourceMappingURL=errorUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_loggerUtils","require","
|
|
1
|
+
{"version":3,"names":["_loggerUtils","require","ErrorCodes","exports","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","logger","component","method","stack"],"sourceRoot":"../../../src","sources":["utils/errorUtils.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxB;EACAE,YAAY,EAAE,cAAc;EAC5BC,SAAS,EAAE,WAAW;EACtBC,aAAa,E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,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACO,SAASoC,QAAQA,CAACpB,KAAc,EAAEqB,OAAgB,EAAQ;EAC/D,IAAIrB,KAAK,YAAYG,KAAK,EAAE;IAC1BmB,mBAAM,CAACtB,KAAK,CAACA,KAAK,CAACL,OAAO,EAAE;MAC1B4B,SAAS,EAAEF,OAAO,IAAI,YAAY;MAClCG,MAAM,EAAE,UAAU;MAClBC,KAAK,EAAEzB,KAAK,CAACyB;IACf,CAAC,CAAC;EACJ,CAAC,MAAM;IACLH,mBAAM,CAACtB,KAAK,CAACW,MAAM,CAACX,KAAK,CAAC,EAAE;MAC1BuB,SAAS,EAAEF,OAAO,IAAI,YAAY;MAClCG,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "DeviceManager", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _deviceManager.DeviceManager;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "RequestDeduplicator", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -93,6 +99,7 @@ Object.defineProperty(exports, "unregisterCacheFromCleanup", {
|
|
|
93
99
|
return _cache.unregisterCacheFromCleanup;
|
|
94
100
|
}
|
|
95
101
|
});
|
|
102
|
+
var _deviceManager = require("./deviceManager");
|
|
96
103
|
var _requestUtils = require("./requestUtils");
|
|
97
104
|
var _cache = require("./cache");
|
|
98
105
|
var _sessionUtils = require("./sessionUtils");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_deviceManager","require","_requestUtils","_cache","_sessionUtils"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAIA,IAAAG,aAAA,GAAAH,OAAA","ignoreList":[]}
|
|
@@ -23,19 +23,12 @@ exports.sortSessions = sortSessions;
|
|
|
23
23
|
*/
|
|
24
24
|
function normalizeSession(session) {
|
|
25
25
|
const now = new Date().toISOString();
|
|
26
|
-
const defaultDeviceInfo = {
|
|
27
|
-
deviceName: '',
|
|
28
|
-
deviceType: 'unknown',
|
|
29
|
-
platform: 'unknown',
|
|
30
|
-
lastActive: now
|
|
31
|
-
};
|
|
32
26
|
return {
|
|
33
27
|
sessionId: session.sessionId,
|
|
34
28
|
deviceId: session.deviceId || '',
|
|
35
29
|
expiresAt: session.expiresAt || now,
|
|
36
30
|
lastActive: session.lastActive || now,
|
|
37
|
-
userId: session.userId || ''
|
|
38
|
-
deviceInfo: session.deviceInfo || defaultDeviceInfo
|
|
31
|
+
userId: session.userId || ''
|
|
39
32
|
};
|
|
40
33
|
}
|
|
41
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeSession","session","now","Date","toISOString","
|
|
1
|
+
{"version":3,"names":["normalizeSession","session","now","Date","toISOString","sessionId","deviceId","expiresAt","lastActive","userId","sessionsEqual","a","b","sortSessions","sessions","sort","timeA","getTime","timeB","localeCompare","deduplicateSessions","sessionMap","Map","existing","get","set","existingTime","currentTime","Array","from","values","deduplicateSessionsByUserId","activeSessionId","length","userSessionMap","isCurrentActive","isExistingActive","normalizeAndSortSessions","deduplicateByUserId","normalized","map","deduplicatedBySessionId","finalSessions","mergeSessions","incoming","normalizedExisting","normalizedIncoming","merged","sessionsArraysEqual","sortedA","sortedB","every","index"],"sourceRoot":"../../../src","sources":["utils/sessionUtils.ts"],"mappings":";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