@oxyhq/services 14.1.0 → 16.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/lib/commonjs/index.js +4 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/SignInAccountChooser.js +189 -0
- package/lib/commonjs/ui/components/SignInAccountChooser.js.map +1 -0
- package/lib/commonjs/ui/components/SignInModal.js +350 -131
- package/lib/commonjs/ui/components/SignInModal.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +340 -1547
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +61 -64
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +9 -9
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +7 -8
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAuth.js +14 -33
- package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/ui/hooks/usePasswordSignIn.js +170 -0
- package/lib/commonjs/ui/hooks/usePasswordSignIn.js.map +1 -0
- package/lib/commonjs/ui/hooks/useProfileEditing.js +2 -5
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +2 -2
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +1 -0
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +17 -18
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +93 -68
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileScreen.js +187 -0
- package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +3 -7
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +231 -95
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +15 -2
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/linkFormat.js +38 -0
- package/lib/commonjs/ui/screens/linkFormat.js.map +1 -0
- package/lib/commonjs/ui/session/authStore.js +146 -0
- package/lib/commonjs/ui/session/authStore.js.map +1 -0
- package/lib/commonjs/ui/session/createSessionClient.js +23 -17
- package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
- package/lib/commonjs/ui/session/index.js +13 -7
- package/lib/commonjs/ui/session/index.js.map +1 -1
- package/lib/commonjs/ui/session/tokenTransport.js +19 -31
- package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
- package/lib/commonjs/ui/utils/isWebBrowser.js +13 -0
- package/lib/commonjs/ui/utils/isWebBrowser.js.map +1 -0
- package/lib/commonjs/utils/deviceFlowSignIn.js +13 -16
- package/lib/commonjs/utils/deviceFlowSignIn.js.map +1 -1
- package/lib/module/index.js +2 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/SignInAccountChooser.js +183 -0
- package/lib/module/ui/components/SignInAccountChooser.js.map +1 -0
- package/lib/module/ui/components/SignInModal.js +352 -134
- package/lib/module/ui/components/SignInModal.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +342 -1551
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +60 -63
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationKeys.js +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +7 -7
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +5 -6
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/useAuth.js +14 -33
- package/lib/module/ui/hooks/useAuth.js.map +1 -1
- package/lib/module/ui/hooks/usePasswordSignIn.js +165 -0
- package/lib/module/ui/hooks/usePasswordSignIn.js.map +1 -0
- package/lib/module/ui/hooks/useProfileEditing.js +2 -5
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +1 -0
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +19 -20
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +91 -66
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileScreen.js +182 -0
- package/lib/module/ui/screens/EditProfileScreen.js.map +1 -0
- package/lib/module/ui/screens/ManageAccountScreen.js +3 -7
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +233 -97
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +15 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/linkFormat.js +31 -0
- package/lib/module/ui/screens/linkFormat.js.map +1 -0
- package/lib/module/ui/session/authStore.js +143 -0
- package/lib/module/ui/session/authStore.js.map +1 -0
- package/lib/module/ui/session/createSessionClient.js +22 -16
- package/lib/module/ui/session/createSessionClient.js.map +1 -1
- package/lib/module/ui/session/index.js +9 -9
- package/lib/module/ui/session/index.js.map +1 -1
- package/lib/module/ui/session/tokenTransport.js +20 -33
- package/lib/module/ui/session/tokenTransport.js.map +1 -1
- package/lib/module/ui/utils/isWebBrowser.js +11 -0
- package/lib/module/ui/utils/isWebBrowser.js.map +1 -0
- package/lib/module/utils/deviceFlowSignIn.js +14 -17
- package/lib/module/utils/deviceFlowSignIn.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -3
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts +29 -0
- package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +15 -10
- package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +36 -42
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +18 -23
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +4 -6
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +6 -7
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts +31 -0
- package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useProfileEditing.d.ts +0 -1
- package/lib/typescript/commonjs/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts +14 -0
- package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts +13 -12
- package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/linkFormat.d.ts +23 -0
- package/lib/typescript/commonjs/ui/screens/linkFormat.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/authStore.d.ts +33 -0
- package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +19 -15
- package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/index.d.ts +9 -9
- package/lib/typescript/commonjs/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +13 -19
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/isWebBrowser.d.ts +9 -0
- package/lib/typescript/commonjs/ui/utils/isWebBrowser.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/storageHelpers.d.ts +7 -7
- package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts +15 -13
- package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -3
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts +29 -0
- package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/SignInModal.d.ts +15 -10
- package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +36 -42
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +18 -23
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +4 -6
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +6 -7
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts +31 -0
- package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useProfileEditing.d.ts +0 -1
- package/lib/typescript/module/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts +14 -0
- package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +13 -12
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/linkFormat.d.ts +23 -0
- package/lib/typescript/module/ui/screens/linkFormat.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/authStore.d.ts +33 -0
- package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/createSessionClient.d.ts +19 -15
- package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/index.d.ts +9 -9
- package/lib/typescript/module/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/tokenTransport.d.ts +13 -19
- package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/isWebBrowser.d.ts +9 -0
- package/lib/typescript/module/ui/utils/isWebBrowser.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/storageHelpers.d.ts +7 -7
- package/lib/typescript/module/utils/deviceFlowSignIn.d.ts +15 -13
- package/lib/typescript/module/utils/deviceFlowSignIn.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -6
- package/src/ui/components/SignInAccountChooser.tsx +162 -0
- package/src/ui/components/SignInModal.tsx +309 -139
- package/src/ui/context/OxyContext.tsx +532 -1785
- package/src/ui/context/hooks/useAuthOperations.ts +65 -76
- package/src/ui/hooks/mutations/mutationKeys.ts +1 -1
- package/src/ui/hooks/mutations/useAccountMutations.ts +7 -7
- package/src/ui/hooks/queries/queryKeys.ts +1 -1
- package/src/ui/hooks/queries/useAccountQueries.ts +8 -9
- package/src/ui/hooks/useAuth.ts +14 -35
- package/src/ui/hooks/usePasswordSignIn.ts +207 -0
- package/src/ui/hooks/useProfileEditing.ts +2 -8
- package/src/ui/hooks/useSessionManagement.ts +1 -1
- package/src/ui/navigation/routes.ts +3 -1
- package/src/ui/screens/ConnectedAppsScreen.tsx +23 -24
- package/src/ui/screens/EditProfileFieldScreen.tsx +102 -66
- package/src/ui/screens/EditProfileScreen.tsx +155 -0
- package/src/ui/screens/ManageAccountScreen.tsx +3 -7
- package/src/ui/screens/OxyAuthScreen.tsx +259 -112
- package/src/ui/screens/ProfileScreen.tsx +15 -2
- package/src/ui/screens/__tests__/linkFormat.test.ts +73 -0
- package/src/ui/screens/linkFormat.ts +37 -0
- package/src/ui/session/__tests__/createSessionClient.test.ts +22 -7
- package/src/ui/session/__tests__/tokenTransport.test.ts +37 -49
- package/src/ui/session/authStore.ts +164 -0
- package/src/ui/session/createSessionClient.ts +30 -17
- package/src/ui/session/index.ts +10 -9
- package/src/ui/session/tokenTransport.ts +26 -36
- package/src/ui/utils/isWebBrowser.ts +8 -0
- package/src/ui/utils/storageHelpers.ts +7 -7
- package/src/utils/__tests__/deviceFlowSignIn.test.ts +50 -131
- package/src/utils/deviceFlowSignIn.ts +19 -26
- package/lib/commonjs/ui/context/inSessionTokenRefresh.js +0 -243
- package/lib/commonjs/ui/context/inSessionTokenRefresh.js.map +0 -1
- package/lib/commonjs/ui/context/silentSessionRestore.js +0 -56
- package/lib/commonjs/ui/context/silentSessionRestore.js.map +0 -1
- package/lib/commonjs/ui/hooks/useWebSSO.js +0 -28
- package/lib/commonjs/ui/hooks/useWebSSO.js.map +0 -1
- package/lib/commonjs/ui/session/projectSessionState.js +0 -86
- package/lib/commonjs/ui/session/projectSessionState.js.map +0 -1
- package/lib/commonjs/ui/session/sessionClientHost.js +0 -30
- package/lib/commonjs/ui/session/sessionClientHost.js.map +0 -1
- package/lib/commonjs/ui/utils/activeAuthuser.js +0 -142
- package/lib/commonjs/ui/utils/activeAuthuser.js.map +0 -1
- package/lib/commonjs/utils/crossApex.js +0 -74
- package/lib/commonjs/utils/crossApex.js.map +0 -1
- package/lib/module/ui/context/inSessionTokenRefresh.js +0 -238
- package/lib/module/ui/context/inSessionTokenRefresh.js.map +0 -1
- package/lib/module/ui/context/silentSessionRestore.js +0 -53
- package/lib/module/ui/context/silentSessionRestore.js.map +0 -1
- package/lib/module/ui/hooks/useWebSSO.js +0 -24
- package/lib/module/ui/hooks/useWebSSO.js.map +0 -1
- package/lib/module/ui/session/projectSessionState.js +0 -79
- package/lib/module/ui/session/projectSessionState.js.map +0 -1
- package/lib/module/ui/session/sessionClientHost.js +0 -26
- package/lib/module/ui/session/sessionClientHost.js.map +0 -1
- package/lib/module/ui/utils/activeAuthuser.js +0 -134
- package/lib/module/ui/utils/activeAuthuser.js.map +0 -1
- package/lib/module/utils/crossApex.js +0 -69
- package/lib/module/utils/crossApex.js.map +0 -1
- package/lib/typescript/commonjs/ui/context/inSessionTokenRefresh.d.ts +0 -106
- package/lib/typescript/commonjs/ui/context/inSessionTokenRefresh.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/context/silentSessionRestore.d.ts +0 -36
- package/lib/typescript/commonjs/ui/context/silentSessionRestore.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/useWebSSO.d.ts +0 -19
- package/lib/typescript/commonjs/ui/hooks/useWebSSO.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/session/projectSessionState.d.ts +0 -45
- package/lib/typescript/commonjs/ui/session/projectSessionState.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/session/sessionClientHost.d.ts +0 -14
- package/lib/typescript/commonjs/ui/session/sessionClientHost.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +0 -67
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +0 -1
- package/lib/typescript/commonjs/utils/crossApex.d.ts +0 -55
- package/lib/typescript/commonjs/utils/crossApex.d.ts.map +0 -1
- package/lib/typescript/module/ui/context/inSessionTokenRefresh.d.ts +0 -106
- package/lib/typescript/module/ui/context/inSessionTokenRefresh.d.ts.map +0 -1
- package/lib/typescript/module/ui/context/silentSessionRestore.d.ts +0 -36
- package/lib/typescript/module/ui/context/silentSessionRestore.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/useWebSSO.d.ts +0 -19
- package/lib/typescript/module/ui/hooks/useWebSSO.d.ts.map +0 -1
- package/lib/typescript/module/ui/session/projectSessionState.d.ts +0 -45
- package/lib/typescript/module/ui/session/projectSessionState.d.ts.map +0 -1
- package/lib/typescript/module/ui/session/sessionClientHost.d.ts +0 -14
- package/lib/typescript/module/ui/session/sessionClientHost.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +0 -67
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +0 -1
- package/lib/typescript/module/utils/crossApex.d.ts +0 -55
- package/lib/typescript/module/utils/crossApex.d.ts.map +0 -1
- package/src/ui/context/inSessionTokenRefresh.ts +0 -264
- package/src/ui/context/silentSessionRestore.ts +0 -53
- package/src/ui/hooks/useWebSSO.ts +0 -23
- package/src/ui/session/__tests__/projectSessionState.test.ts +0 -114
- package/src/ui/session/__tests__/sessionClientHost.test.ts +0 -43
- package/src/ui/session/projectSessionState.ts +0 -85
- package/src/ui/session/sessionClientHost.ts +0 -27
- package/src/ui/utils/activeAuthuser.ts +0 -142
- package/src/utils/crossApex.ts +0 -75
|
@@ -30,9 +30,14 @@
|
|
|
30
30
|
* claim->commit sequence here keeps native and web identical and
|
|
31
31
|
* unit-testable.
|
|
32
32
|
*/
|
|
33
|
-
import { type
|
|
33
|
+
import { type SessionLoginResponse, type User } from '@oxyhq/core';
|
|
34
34
|
interface DeviceFlowClaimResult {
|
|
35
35
|
accessToken?: string;
|
|
36
|
+
/** Rotating refresh-token family head minted by `/auth/session/claim` on the
|
|
37
|
+
* trusted lane. Not on the core method's typed return, so read defensively;
|
|
38
|
+
* threaded into `commitSession` so the QR sign-in persists a durable session
|
|
39
|
+
* that survives a reload without a redirect. */
|
|
40
|
+
refreshToken?: string;
|
|
36
41
|
sessionId?: string;
|
|
37
42
|
deviceId?: string;
|
|
38
43
|
expiresAt?: string;
|
|
@@ -44,10 +49,8 @@ interface DeviceFlowClaimResult {
|
|
|
44
49
|
* trivially unit-testable with a stub and never pulls the RN/Expo runtime into
|
|
45
50
|
* a test bundle.
|
|
46
51
|
*
|
|
47
|
-
* Extends {@link SsoEstablishClient} (`requestSsoEstablishUrl`) so the WEB
|
|
48
|
-
* post-claim durable-session hop can be driven off the same client.
|
|
49
52
|
*/
|
|
50
|
-
export interface DeviceFlowClient
|
|
53
|
+
export interface DeviceFlowClient {
|
|
51
54
|
/**
|
|
52
55
|
* Exchange the device-flow `sessionToken` for the first access + refresh
|
|
53
56
|
* token, planting them on the client. Single-use; replay is rejected by the
|
|
@@ -71,15 +74,14 @@ export interface CompleteDeviceFlowSignInOptions {
|
|
|
71
74
|
* registers the account into the device's server-authoritative session set,
|
|
72
75
|
* persists it durably, and hydrates the full user profile. Runs AFTER the
|
|
73
76
|
* bearer is planted so its bearer-protected calls succeed.
|
|
77
|
+
*
|
|
78
|
+
* The `refreshToken` extra (optional; not on the public `SessionLoginResponse`
|
|
79
|
+
* type) carries the rotating refresh family so the commit funnel persists a
|
|
80
|
+
* durable session.
|
|
74
81
|
*/
|
|
75
|
-
commitSession: (session: SessionLoginResponse
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* ({@link establishIdpSessionAfterClaim}). Omit in production — the defaults
|
|
79
|
-
* resolve to `window.*` (and no-op off-web / on native). Tests inject fakes to
|
|
80
|
-
* drive the web path deterministically.
|
|
81
|
-
*/
|
|
82
|
-
establishDeps?: EstablishAfterClaimDeps;
|
|
82
|
+
commitSession: (session: SessionLoginResponse & {
|
|
83
|
+
refreshToken?: string;
|
|
84
|
+
}) => Promise<void>;
|
|
83
85
|
}
|
|
84
86
|
/**
|
|
85
87
|
* Complete a device-flow sign-in: claim the first access token with the secret
|
|
@@ -90,6 +92,6 @@ export interface CompleteDeviceFlowSignInOptions {
|
|
|
90
92
|
* Throws if the claim did not return a usable session, or if either the claim
|
|
91
93
|
* or the commit fails; callers surface a retry UI.
|
|
92
94
|
*/
|
|
93
|
-
export declare function completeDeviceFlowSignIn({ oxyServices, sessionId, sessionToken, commitSession,
|
|
95
|
+
export declare function completeDeviceFlowSignIn({ oxyServices, sessionId, sessionToken, commitSession, }: CompleteDeviceFlowSignInOptions): Promise<User>;
|
|
94
96
|
export {};
|
|
95
97
|
//# sourceMappingURL=deviceFlowSignIn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFlowSignIn.d.ts","sourceRoot":"","sources":["../../../../src/utils/deviceFlowSignIn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAGL,KAAK,
|
|
1
|
+
{"version":3,"file":"deviceFlowSignIn.d.ts","sourceRoot":"","sources":["../../../../src/utils/deviceFlowSignIn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AAErB,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;oDAGgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,+BAA+B;IAC9C,6EAA6E;IAC7E,WAAW,EAAE,gBAAgB,CAAC;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;OAUG;IACH,aAAa,EAAE,CAAC,OAAO,EAAE,oBAAoB,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7F;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,GACd,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@oxyhq/contracts": "0.
|
|
109
|
+
"@oxyhq/contracts": "0.10.0"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@oxyhq/core": "^
|
|
112
|
+
"@oxyhq/core": "^7.0.0",
|
|
113
113
|
"nativewind": "5.0.0-preview.3",
|
|
114
114
|
"react-native-css": "^3.0.0",
|
|
115
115
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"peerDependencies": {
|
|
154
154
|
"@expo/vector-icons": "^15.0.3",
|
|
155
155
|
"@oxyhq/bloom": ">=0.16.0",
|
|
156
|
-
"@oxyhq/core": "^
|
|
156
|
+
"@oxyhq/core": "^7.0.0",
|
|
157
157
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
158
158
|
"@react-native-community/netinfo": "^11.4.1",
|
|
159
159
|
"@tanstack/query-async-storage-persister": "^5.101",
|
package/src/index.ts
CHANGED
|
@@ -77,7 +77,7 @@ export {
|
|
|
77
77
|
useUserByUsername,
|
|
78
78
|
useUsersBySessions,
|
|
79
79
|
usePrivacySettings,
|
|
80
|
-
|
|
80
|
+
useConnectedApps,
|
|
81
81
|
} from './ui/hooks/queries/useAccountQueries';
|
|
82
82
|
export {
|
|
83
83
|
useSessions,
|
|
@@ -124,7 +124,7 @@ export {
|
|
|
124
124
|
useUpdatePrivacySettings,
|
|
125
125
|
useUpdateNotificationPreferences,
|
|
126
126
|
useUpdateUserPreferences,
|
|
127
|
-
|
|
127
|
+
useRevokeConnectedApp,
|
|
128
128
|
useUploadFile,
|
|
129
129
|
} from './ui/hooks/mutations/useAccountMutations';
|
|
130
130
|
export {
|
|
@@ -180,10 +180,6 @@ export {
|
|
|
180
180
|
extractErrorMessage,
|
|
181
181
|
} from './ui/utils/errorHandlers';
|
|
182
182
|
export type { HandleAuthErrorOptions } from './ui/utils/errorHandlers';
|
|
183
|
-
// Thrown by `signInWithPassword` / `signIn` on a cross-apex web RP, where a
|
|
184
|
-
// direct (non-IdP) sign-in would not survive a page reload — apps catch it to
|
|
185
|
-
// route the user to the durable "Continue with Oxy" IdP flow.
|
|
186
|
-
export { CrossApexDirectSignInError, isCrossApexWeb } from './utils/crossApex';
|
|
187
183
|
|
|
188
184
|
// ---------------------------------------------------------------------------
|
|
189
185
|
// File filtering
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
|
|
3
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
4
|
+
import { useTheme } from '@oxyhq/bloom/theme';
|
|
5
|
+
import Avatar from './Avatar';
|
|
6
|
+
import { useI18n } from '../hooks/useI18n';
|
|
7
|
+
import type { SwitchableAccount } from '../hooks/useSwitchableAccounts';
|
|
8
|
+
|
|
9
|
+
export interface SignInAccountChooserProps {
|
|
10
|
+
/** Accounts available on this device / in the caller's graph, current first. */
|
|
11
|
+
accounts: SwitchableAccount[];
|
|
12
|
+
/** Selecting a row — the active account continues, others switch into. */
|
|
13
|
+
onSelectAccount: (account: SwitchableAccount) => void;
|
|
14
|
+
/** "Use another account" → reveal the sign-in options (password / QR / add). */
|
|
15
|
+
onUseAnother: () => void;
|
|
16
|
+
/** The account id currently being switched into (shows a per-row spinner). */
|
|
17
|
+
pendingAccountId?: string | null;
|
|
18
|
+
/** Disables every row while a selection is in flight. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Google-style account chooser (React Native). Lists every account the user can
|
|
24
|
+
* continue as — device sign-ins + linked graph accounts, from
|
|
25
|
+
* {@link SwitchableAccount} — plus a "Use another account" affordance. Rendered
|
|
26
|
+
* as the FRONT screen of the sign-in surfaces (`SignInModal` web,
|
|
27
|
+
* `OxyAuthScreen` native) whenever accounts exist; selecting a row funnels into
|
|
28
|
+
* the SAME `switchToAccount` path the account switcher uses. When no accounts
|
|
29
|
+
* exist the surfaces skip this and show the sign-in options directly.
|
|
30
|
+
*
|
|
31
|
+
* Presentational + chrome-agnostic (no modal/sheet wrapper, no data fetching) so
|
|
32
|
+
* both containers reuse it and it is unit-testable in isolation.
|
|
33
|
+
*/
|
|
34
|
+
export const SignInAccountChooser: React.FC<SignInAccountChooserProps> = ({
|
|
35
|
+
accounts,
|
|
36
|
+
onSelectAccount,
|
|
37
|
+
onUseAnother,
|
|
38
|
+
pendingAccountId,
|
|
39
|
+
disabled,
|
|
40
|
+
}) => {
|
|
41
|
+
const { colors } = useTheme();
|
|
42
|
+
const { t } = useI18n();
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View style={styles.container}>
|
|
46
|
+
{accounts.map((account) => {
|
|
47
|
+
const isPending = pendingAccountId === account.accountId;
|
|
48
|
+
const secondary = account.email;
|
|
49
|
+
return (
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
key={account.accountId}
|
|
52
|
+
accessibilityRole="button"
|
|
53
|
+
accessibilityLabel={t('signin.chooser.continueAs', { name: account.displayName })}
|
|
54
|
+
accessibilityState={{ selected: account.isCurrent, disabled: Boolean(disabled) }}
|
|
55
|
+
onPress={() => onSelectAccount(account)}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
activeOpacity={0.7}
|
|
58
|
+
style={[
|
|
59
|
+
styles.row,
|
|
60
|
+
{ borderColor: colors.border },
|
|
61
|
+
account.isCurrent && { backgroundColor: colors.primarySubtle, borderColor: colors.primarySubtle },
|
|
62
|
+
disabled && !isPending && styles.rowDisabled,
|
|
63
|
+
]}
|
|
64
|
+
>
|
|
65
|
+
<Avatar uri={account.avatarUrl} name={account.displayName} size={44} />
|
|
66
|
+
<View style={styles.info}>
|
|
67
|
+
<Text style={[styles.name, { color: colors.text }]} numberOfLines={1}>
|
|
68
|
+
{account.displayName}
|
|
69
|
+
</Text>
|
|
70
|
+
{secondary ? (
|
|
71
|
+
<Text style={[styles.secondary, { color: colors.textSecondary }]} numberOfLines={1}>
|
|
72
|
+
{secondary}
|
|
73
|
+
</Text>
|
|
74
|
+
) : null}
|
|
75
|
+
</View>
|
|
76
|
+
{isPending ? (
|
|
77
|
+
<ActivityIndicator size="small" color={colors.primary} />
|
|
78
|
+
) : account.isCurrent ? (
|
|
79
|
+
<View style={[styles.currentPill, { backgroundColor: colors.card }]}>
|
|
80
|
+
<Ionicons name="checkmark" size={14} color={colors.primary} />
|
|
81
|
+
<Text style={[styles.currentPillText, { color: colors.primary }]}>
|
|
82
|
+
{t('signin.chooser.signedIn')}
|
|
83
|
+
</Text>
|
|
84
|
+
</View>
|
|
85
|
+
) : (
|
|
86
|
+
<Ionicons name="chevron-forward" size={20} color={colors.textSecondary} />
|
|
87
|
+
)}
|
|
88
|
+
</TouchableOpacity>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
|
|
92
|
+
<TouchableOpacity
|
|
93
|
+
accessibilityRole="button"
|
|
94
|
+
accessibilityLabel={t('signin.chooser.useAnother')}
|
|
95
|
+
onPress={onUseAnother}
|
|
96
|
+
disabled={disabled}
|
|
97
|
+
activeOpacity={0.7}
|
|
98
|
+
style={[styles.row, { borderColor: colors.border }, disabled && styles.rowDisabled]}
|
|
99
|
+
>
|
|
100
|
+
<View style={[styles.addIcon, { backgroundColor: colors.backgroundSecondary }]}>
|
|
101
|
+
<Ionicons name="person-add-outline" size={20} color={colors.textSecondary} />
|
|
102
|
+
</View>
|
|
103
|
+
<View style={styles.info}>
|
|
104
|
+
<Text style={[styles.name, { color: colors.text }]}>{t('signin.chooser.useAnother')}</Text>
|
|
105
|
+
</View>
|
|
106
|
+
<Ionicons name="chevron-forward" size={20} color={colors.textSecondary} />
|
|
107
|
+
</TouchableOpacity>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const styles = StyleSheet.create({
|
|
113
|
+
container: {
|
|
114
|
+
width: '100%',
|
|
115
|
+
gap: 8,
|
|
116
|
+
},
|
|
117
|
+
row: {
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
gap: 12,
|
|
121
|
+
borderWidth: 1,
|
|
122
|
+
borderRadius: 14,
|
|
123
|
+
paddingHorizontal: 14,
|
|
124
|
+
paddingVertical: 12,
|
|
125
|
+
},
|
|
126
|
+
rowDisabled: {
|
|
127
|
+
opacity: 0.5,
|
|
128
|
+
},
|
|
129
|
+
info: {
|
|
130
|
+
flex: 1,
|
|
131
|
+
minWidth: 0,
|
|
132
|
+
},
|
|
133
|
+
name: {
|
|
134
|
+
fontSize: 15,
|
|
135
|
+
fontWeight: '600',
|
|
136
|
+
},
|
|
137
|
+
secondary: {
|
|
138
|
+
fontSize: 13,
|
|
139
|
+
marginTop: 2,
|
|
140
|
+
},
|
|
141
|
+
currentPill: {
|
|
142
|
+
flexDirection: 'row',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
gap: 3,
|
|
145
|
+
paddingHorizontal: 8,
|
|
146
|
+
paddingVertical: 3,
|
|
147
|
+
borderRadius: 999,
|
|
148
|
+
},
|
|
149
|
+
currentPillText: {
|
|
150
|
+
fontSize: 12,
|
|
151
|
+
fontWeight: '600',
|
|
152
|
+
},
|
|
153
|
+
addIcon: {
|
|
154
|
+
width: 44,
|
|
155
|
+
height: 44,
|
|
156
|
+
borderRadius: 22,
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export default SignInAccountChooser;
|