@oxyhq/services 27.1.3 → 29.0.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/LICENSE +202 -661
- package/NOTICE +16 -0
- package/README.md +67 -2
- package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionModule.kt +178 -0
- package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionProvider.kt +99 -0
- package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionStore.kt +115 -0
- package/expo-module.config.json +1 -0
- package/lib/commonjs/index.js +78 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +7 -0
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/client.js +12 -7
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +10 -27
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +132 -44
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +4 -2
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/SurfaceScreen.js +31 -3
- package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +209 -84
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +25 -7
- package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/primitives.js +35 -22
- package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/signInProgress.js +5 -0
- package/lib/commonjs/ui/components/authChooser/signInProgress.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/types.js +11 -0
- package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +257 -306
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +27 -37
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/oxyContextHelpers.js +0 -29
- package/lib/commonjs/ui/context/oxyContextHelpers.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +6 -17
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/accountDialogSnapshot.js +42 -0
- package/lib/commonjs/ui/hooks/accountDialogSnapshot.js.map +1 -0
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +0 -19
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/useDeviceSwitcher.js +57 -0
- package/lib/commonjs/ui/hooks/useDeviceSwitcher.js.map +1 -0
- package/lib/commonjs/ui/hooks/useI18n.js +22 -3
- package/lib/commonjs/ui/hooks/useI18n.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +46 -153
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/index.js +12 -7
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +85 -73
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaces.js +8 -7
- package/lib/commonjs/ui/navigation/surfaces.js.map +1 -1
- package/lib/commonjs/ui/runtime/createOxyRuntime.js +433 -0
- package/lib/commonjs/ui/runtime/createOxyRuntime.js.map +1 -0
- package/lib/commonjs/ui/runtime/index.js +63 -0
- package/lib/commonjs/ui/runtime/index.js.map +1 -0
- package/lib/commonjs/ui/runtime/runtimeContext.js +83 -0
- package/lib/commonjs/ui/runtime/runtimeContext.js.map +1 -0
- package/lib/commonjs/ui/runtime/types.js +6 -0
- package/lib/commonjs/ui/runtime/types.js.map +1 -0
- package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js +57 -0
- package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +3 -4
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +3 -12
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +6 -5
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +4 -4
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js +4 -2
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/server.js +1 -2
- package/lib/commonjs/ui/server.js.map +1 -1
- package/lib/commonjs/ui/session/authStore.js +45 -9
- package/lib/commonjs/ui/session/authStore.js.map +1 -1
- package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js +306 -0
- package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js.map +1 -0
- package/lib/commonjs/ui/stores/authStore.js +154 -55
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/stores/followTargetStore.js +27 -0
- package/lib/commonjs/ui/stores/followTargetStore.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +2 -36
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/index.js +20 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/boot/runProviderColdBoot.js +7 -0
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/client.js +1 -2
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/components/OxyAccountDialogScreen.js +10 -27
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +134 -44
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +5 -3
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/SurfaceScreen.js +33 -5
- package/lib/module/ui/components/SurfaceScreen.js.map +1 -1
- package/lib/module/ui/components/authChooser/AccountsMenuView.js +210 -85
- package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/module/ui/components/authChooser/SignInEntryView.js +25 -7
- package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -1
- package/lib/module/ui/components/authChooser/primitives.js +35 -22
- package/lib/module/ui/components/authChooser/primitives.js.map +1 -1
- package/lib/module/ui/components/authChooser/signInProgress.js +5 -0
- package/lib/module/ui/components/authChooser/signInProgress.js.map +1 -1
- package/lib/module/ui/components/authChooser/types.js +11 -0
- package/lib/module/ui/components/authChooser/types.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +251 -303
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +27 -37
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/oxyContextHelpers.js +0 -28
- package/lib/module/ui/context/oxyContextHelpers.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +6 -17
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/accountDialogSnapshot.js +38 -0
- package/lib/module/ui/hooks/accountDialogSnapshot.js.map +1 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +0 -19
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/useDeviceSwitcher.js +53 -0
- package/lib/module/ui/hooks/useDeviceSwitcher.js.map +1 -0
- package/lib/module/ui/hooks/useI18n.js +24 -4
- package/lib/module/ui/hooks/useI18n.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +47 -155
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/index.js +1 -2
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +84 -72
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/navigation/surfaces.js +6 -6
- package/lib/module/ui/navigation/surfaces.js.map +1 -1
- package/lib/module/ui/runtime/createOxyRuntime.js +430 -0
- package/lib/module/ui/runtime/createOxyRuntime.js.map +1 -0
- package/lib/module/ui/runtime/index.js +15 -0
- package/lib/module/ui/runtime/index.js.map +1 -0
- package/lib/module/ui/runtime/runtimeContext.js +75 -0
- package/lib/module/ui/runtime/runtimeContext.js.map +1 -0
- package/lib/module/ui/runtime/types.js +4 -0
- package/lib/module/ui/runtime/types.js.map +1 -0
- package/lib/module/ui/runtime/useRuntimeSnapshot.js +52 -0
- package/lib/module/ui/runtime/useRuntimeSnapshot.js.map +1 -0
- package/lib/module/ui/screens/AccountMembersScreen.js +4 -5
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +4 -13
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +6 -5
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +5 -5
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +1 -1
- package/lib/module/ui/screens/trust/TrustRulesScreen.js +4 -2
- package/lib/module/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/module/ui/server.js +0 -1
- package/lib/module/ui/server.js.map +1 -1
- package/lib/module/ui/session/authStore.js +46 -11
- package/lib/module/ui/session/authStore.js.map +1 -1
- package/lib/module/ui/session/sharedDeviceCredentialStore.js +302 -0
- package/lib/module/ui/session/sharedDeviceCredentialStore.js.map +1 -0
- package/lib/module/ui/stores/authStore.js +154 -55
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/stores/followTargetStore.js +25 -0
- package/lib/module/ui/stores/followTargetStore.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +2 -35
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +6 -4
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +1 -2
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
- package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +3 -1
- package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +18 -6
- package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +33 -1
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +35 -4
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +8 -12
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts +0 -2
- package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +9 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +1 -3
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts +15 -0
- package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts +49 -0
- package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts +13 -0
- package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts +23 -18
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +1 -2
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +15 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts +144 -0
- package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/runtime/index.d.ts +16 -0
- package/lib/typescript/commonjs/ui/runtime/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts +43 -0
- package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/runtime/types.d.ts +89 -0
- package/lib/typescript/commonjs/ui/runtime/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
- package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/server.d.ts +0 -1
- package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/authStore.d.ts +60 -9
- package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
- package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/stores/authStore.d.ts +49 -5
- package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts +8 -1
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +26 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts +2 -10
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +6 -4
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +1 -2
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
- package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +3 -1
- package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +18 -6
- package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/types.d.ts +33 -1
- package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +35 -4
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +8 -12
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts +0 -2
- package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +9 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +1 -3
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts +15 -0
- package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts +49 -0
- package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useI18n.d.ts +13 -0
- package/lib/typescript/module/ui/hooks/useI18n.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +23 -18
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +1 -2
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +15 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -1
- package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts +144 -0
- package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts.map +1 -0
- package/lib/typescript/module/ui/runtime/index.d.ts +16 -0
- package/lib/typescript/module/ui/runtime/index.d.ts.map +1 -0
- package/lib/typescript/module/ui/runtime/runtimeContext.d.ts +43 -0
- package/lib/typescript/module/ui/runtime/runtimeContext.d.ts.map +1 -0
- package/lib/typescript/module/ui/runtime/types.d.ts +89 -0
- package/lib/typescript/module/ui/runtime/types.d.ts.map +1 -0
- package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
- package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/server.d.ts +0 -1
- package/lib/typescript/module/ui/server.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/authStore.d.ts +60 -9
- package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
- package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
- package/lib/typescript/module/ui/stores/authStore.d.ts +49 -5
- package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts +8 -1
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts +26 -0
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts +2 -10
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +8 -8
- package/plugins/withSharedDeviceSessionProvider.js +102 -0
- package/plugins/withSharedDeviceSessionReader.js +57 -0
- package/src/__tests__/esmSourcePurity.test.ts +61 -0
- package/src/index.ts +36 -9
- package/src/ui/boot/runProviderColdBoot.ts +7 -0
- package/src/ui/client.ts +1 -2
- package/src/ui/components/OxyAccountDialogScreen.tsx +10 -29
- package/src/ui/components/OxyAuthChooser.tsx +149 -50
- package/src/ui/components/OxyProvider.tsx +7 -5
- package/src/ui/components/SurfaceScreen.tsx +28 -4
- package/src/ui/components/__tests__/followTargetButton.test.ts +39 -0
- package/src/ui/components/authChooser/AccountsMenuView.tsx +246 -96
- package/src/ui/components/authChooser/SignInEntryView.tsx +31 -8
- package/src/ui/components/authChooser/primitives.tsx +37 -23
- package/src/ui/components/authChooser/signInProgress.ts +4 -0
- package/src/ui/components/authChooser/types.ts +34 -1
- package/src/ui/context/OxyContext.tsx +269 -324
- package/src/ui/context/hooks/useAuthOperations.ts +32 -35
- package/src/ui/context/oxyContextHelpers.ts +0 -30
- package/src/ui/context/oxyContextTypes.ts +9 -1
- package/src/ui/context/useOxyAccountGraph.ts +5 -19
- package/src/ui/hooks/accountDialogSnapshot.ts +37 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +0 -19
- package/src/ui/hooks/queries/__tests__/userCache.test.ts +12 -1
- package/src/ui/hooks/useDeviceSwitcher.ts +110 -0
- package/src/ui/hooks/useI18n.ts +23 -3
- package/src/ui/hooks/useSessionManagement.ts +62 -211
- package/src/ui/index.ts +1 -2
- package/src/ui/navigation/routes.ts +85 -75
- package/src/ui/navigation/surfaces.ts +6 -9
- package/src/ui/runtime/createOxyRuntime.ts +623 -0
- package/src/ui/runtime/index.ts +34 -0
- package/src/ui/runtime/runtimeContext.tsx +111 -0
- package/src/ui/runtime/types.ts +110 -0
- package/src/ui/runtime/useRuntimeSnapshot.ts +52 -0
- package/src/ui/screens/AccountMembersScreen.tsx +6 -5
- package/src/ui/screens/CreateAccountScreen.tsx +3 -16
- package/src/ui/screens/trust/TrustCenterScreen.tsx +7 -7
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +4 -5
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +1 -1
- package/src/ui/screens/trust/TrustRulesScreen.tsx +3 -2
- package/src/ui/server.ts +0 -1
- package/src/ui/session/__tests__/authStore.test.ts +90 -0
- package/src/ui/session/__tests__/sharedDeviceCredentialStore.test.ts +289 -0
- package/src/ui/session/authStore.ts +78 -9
- package/src/ui/session/sharedDeviceCredentialStore.ts +318 -0
- package/src/ui/stores/authStore.ts +171 -43
- package/src/ui/stores/followTargetStore.ts +24 -1
- package/src/ui/types/navigation.ts +26 -0
- package/src/ui/utils/avatarUtils.ts +2 -37
- package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +0 -64
- package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +0 -1
- package/lib/commonjs/ui/screens/trust/trustTier.js +0 -23
- package/lib/commonjs/ui/screens/trust/trustTier.js.map +0 -1
- package/lib/commonjs/ui/stores/accountStore.js +0 -221
- package/lib/commonjs/ui/stores/accountStore.js.map +0 -1
- package/lib/module/ui/hooks/useSwitchableAccounts.js +0 -60
- package/lib/module/ui/hooks/useSwitchableAccounts.js.map +0 -1
- package/lib/module/ui/screens/trust/trustTier.js +0 -19
- package/lib/module/ui/screens/trust/trustTier.js.map +0 -1
- package/lib/module/ui/stores/accountStore.js +0 -213
- package/lib/module/ui/stores/accountStore.js.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +0 -23
- package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/trust/trustTier.d.ts +0 -9
- package/lib/typescript/commonjs/ui/screens/trust/trustTier.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/stores/accountStore.d.ts +0 -27
- package/lib/typescript/commonjs/ui/stores/accountStore.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +0 -23
- package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/trust/trustTier.d.ts +0 -9
- package/lib/typescript/module/ui/screens/trust/trustTier.d.ts.map +0 -1
- package/lib/typescript/module/ui/stores/accountStore.d.ts +0 -27
- package/lib/typescript/module/ui/stores/accountStore.d.ts.map +0 -1
- package/src/ui/hooks/useSwitchableAccounts.ts +0 -75
- package/src/ui/screens/trust/trustTier.ts +0 -20
- package/src/ui/stores/accountStore.ts +0 -264
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SwitchableAccount } from '@oxyhq/core';
|
|
2
|
-
export interface UseSwitchableAccountsResult {
|
|
3
|
-
/** Every switchable account (device sign-ins + linked graph accounts). */
|
|
4
|
-
accounts: SwitchableAccount[];
|
|
5
|
-
/** True until the initial account-list fetch settles with no data yet. */
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
/** The currently-active account's device session id, or `null`. */
|
|
8
|
-
currentSessionId: string | null;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Every account the signed-in user can switch into — device sign-ins AND linked
|
|
12
|
-
* graph accounts (owned orgs + shared-with-you) — as one flat, deduped list with
|
|
13
|
-
* real per-account name / email / avatar / color.
|
|
14
|
-
*
|
|
15
|
-
* This is a thin binding over the shared `AccountDialogController` in
|
|
16
|
-
* `@oxyhq/core` (the SAME headless source the {@link OxyAccountDialogScreen} renders),
|
|
17
|
-
* so there is ONE projection (`projectSwitchableAccounts`) and one switch path
|
|
18
|
-
* (`controller.switchTo`) across the whole SDK — the local duplicate projection
|
|
19
|
-
* this hook used to own has been removed. Every switch routes through
|
|
20
|
-
* `useOxy().switchToAccount(accountId)` (or the dialog's row press).
|
|
21
|
-
*/
|
|
22
|
-
export declare function useSwitchableAccounts(): UseSwitchableAccountsResult;
|
|
23
|
-
//# sourceMappingURL=useSwitchableAccounts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSwitchableAccounts.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useSwitchableAccounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AAG5E,MAAM,WAAW,2BAA2B;IACxC,0EAA0E;IAC1E,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AA4BD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IAAI,2BAA2B,CAuBnE"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TrustTier } from '@oxyhq/contracts';
|
|
2
|
-
type Translate = (key: string, vars?: Record<string, string | number>) => string;
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a human-readable label for a trust tier, preferring the localized
|
|
5
|
-
* `trust.tiers.<tier>` key and falling back to the canonical English label.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getTrustTierLabel(tier: TrustTier, t: Translate): string;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=trustTier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trustTier.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/trust/trustTier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAWjF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAEvE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
import type { QuickAccount } from '@oxyhq/core';
|
|
3
|
-
export type { QuickAccount };
|
|
4
|
-
interface AccountState {
|
|
5
|
-
accounts: Record<string, QuickAccount>;
|
|
6
|
-
accountOrder: string[];
|
|
7
|
-
accountsArray: QuickAccount[];
|
|
8
|
-
loading: boolean;
|
|
9
|
-
loadingSessionIds: Set<string>;
|
|
10
|
-
error: string | null;
|
|
11
|
-
setAccounts: (accounts: QuickAccount[]) => void;
|
|
12
|
-
addAccount: (account: QuickAccount) => void;
|
|
13
|
-
updateAccount: (sessionId: string, updates: Partial<QuickAccount>) => void;
|
|
14
|
-
removeAccount: (sessionId: string) => void;
|
|
15
|
-
moveAccountToTop: (sessionId: string) => void;
|
|
16
|
-
setLoading: (loading: boolean) => void;
|
|
17
|
-
setLoadingSession: (sessionId: string, loading: boolean) => void;
|
|
18
|
-
setError: (error: string | null) => void;
|
|
19
|
-
loadAccounts: (sessionIds: string[], oxyServices: OxyServices, existingAccounts?: QuickAccount[], preserveOrder?: boolean) => Promise<void>;
|
|
20
|
-
reset: () => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const useAccountStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AccountState>>;
|
|
23
|
-
export declare const useAccounts: () => QuickAccount[];
|
|
24
|
-
export declare const useAccountLoading: () => boolean;
|
|
25
|
-
export declare const useAccountError: () => string | null;
|
|
26
|
-
export declare const useAccountLoadingSession: (sessionId: string) => boolean;
|
|
27
|
-
//# sourceMappingURL=accountStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accountStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/accountStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,UAAU,YAAY;IAElB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,YAAY,EAAE,CAAC;IAG9B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAG/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrB,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC3E,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAG9C,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAGjE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAGzC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,CAAC,EAAE,YAAY,EAAE,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAG5I,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAYD,eAAO,MAAM,eAAe,2EAwMzB,CAAC;AAGJ,eAAO,MAAM,WAAW,QAAO,YAAY,EAE1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAwC,CAAC;AACvE,eAAO,MAAM,eAAe,qBAAsC,CAAC;AACnE,eAAO,MAAM,wBAAwB,GAAI,WAAW,MAAM,YACE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SwitchableAccount } from '@oxyhq/core';
|
|
2
|
-
export interface UseSwitchableAccountsResult {
|
|
3
|
-
/** Every switchable account (device sign-ins + linked graph accounts). */
|
|
4
|
-
accounts: SwitchableAccount[];
|
|
5
|
-
/** True until the initial account-list fetch settles with no data yet. */
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
/** The currently-active account's device session id, or `null`. */
|
|
8
|
-
currentSessionId: string | null;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Every account the signed-in user can switch into — device sign-ins AND linked
|
|
12
|
-
* graph accounts (owned orgs + shared-with-you) — as one flat, deduped list with
|
|
13
|
-
* real per-account name / email / avatar / color.
|
|
14
|
-
*
|
|
15
|
-
* This is a thin binding over the shared `AccountDialogController` in
|
|
16
|
-
* `@oxyhq/core` (the SAME headless source the {@link OxyAccountDialogScreen} renders),
|
|
17
|
-
* so there is ONE projection (`projectSwitchableAccounts`) and one switch path
|
|
18
|
-
* (`controller.switchTo`) across the whole SDK — the local duplicate projection
|
|
19
|
-
* this hook used to own has been removed. Every switch routes through
|
|
20
|
-
* `useOxy().switchToAccount(accountId)` (or the dialog's row press).
|
|
21
|
-
*/
|
|
22
|
-
export declare function useSwitchableAccounts(): UseSwitchableAccountsResult;
|
|
23
|
-
//# sourceMappingURL=useSwitchableAccounts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSwitchableAccounts.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useSwitchableAccounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AAG5E,MAAM,WAAW,2BAA2B;IACxC,0EAA0E;IAC1E,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AA4BD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IAAI,2BAA2B,CAuBnE"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TrustTier } from '@oxyhq/contracts';
|
|
2
|
-
type Translate = (key: string, vars?: Record<string, string | number>) => string;
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a human-readable label for a trust tier, preferring the localized
|
|
5
|
-
* `trust.tiers.<tier>` key and falling back to the canonical English label.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getTrustTierLabel(tier: TrustTier, t: Translate): string;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=trustTier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trustTier.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/trust/trustTier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAWjF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAEvE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
import type { QuickAccount } from '@oxyhq/core';
|
|
3
|
-
export type { QuickAccount };
|
|
4
|
-
interface AccountState {
|
|
5
|
-
accounts: Record<string, QuickAccount>;
|
|
6
|
-
accountOrder: string[];
|
|
7
|
-
accountsArray: QuickAccount[];
|
|
8
|
-
loading: boolean;
|
|
9
|
-
loadingSessionIds: Set<string>;
|
|
10
|
-
error: string | null;
|
|
11
|
-
setAccounts: (accounts: QuickAccount[]) => void;
|
|
12
|
-
addAccount: (account: QuickAccount) => void;
|
|
13
|
-
updateAccount: (sessionId: string, updates: Partial<QuickAccount>) => void;
|
|
14
|
-
removeAccount: (sessionId: string) => void;
|
|
15
|
-
moveAccountToTop: (sessionId: string) => void;
|
|
16
|
-
setLoading: (loading: boolean) => void;
|
|
17
|
-
setLoadingSession: (sessionId: string, loading: boolean) => void;
|
|
18
|
-
setError: (error: string | null) => void;
|
|
19
|
-
loadAccounts: (sessionIds: string[], oxyServices: OxyServices, existingAccounts?: QuickAccount[], preserveOrder?: boolean) => Promise<void>;
|
|
20
|
-
reset: () => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const useAccountStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AccountState>>;
|
|
23
|
-
export declare const useAccounts: () => QuickAccount[];
|
|
24
|
-
export declare const useAccountLoading: () => boolean;
|
|
25
|
-
export declare const useAccountError: () => string | null;
|
|
26
|
-
export declare const useAccountLoadingSession: (sessionId: string) => boolean;
|
|
27
|
-
//# sourceMappingURL=accountStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accountStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/accountStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,UAAU,YAAY;IAElB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,YAAY,EAAE,CAAC;IAG9B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAG/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrB,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC3E,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAG9C,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAGjE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAGzC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,CAAC,EAAE,YAAY,EAAE,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAG5I,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAYD,eAAO,MAAM,eAAe,2EAwMzB,CAAC;AAGJ,eAAO,MAAM,WAAW,QAAO,YAAY,EAE1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAwC,CAAC;AACvE,eAAO,MAAM,eAAe,qBAAsC,CAAC;AACnE,eAAO,MAAM,wBAAwB,GAAI,WAAW,MAAM,YACE,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useSyncExternalStore } from 'react';
|
|
2
|
-
import type { SwitchableAccount, AccountDialogSnapshot } from '@oxyhq/core';
|
|
3
|
-
import { useOxy } from '../context/OxyContext';
|
|
4
|
-
|
|
5
|
-
export interface UseSwitchableAccountsResult {
|
|
6
|
-
/** Every switchable account (device sign-ins + linked graph accounts). */
|
|
7
|
-
accounts: SwitchableAccount[];
|
|
8
|
-
/** True until the initial account-list fetch settles with no data yet. */
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
/** The currently-active account's device session id, or `null`. */
|
|
11
|
-
currentSessionId: string | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Stable empty snapshot for the no-provider loading state, so `useSyncExternalStore`
|
|
16
|
-
* always has a getSnapshot that returns a constant reference before mount.
|
|
17
|
-
*/
|
|
18
|
-
const EMPTY_SNAPSHOT: AccountDialogSnapshot = {
|
|
19
|
-
view: 'accounts',
|
|
20
|
-
accounts: [],
|
|
21
|
-
activeAccountId: null,
|
|
22
|
-
loading: false,
|
|
23
|
-
error: null,
|
|
24
|
-
switchingAccountId: null,
|
|
25
|
-
signIn: {
|
|
26
|
-
phase: 'idle',
|
|
27
|
-
authorizeCode: null,
|
|
28
|
-
qrPayload: null,
|
|
29
|
-
expiresAt: null,
|
|
30
|
-
error: null,
|
|
31
|
-
route: null,
|
|
32
|
-
routeFailed: false,
|
|
33
|
-
pushSentAt: null,
|
|
34
|
-
openedAt: null,
|
|
35
|
-
progress: 'idle',
|
|
36
|
-
},
|
|
37
|
-
commonsAvailability: 'unknown',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Every account the signed-in user can switch into — device sign-ins AND linked
|
|
42
|
-
* graph accounts (owned orgs + shared-with-you) — as one flat, deduped list with
|
|
43
|
-
* real per-account name / email / avatar / color.
|
|
44
|
-
*
|
|
45
|
-
* This is a thin binding over the shared `AccountDialogController` in
|
|
46
|
-
* `@oxyhq/core` (the SAME headless source the {@link OxyAccountDialogScreen} renders),
|
|
47
|
-
* so there is ONE projection (`projectSwitchableAccounts`) and one switch path
|
|
48
|
-
* (`controller.switchTo`) across the whole SDK — the local duplicate projection
|
|
49
|
-
* this hook used to own has been removed. Every switch routes through
|
|
50
|
-
* `useOxy().switchToAccount(accountId)` (or the dialog's row press).
|
|
51
|
-
*/
|
|
52
|
-
export function useSwitchableAccounts(): UseSwitchableAccountsResult {
|
|
53
|
-
const { accountDialogController: controller } = useOxy();
|
|
54
|
-
|
|
55
|
-
const subscribe = useCallback(
|
|
56
|
-
(listener: () => void) => (controller ? controller.subscribe(listener) : () => undefined),
|
|
57
|
-
[controller],
|
|
58
|
-
);
|
|
59
|
-
const getSnapshot = useCallback(
|
|
60
|
-
() => (controller ? controller.getSnapshot() : EMPTY_SNAPSHOT),
|
|
61
|
-
[controller],
|
|
62
|
-
);
|
|
63
|
-
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
64
|
-
|
|
65
|
-
const currentSessionId = useMemo<string | null>(() => {
|
|
66
|
-
const active = snapshot.accounts.find((account) => account.accountId === snapshot.activeAccountId);
|
|
67
|
-
return active?.sessionId ?? null;
|
|
68
|
-
}, [snapshot]);
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
accounts: snapshot.accounts,
|
|
72
|
-
isLoading: snapshot.loading,
|
|
73
|
-
currentSessionId,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { TrustTier } from '@oxyhq/contracts';
|
|
2
|
-
|
|
3
|
-
type Translate = (key: string, vars?: Record<string, string | number>) => string;
|
|
4
|
-
|
|
5
|
-
/** Default English labels for each trust tier, used as i18n fallbacks. */
|
|
6
|
-
const TRUST_TIER_FALLBACK: Record<TrustTier, string> = {
|
|
7
|
-
new: 'New',
|
|
8
|
-
trusted: 'Trusted',
|
|
9
|
-
high_trust: 'High Trust',
|
|
10
|
-
verified: 'Verified',
|
|
11
|
-
restricted: 'Restricted',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Resolve a human-readable label for a trust tier, preferring the localized
|
|
16
|
-
* `trust.tiers.<tier>` key and falling back to the canonical English label.
|
|
17
|
-
*/
|
|
18
|
-
export function getTrustTierLabel(tier: TrustTier, t: Translate): string {
|
|
19
|
-
return t(`trust.tiers.${tier}`) || TRUST_TIER_FALLBACK[tier];
|
|
20
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { shallow } from 'zustand/shallow';
|
|
3
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
4
|
-
import { buildAccountsArray, createQuickAccount } from '@oxyhq/core';
|
|
5
|
-
import type { QuickAccount } from '@oxyhq/core';
|
|
6
|
-
|
|
7
|
-
export type { QuickAccount };
|
|
8
|
-
|
|
9
|
-
interface AccountState {
|
|
10
|
-
// Account data
|
|
11
|
-
accounts: Record<string, QuickAccount>;
|
|
12
|
-
accountOrder: string[]; // Maintain order for display
|
|
13
|
-
accountsArray: QuickAccount[]; // Cached array to prevent infinite loops
|
|
14
|
-
|
|
15
|
-
// Loading states
|
|
16
|
-
loading: boolean;
|
|
17
|
-
loadingSessionIds: Set<string>;
|
|
18
|
-
|
|
19
|
-
// Error state
|
|
20
|
-
error: string | null;
|
|
21
|
-
|
|
22
|
-
// Actions
|
|
23
|
-
setAccounts: (accounts: QuickAccount[]) => void;
|
|
24
|
-
addAccount: (account: QuickAccount) => void;
|
|
25
|
-
updateAccount: (sessionId: string, updates: Partial<QuickAccount>) => void;
|
|
26
|
-
removeAccount: (sessionId: string) => void;
|
|
27
|
-
moveAccountToTop: (sessionId: string) => void;
|
|
28
|
-
|
|
29
|
-
// Loading actions
|
|
30
|
-
setLoading: (loading: boolean) => void;
|
|
31
|
-
setLoadingSession: (sessionId: string, loading: boolean) => void;
|
|
32
|
-
|
|
33
|
-
// Error actions
|
|
34
|
-
setError: (error: string | null) => void;
|
|
35
|
-
|
|
36
|
-
// Load accounts from API
|
|
37
|
-
loadAccounts: (sessionIds: string[], oxyServices: OxyServices, existingAccounts?: QuickAccount[], preserveOrder?: boolean) => Promise<void>;
|
|
38
|
-
|
|
39
|
-
// Reset store
|
|
40
|
-
reset: () => void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const initialState = {
|
|
44
|
-
accounts: {} as Record<string, QuickAccount>,
|
|
45
|
-
accountOrder: [] as string[],
|
|
46
|
-
accountsArray: [] as QuickAccount[],
|
|
47
|
-
loading: false,
|
|
48
|
-
loadingSessionIds: new Set<string>(),
|
|
49
|
-
error: null,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export const useAccountStore = create<AccountState>((set, get) => ({
|
|
54
|
-
...initialState,
|
|
55
|
-
|
|
56
|
-
setAccounts: (accounts) => set((state) => {
|
|
57
|
-
const accountMap: Record<string, QuickAccount> = {};
|
|
58
|
-
const order: string[] = [];
|
|
59
|
-
const seenSessionIds = new Set<string>();
|
|
60
|
-
|
|
61
|
-
for (const account of accounts) {
|
|
62
|
-
if (seenSessionIds.has(account.sessionId)) continue;
|
|
63
|
-
seenSessionIds.add(account.sessionId);
|
|
64
|
-
accountMap[account.sessionId] = account;
|
|
65
|
-
order.push(account.sessionId);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const accountsArray = buildAccountsArray(accountMap, order);
|
|
69
|
-
const sameOrder = order.length === state.accountOrder.length &&
|
|
70
|
-
order.every((id, i) => id === state.accountOrder[i]);
|
|
71
|
-
const sameAccounts = sameOrder &&
|
|
72
|
-
order.every(id => {
|
|
73
|
-
const existing = state.accounts[id];
|
|
74
|
-
const newAccount = accountMap[id];
|
|
75
|
-
return existing &&
|
|
76
|
-
existing.sessionId === newAccount.sessionId &&
|
|
77
|
-
existing.userId === newAccount.userId &&
|
|
78
|
-
existing.avatar === newAccount.avatar &&
|
|
79
|
-
existing.avatarUrl === newAccount.avatarUrl;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
if (sameAccounts) return {} as Partial<AccountState>;
|
|
83
|
-
|
|
84
|
-
return { accounts: accountMap, accountOrder: order, accountsArray };
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
addAccount: (account) => set((state) => {
|
|
88
|
-
// Check if account with same sessionId exists
|
|
89
|
-
if (state.accounts[account.sessionId]) {
|
|
90
|
-
// Update existing
|
|
91
|
-
const existing = state.accounts[account.sessionId];
|
|
92
|
-
if (existing.avatar === account.avatar && existing.avatarUrl === account.avatarUrl) {
|
|
93
|
-
return {} as Partial<AccountState>; // No change
|
|
94
|
-
}
|
|
95
|
-
const newAccounts = { ...state.accounts, [account.sessionId]: account };
|
|
96
|
-
return {
|
|
97
|
-
accounts: newAccounts,
|
|
98
|
-
accountsArray: buildAccountsArray(newAccounts, state.accountOrder),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const newAccounts = { ...state.accounts, [account.sessionId]: account };
|
|
103
|
-
const newOrder = [account.sessionId, ...state.accountOrder];
|
|
104
|
-
return {
|
|
105
|
-
accounts: newAccounts,
|
|
106
|
-
accountOrder: newOrder,
|
|
107
|
-
accountsArray: buildAccountsArray(newAccounts, newOrder),
|
|
108
|
-
};
|
|
109
|
-
}),
|
|
110
|
-
|
|
111
|
-
updateAccount: (sessionId, updates) => set((state) => {
|
|
112
|
-
const existing = state.accounts[sessionId];
|
|
113
|
-
if (!existing) return {} as Partial<AccountState>;
|
|
114
|
-
|
|
115
|
-
const updated = { ...existing, ...updates };
|
|
116
|
-
if (existing.avatar === updated.avatar && existing.avatarUrl === updated.avatarUrl) {
|
|
117
|
-
return {} as Partial<AccountState>; // No change
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const newAccounts = { ...state.accounts, [sessionId]: updated };
|
|
121
|
-
return {
|
|
122
|
-
accounts: newAccounts,
|
|
123
|
-
accountsArray: buildAccountsArray(newAccounts, state.accountOrder),
|
|
124
|
-
};
|
|
125
|
-
}),
|
|
126
|
-
|
|
127
|
-
removeAccount: (sessionId) => set((state) => {
|
|
128
|
-
if (!state.accounts[sessionId]) return {} as Partial<AccountState>;
|
|
129
|
-
|
|
130
|
-
const { [sessionId]: _removed, ...rest } = state.accounts;
|
|
131
|
-
const newOrder = state.accountOrder.filter(id => id !== sessionId);
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
accounts: rest,
|
|
135
|
-
accountOrder: newOrder,
|
|
136
|
-
accountsArray: buildAccountsArray(rest, newOrder),
|
|
137
|
-
};
|
|
138
|
-
}),
|
|
139
|
-
|
|
140
|
-
moveAccountToTop: (sessionId) => set((state) => {
|
|
141
|
-
if (!state.accounts[sessionId]) return {} as Partial<AccountState>;
|
|
142
|
-
|
|
143
|
-
const filtered = state.accountOrder.filter(id => id !== sessionId);
|
|
144
|
-
const newOrder = [sessionId, ...filtered];
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
accountOrder: newOrder,
|
|
148
|
-
accountsArray: buildAccountsArray(state.accounts, newOrder),
|
|
149
|
-
};
|
|
150
|
-
}),
|
|
151
|
-
|
|
152
|
-
setLoading: (loading) => set({ loading }),
|
|
153
|
-
|
|
154
|
-
setLoadingSession: (sessionId, loading) => set((state) => {
|
|
155
|
-
const newSet = new Set(state.loadingSessionIds);
|
|
156
|
-
if (loading) {
|
|
157
|
-
newSet.add(sessionId);
|
|
158
|
-
} else {
|
|
159
|
-
newSet.delete(sessionId);
|
|
160
|
-
}
|
|
161
|
-
return { loadingSessionIds: newSet };
|
|
162
|
-
}),
|
|
163
|
-
|
|
164
|
-
setError: (error) => set({ error }),
|
|
165
|
-
|
|
166
|
-
loadAccounts: async (sessionIds, oxyServices, existingAccounts = [], preserveOrder = true) => {
|
|
167
|
-
const state = get();
|
|
168
|
-
|
|
169
|
-
const uniqueSessionIds = Array.from(new Set(sessionIds));
|
|
170
|
-
if (uniqueSessionIds.length === 0) {
|
|
171
|
-
get().setAccounts([]);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Try to get data from TanStack Query cache first
|
|
176
|
-
try {
|
|
177
|
-
// This will be called from a component, so we need to access queryClient differently
|
|
178
|
-
// For now, we'll keep the API call but optimize it
|
|
179
|
-
const existingMap = new Map(existingAccounts.map(a => [a.sessionId, a]));
|
|
180
|
-
for (const account of Object.values(state.accounts)) {
|
|
181
|
-
existingMap.set(account.sessionId, account);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const missingSessionIds = uniqueSessionIds.filter(id => !existingMap.has(id));
|
|
185
|
-
|
|
186
|
-
if (missingSessionIds.length === 0) {
|
|
187
|
-
const ordered = uniqueSessionIds
|
|
188
|
-
.map(id => existingMap.get(id))
|
|
189
|
-
.filter((acc): acc is QuickAccount => acc !== undefined);
|
|
190
|
-
get().setAccounts(ordered);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (state.loading) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
set({ loading: true, error: null });
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
const batchResults = await oxyServices.getUsersBySessions(missingSessionIds);
|
|
202
|
-
|
|
203
|
-
const accountMap = new Map<string, QuickAccount>();
|
|
204
|
-
|
|
205
|
-
for (const { sessionId, user: userData } of batchResults) {
|
|
206
|
-
if (userData && !accountMap.has(sessionId)) {
|
|
207
|
-
const existing = existingMap.get(sessionId);
|
|
208
|
-
accountMap.set(sessionId, createQuickAccount(
|
|
209
|
-
sessionId,
|
|
210
|
-
userData,
|
|
211
|
-
existing,
|
|
212
|
-
(fileId, variant) => oxyServices.getFileDownloadUrl(fileId, variant)
|
|
213
|
-
));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
for (const [sessionId, account] of accountMap) {
|
|
218
|
-
existingMap.set(sessionId, account);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const orderToUse = preserveOrder ? uniqueSessionIds : [...uniqueSessionIds, ...state.accountOrder];
|
|
222
|
-
const seen = new Set<string>();
|
|
223
|
-
const ordered: QuickAccount[] = [];
|
|
224
|
-
|
|
225
|
-
for (const sessionId of orderToUse) {
|
|
226
|
-
if (seen.has(sessionId)) continue;
|
|
227
|
-
seen.add(sessionId);
|
|
228
|
-
|
|
229
|
-
const account = existingMap.get(sessionId);
|
|
230
|
-
if (account) ordered.push(account);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
get().setAccounts(ordered);
|
|
234
|
-
} catch (error) {
|
|
235
|
-
const errorMessage = error instanceof Error ? error.message : 'Failed to load accounts';
|
|
236
|
-
if (__DEV__) {
|
|
237
|
-
console.error('AccountStore: Failed to load accounts:', error);
|
|
238
|
-
}
|
|
239
|
-
set({ error: errorMessage });
|
|
240
|
-
} finally {
|
|
241
|
-
set({ loading: false });
|
|
242
|
-
}
|
|
243
|
-
} catch (error) {
|
|
244
|
-
const errorMessage = error instanceof Error ? error.message : 'Failed to load accounts';
|
|
245
|
-
if (__DEV__) {
|
|
246
|
-
console.error('AccountStore: Failed to load accounts:', error);
|
|
247
|
-
}
|
|
248
|
-
set({ error: errorMessage, loading: false });
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
reset: () => set(initialState),
|
|
253
|
-
}));
|
|
254
|
-
|
|
255
|
-
// Selectors for performance - return cached array to prevent infinite loops
|
|
256
|
-
export const useAccounts = (): QuickAccount[] => {
|
|
257
|
-
return useAccountStore(state => state.accountsArray);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export const useAccountLoading = () => useAccountStore(s => s.loading);
|
|
261
|
-
export const useAccountError = () => useAccountStore(s => s.error);
|
|
262
|
-
export const useAccountLoadingSession = (sessionId: string) =>
|
|
263
|
-
useAccountStore(s => s.loadingSessionIds.has(sessionId));
|
|
264
|
-
|