@oxyhq/services 16.0.0 → 17.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.
Files changed (251) hide show
  1. package/lib/commonjs/index.js +21 -51
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/client.js +0 -14
  4. package/lib/commonjs/ui/client.js.map +1 -1
  5. package/lib/commonjs/ui/components/OxyAccountDialog.js +764 -0
  6. package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -0
  7. package/lib/commonjs/ui/components/OxyProvider.js +11 -6
  8. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  9. package/lib/commonjs/ui/components/OxySignInButton.js +10 -21
  10. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  11. package/lib/commonjs/ui/components/ProfileButton.js +25 -112
  12. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
  13. package/lib/commonjs/ui/components/RequireOxyAuth.js +299 -0
  14. package/lib/commonjs/ui/components/RequireOxyAuth.js.map +1 -0
  15. package/lib/commonjs/ui/context/OxyContext.js +106 -2
  16. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  17. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +1 -1
  18. package/lib/commonjs/ui/hooks/useAuth.js +19 -30
  19. package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
  20. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +37 -267
  21. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +1 -1
  22. package/lib/commonjs/ui/index.js +5 -40
  23. package/lib/commonjs/ui/index.js.map +1 -1
  24. package/lib/commonjs/ui/navigation/accountDialogManager.js +91 -0
  25. package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -0
  26. package/lib/commonjs/ui/navigation/routes.js +0 -2
  27. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  28. package/lib/commonjs/ui/screens/ManageAccountScreen.js +4 -3
  29. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  30. package/lib/commonjs/ui/session/createSessionClient.js +10 -2
  31. package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
  32. package/lib/module/index.js +18 -15
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/ui/client.js +1 -2
  35. package/lib/module/ui/client.js.map +1 -1
  36. package/lib/module/ui/components/OxyAccountDialog.js +761 -0
  37. package/lib/module/ui/components/OxyAccountDialog.js.map +1 -0
  38. package/lib/module/ui/components/OxyProvider.js +11 -6
  39. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  40. package/lib/module/ui/components/OxySignInButton.js +10 -21
  41. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  42. package/lib/module/ui/components/ProfileButton.js +26 -112
  43. package/lib/module/ui/components/ProfileButton.js.map +1 -1
  44. package/lib/module/ui/components/RequireOxyAuth.js +294 -0
  45. package/lib/module/ui/components/RequireOxyAuth.js.map +1 -0
  46. package/lib/module/ui/context/OxyContext.js +107 -3
  47. package/lib/module/ui/context/OxyContext.js.map +1 -1
  48. package/lib/module/ui/hooks/mutations/useAccountMutations.js +1 -1
  49. package/lib/module/ui/hooks/useAuth.js +19 -30
  50. package/lib/module/ui/hooks/useAuth.js.map +1 -1
  51. package/lib/module/ui/hooks/useSwitchableAccounts.js +38 -267
  52. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +1 -1
  53. package/lib/module/ui/index.js +1 -5
  54. package/lib/module/ui/index.js.map +1 -1
  55. package/lib/module/ui/navigation/accountDialogManager.js +81 -0
  56. package/lib/module/ui/navigation/accountDialogManager.js.map +1 -0
  57. package/lib/module/ui/navigation/routes.js +0 -2
  58. package/lib/module/ui/navigation/routes.js.map +1 -1
  59. package/lib/module/ui/screens/ManageAccountScreen.js +4 -3
  60. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  61. package/lib/module/ui/session/createSessionClient.js +10 -2
  62. package/lib/module/ui/session/createSessionClient.js.map +1 -1
  63. package/lib/typescript/commonjs/index.d.ts +4 -11
  64. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/ui/client.d.ts +0 -4
  66. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts +35 -0
  68. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts +2 -2
  70. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +11 -23
  73. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts +55 -0
  75. package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts.map +1 -0
  76. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +13 -1
  77. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +13 -152
  81. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/ui/index.d.ts +2 -5
  83. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +49 -0
  85. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  87. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +1 -1
  89. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +9 -2
  91. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/ui/types/navigation.d.ts +9 -0
  93. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  94. package/lib/typescript/module/index.d.ts +4 -11
  95. package/lib/typescript/module/index.d.ts.map +1 -1
  96. package/lib/typescript/module/ui/client.d.ts +0 -4
  97. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  98. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts +35 -0
  99. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -0
  100. package/lib/typescript/module/ui/components/OxyProvider.d.ts +2 -2
  101. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  102. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  103. package/lib/typescript/module/ui/components/ProfileButton.d.ts +11 -23
  104. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
  105. package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts +55 -0
  106. package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts.map +1 -0
  107. package/lib/typescript/module/ui/context/OxyContext.d.ts +13 -1
  108. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  109. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  110. package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
  111. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +13 -152
  112. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  113. package/lib/typescript/module/ui/index.d.ts +2 -5
  114. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  115. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +49 -0
  116. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -0
  117. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  118. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  119. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
  120. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  121. package/lib/typescript/module/ui/session/createSessionClient.d.ts +9 -2
  122. package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
  123. package/lib/typescript/module/ui/types/navigation.d.ts +9 -0
  124. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  125. package/package.json +2 -2
  126. package/src/index.ts +21 -26
  127. package/src/ui/client.ts +0 -4
  128. package/src/ui/components/OxyAccountDialog.tsx +760 -0
  129. package/src/ui/components/OxyProvider.tsx +12 -6
  130. package/src/ui/components/OxySignInButton.tsx +10 -21
  131. package/src/ui/components/ProfileButton.tsx +23 -126
  132. package/src/ui/components/RequireOxyAuth.tsx +266 -0
  133. package/src/ui/context/OxyContext.tsx +146 -7
  134. package/src/ui/hooks/mutations/useAccountMutations.ts +1 -1
  135. package/src/ui/hooks/useAuth.ts +19 -31
  136. package/src/ui/hooks/useSwitchableAccounts.ts +42 -376
  137. package/src/ui/index.ts +2 -5
  138. package/src/ui/navigation/accountDialogManager.ts +84 -0
  139. package/src/ui/navigation/routes.ts +0 -4
  140. package/src/ui/screens/ManageAccountScreen.tsx +3 -2
  141. package/src/ui/session/createSessionClient.ts +9 -1
  142. package/src/ui/types/navigation.ts +9 -0
  143. package/lib/commonjs/ui/components/AccountMenu.js +0 -598
  144. package/lib/commonjs/ui/components/AccountMenu.js.map +0 -1
  145. package/lib/commonjs/ui/components/AccountMenuButton.js +0 -135
  146. package/lib/commonjs/ui/components/AccountMenuButton.js.map +0 -1
  147. package/lib/commonjs/ui/components/AccountSwitcher.js +0 -780
  148. package/lib/commonjs/ui/components/AccountSwitcher.js.map +0 -1
  149. package/lib/commonjs/ui/components/AnotherDeviceQR.js +0 -116
  150. package/lib/commonjs/ui/components/AnotherDeviceQR.js.map +0 -1
  151. package/lib/commonjs/ui/components/ProfileMenu.js +0 -518
  152. package/lib/commonjs/ui/components/ProfileMenu.js.map +0 -1
  153. package/lib/commonjs/ui/components/SignInAccountChooser.js +0 -189
  154. package/lib/commonjs/ui/components/SignInAccountChooser.js.map +0 -1
  155. package/lib/commonjs/ui/components/SignInModal.js +0 -600
  156. package/lib/commonjs/ui/components/SignInModal.js.map +0 -1
  157. package/lib/commonjs/ui/hooks/useOxyAuthSession.js +0 -501
  158. package/lib/commonjs/ui/hooks/useOxyAuthSession.js.map +0 -1
  159. package/lib/commonjs/ui/hooks/usePasswordSignIn.js +0 -170
  160. package/lib/commonjs/ui/hooks/usePasswordSignIn.js.map +0 -1
  161. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -51
  162. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
  163. package/lib/commonjs/ui/screens/OxyAuthScreen.js +0 -312
  164. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +0 -1
  165. package/lib/commonjs/utils/deviceFlowSignIn.js +0 -109
  166. package/lib/commonjs/utils/deviceFlowSignIn.js.map +0 -1
  167. package/lib/module/ui/components/AccountMenu.js +0 -593
  168. package/lib/module/ui/components/AccountMenu.js.map +0 -1
  169. package/lib/module/ui/components/AccountMenuButton.js +0 -130
  170. package/lib/module/ui/components/AccountMenuButton.js.map +0 -1
  171. package/lib/module/ui/components/AccountSwitcher.js +0 -774
  172. package/lib/module/ui/components/AccountSwitcher.js.map +0 -1
  173. package/lib/module/ui/components/AnotherDeviceQR.js +0 -110
  174. package/lib/module/ui/components/AnotherDeviceQR.js.map +0 -1
  175. package/lib/module/ui/components/ProfileMenu.js +0 -514
  176. package/lib/module/ui/components/ProfileMenu.js.map +0 -1
  177. package/lib/module/ui/components/SignInAccountChooser.js +0 -183
  178. package/lib/module/ui/components/SignInAccountChooser.js.map +0 -1
  179. package/lib/module/ui/components/SignInModal.js +0 -591
  180. package/lib/module/ui/components/SignInModal.js.map +0 -1
  181. package/lib/module/ui/hooks/useOxyAuthSession.js +0 -495
  182. package/lib/module/ui/hooks/useOxyAuthSession.js.map +0 -1
  183. package/lib/module/ui/hooks/usePasswordSignIn.js +0 -165
  184. package/lib/module/ui/hooks/usePasswordSignIn.js.map +0 -1
  185. package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -48
  186. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
  187. package/lib/module/ui/screens/OxyAuthScreen.js +0 -306
  188. package/lib/module/ui/screens/OxyAuthScreen.js.map +0 -1
  189. package/lib/module/utils/deviceFlowSignIn.js +0 -106
  190. package/lib/module/utils/deviceFlowSignIn.js.map +0 -1
  191. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts +0 -47
  192. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts.map +0 -1
  193. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +0 -26
  194. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +0 -1
  195. package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts +0 -46
  196. package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts.map +0 -1
  197. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts +0 -34
  198. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts.map +0 -1
  199. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts +0 -49
  200. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts.map +0 -1
  201. package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts +0 -29
  202. package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts.map +0 -1
  203. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +0 -28
  204. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +0 -1
  205. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts +0 -105
  206. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts.map +0 -1
  207. package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts +0 -31
  208. package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts.map +0 -1
  209. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +0 -11
  210. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  211. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts +0 -22
  212. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +0 -1
  213. package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts +0 -97
  214. package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts.map +0 -1
  215. package/lib/typescript/module/ui/components/AccountMenu.d.ts +0 -47
  216. package/lib/typescript/module/ui/components/AccountMenu.d.ts.map +0 -1
  217. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +0 -26
  218. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +0 -1
  219. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts +0 -46
  220. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts.map +0 -1
  221. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts +0 -34
  222. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts.map +0 -1
  223. package/lib/typescript/module/ui/components/ProfileMenu.d.ts +0 -49
  224. package/lib/typescript/module/ui/components/ProfileMenu.d.ts.map +0 -1
  225. package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts +0 -29
  226. package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts.map +0 -1
  227. package/lib/typescript/module/ui/components/SignInModal.d.ts +0 -28
  228. package/lib/typescript/module/ui/components/SignInModal.d.ts.map +0 -1
  229. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts +0 -105
  230. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts.map +0 -1
  231. package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts +0 -31
  232. package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts.map +0 -1
  233. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +0 -11
  234. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  235. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +0 -22
  236. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +0 -1
  237. package/lib/typescript/module/utils/deviceFlowSignIn.d.ts +0 -97
  238. package/lib/typescript/module/utils/deviceFlowSignIn.d.ts.map +0 -1
  239. package/src/ui/components/AccountMenu.tsx +0 -645
  240. package/src/ui/components/AccountMenuButton.tsx +0 -126
  241. package/src/ui/components/AccountSwitcher.tsx +0 -751
  242. package/src/ui/components/AnotherDeviceQR.tsx +0 -119
  243. package/src/ui/components/ProfileMenu.tsx +0 -564
  244. package/src/ui/components/SignInAccountChooser.tsx +0 -162
  245. package/src/ui/components/SignInModal.tsx +0 -530
  246. package/src/ui/hooks/useOxyAuthSession.ts +0 -635
  247. package/src/ui/hooks/usePasswordSignIn.ts +0 -207
  248. package/src/ui/screens/AccountSwitcherScreen.tsx +0 -43
  249. package/src/ui/screens/OxyAuthScreen.tsx +0 -324
  250. package/src/utils/__tests__/deviceFlowSignIn.test.ts +0 -231
  251. package/src/utils/deviceFlowSignIn.ts +0 -152
@@ -1,49 +0,0 @@
1
- import type React from 'react';
2
- /**
3
- * Web-only anchor. `ProfileButton` measures its trigger and anchors the panel to
4
- * one corner so the menu opens either UPWARD (footer trigger) or DOWNWARD (a
5
- * trigger at the top of a sidebar). Exactly ONE vertical edge is pinned:
6
- * - `bottom` set → the panel's BOTTOM edge is anchored, so it opens UPWARD.
7
- * - `top` set → the panel's TOP edge is anchored, so it opens DOWNWARD.
8
- * Native ignores the anchor and docks the panel to the bottom as a sheet.
9
- */
10
- export interface ProfileMenuAnchor {
11
- /** Distance from the viewport left, for the panel's LEFT edge. */
12
- left: number;
13
- /** Distance from the viewport bottom, for the panel's BOTTOM edge (opens upward). */
14
- bottom?: number;
15
- /** Distance from the viewport top, for the panel's TOP edge (opens downward). */
16
- top?: number;
17
- }
18
- export interface ProfileMenuProps {
19
- open: boolean;
20
- onClose: () => void;
21
- /** Web-only trigger anchor. Native ignores this (bottom-sheet style). */
22
- anchor?: ProfileMenuAnchor | null;
23
- /** Navigate to the "Manage account" surface (settings). */
24
- onNavigateManage: () => void;
25
- /** Start the add-account / sign-in flow for an additional account. */
26
- onAddAccount: () => void;
27
- /** Optional: navigate to the signed-in user's own profile. */
28
- onNavigateProfile?: () => void;
29
- /** Called before the active identity changes so apps can clear scoped state. */
30
- onBeforeSessionChange?: () => void | Promise<void>;
31
- }
32
- /**
33
- * Clean account switcher, written with react-native `StyleSheet` + Bloom
34
- * theme colors (the package convention — no NativeWind, which is only an
35
- * optional peer and absent in the primary `accounts` consumer). Lists EVERY
36
- * switchable account from {@link useSwitchableAccounts}
37
- * — device sign-ins AND linked graph accounts (owned orgs + shared-with-you) —
38
- * and routes EVERY switch through the context's single
39
- * `switchToAccount(accountId)` dispatcher (there is no separate device-only
40
- * path). Each on-device inactive row carries a per-account sign-out icon;
41
- * graph-only rows carry a role badge and indent under their parent. Below the
42
- * list: Add account, Manage account, optional View profile, and Sign out of all.
43
- *
44
- * Renders as an upward-opening popover anchored to the trigger on web, and a
45
- * bottom-sheet style modal on native.
46
- */
47
- declare const ProfileMenu: React.FC<ProfileMenuProps>;
48
- export default ProfileMenu;
49
- //# sourceMappingURL=ProfileMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProfileMenu.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ProfileMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAC9B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,2DAA2D;IAC3D,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,sEAAsE;IACtE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8V3C,CAAC;AA0IF,eAAe,WAAW,CAAC"}
@@ -1,29 +0,0 @@
1
- import type React from 'react';
2
- import type { SwitchableAccount } from '../hooks/useSwitchableAccounts.js';
3
- export interface SignInAccountChooserProps {
4
- /** Accounts available on this device / in the caller's graph, current first. */
5
- accounts: SwitchableAccount[];
6
- /** Selecting a row — the active account continues, others switch into. */
7
- onSelectAccount: (account: SwitchableAccount) => void;
8
- /** "Use another account" → reveal the sign-in options (password / QR / add). */
9
- onUseAnother: () => void;
10
- /** The account id currently being switched into (shows a per-row spinner). */
11
- pendingAccountId?: string | null;
12
- /** Disables every row while a selection is in flight. */
13
- disabled?: boolean;
14
- }
15
- /**
16
- * Google-style account chooser (React Native). Lists every account the user can
17
- * continue as — device sign-ins + linked graph accounts, from
18
- * {@link SwitchableAccount} — plus a "Use another account" affordance. Rendered
19
- * as the FRONT screen of the sign-in surfaces (`SignInModal` web,
20
- * `OxyAuthScreen` native) whenever accounts exist; selecting a row funnels into
21
- * the SAME `switchToAccount` path the account switcher uses. When no accounts
22
- * exist the surfaces skip this and show the sign-in options directly.
23
- *
24
- * Presentational + chrome-agnostic (no modal/sheet wrapper, no data fetching) so
25
- * both containers reuse it and it is unit-testable in isolation.
26
- */
27
- export declare const SignInAccountChooser: React.FC<SignInAccountChooserProps>;
28
- export default SignInAccountChooser;
29
- //# sourceMappingURL=SignInAccountChooser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignInAccountChooser.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/SignInAccountChooser.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAgC,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACtC,gFAAgF;IAChF,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,0EAA0E;IAC1E,eAAe,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtD,gFAAgF;IAChF,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA4EpE,CAAC;AAoDF,eAAe,oBAAoB,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * SignInModal — web-first centered sign-in modal.
3
- *
4
- * Two phases, Google-style:
5
- * 1. Account chooser (FRONT screen, shown when the device/user already has
6
- * accounts): pick an account to continue as — one tap switches through the
7
- * SAME `switchToAccount` path the account switcher uses — or "Use another
8
- * account" to reveal the sign-in options.
9
- * 2. Sign-in options: the first-party password flow (identifier → password →
10
- * optional 2FA, `usePasswordSignIn`) as the PRIMARY action, with the
11
- * cross-app device flow (same-device deep-link + "sign in on another device"
12
- * QR) as a SECONDARY option below an "or" divider.
13
- *
14
- * When there are no accounts the modal opens straight on the sign-in options.
15
- * The device-flow machinery lives in the shared `useOxyAuthSession` hook (the
16
- * native `OxyAuthScreen` consumes it too — neither container re-implements the
17
- * transport). Animates with a fade + scale; per-phase content cross-fades and
18
- * respects reduced motion.
19
- */
20
- import type React from 'react';
21
- export declare const showSignInModal: () => void;
22
- export declare const hideSignInModal: () => void;
23
- export declare const isSignInModalVisible: () => boolean;
24
- /** Subscribe to modal visibility changes */
25
- export declare const subscribeToSignInModal: (listener: (visible: boolean) => void) => (() => void);
26
- declare const SignInModal: React.FC;
27
- export default SignInModal;
28
- //# sourceMappingURL=SignInModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignInModal.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/SignInModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,eAAO,MAAM,eAAe,YAI3B,CAAC;AAEF,eAAO,MAAM,eAAe,YAI3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAqB,CAAC;AAEvD,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,GAAI,UAAU,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAGxF,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAkBxB,CAAC;AAybF,eAAe,WAAW,CAAC"}
@@ -1,105 +0,0 @@
1
- /**
2
- * useOxyAuthSession — the single shared engine for the cross-app device-flow
3
- * sign-in ("Sign in with Oxy") used by BOTH containers:
4
- *
5
- * - `SignInModal` (web centered modal)
6
- * - `OxyAuthScreen` (native bottom sheet)
7
- *
8
- * Before this hook existed, those two files each re-implemented ~90% of the
9
- * same auth-session machinery (session-token creation, QR data, socket.io
10
- * `/auth-session` subscription, the HTTP polling fallback, waiting/error/retry
11
- * state, the open-auth handler, and cleanup) — and they had drifted (notably a
12
- * weaker `Math.random()` session token on native vs the crypto-secure one on
13
- * web). This hook owns ALL of it ONCE, with a clean typed surface, so the
14
- * containers only own their layout. The transport is functionally identical to
15
- * the previous implementations — this is a structural de-duplication, not a
16
- * behavior change.
17
- *
18
- * The native-only deep-link return path (`Linking` redirect handling) lives
19
- * HERE, gated to native via `Platform.OS`, so the web container never carries
20
- * native-only code while the two paths still cannot drift.
21
- */
22
- import type { OxyServices, SessionLoginResponse, User } from '@oxyhq/core';
23
- /**
24
- * Default destination for the "Create an Oxy account" / "Get Oxy Accounts"
25
- * link, shared by both containers. Reused as-is from the original native
26
- * `OxyAuthScreen` so no new route is invented.
27
- */
28
- export declare const OXY_ACCOUNTS_WEB_URL = "https://accounts.oxy.so";
29
- /** Default central Oxy auth web origin used when no override can be resolved. */
30
- export declare const OXY_AUTH_WEB_URL = "https://auth.oxy.so";
31
- /** Auth session expiration (5 minutes). */
32
- export declare const AUTH_SESSION_EXPIRY_MS: number;
33
- /** Polling interval (fallback if the socket fails) in milliseconds. */
34
- export declare const POLLING_INTERVAL_MS = 3000;
35
- /** The active device-flow session this client created and is waiting on. */
36
- export interface AuthSession {
37
- /** The secret high-entropy token that IS the device-flow credential. */
38
- sessionToken: string;
39
- /** Epoch ms after which the server rejects this session. */
40
- expiresAt: number;
41
- }
42
- export interface UseOxyAuthSessionOptions {
43
- /**
44
- * Called after a fully completed sign-in (bearer claimed, session hydrated).
45
- * The web modal closes itself here; the native screen forwards the user to
46
- * its `onAuthenticated` prop. The hook itself stays presentation-agnostic.
47
- */
48
- onSignedIn?: (user: User) => void;
49
- }
50
- export interface UseOxyAuthSessionResult {
51
- /** The active device-flow session, or `null` before/while it is created. */
52
- authSession: AuthSession | null;
53
- /** The QR payload string (`oxyauth://<token>`), or `''` when no session. */
54
- qrData: string;
55
- /**
56
- * The PUBLIC, single-use authorize code for the "Sign in with Oxy" handoff,
57
- * or `null` when the handoff backend did not return one. The approver (the
58
- * Oxy identity app) resolves the requesting app's identity from this code —
59
- * it is safe to display; it is NOT the secret `sessionToken`.
60
- */
61
- authorizeCode: string | null;
62
- /**
63
- * The structured "Sign in with Oxy" deep-link payload
64
- * (`oxycommons://approve?...`) to render in the cross-device QR and to open on
65
- * the same device, or `null` when the handoff backend did not return one.
66
- * Render this (preferred over `qrData`) in the QR and pass it to
67
- * `Linking.openURL` for same-device approval.
68
- */
69
- qrPayload: string | null;
70
- /** `true` while the session is being created (initial spinner). */
71
- isLoading: boolean;
72
- /** A user-facing error message, or `null`. Drives the retry UI. */
73
- error: string | null;
74
- /** `true` once a session exists and we are awaiting authorization. */
75
- isWaiting: boolean;
76
- /**
77
- * Open the central Oxy auth approval surface for THIS device-flow session.
78
- * On web this opens a centered approval popup; on native it opens the system
79
- * browser (carrying a `redirect_uri` so the deep-link return path can fire).
80
- * This is the action behind the platform-primary "Continue with Oxy" button.
81
- */
82
- openAuthApproval: () => Promise<void>;
83
- /**
84
- * Same-device "Sign in with Oxy" handoff: deep-link to `qrPayload`
85
- * (`oxycommons://approve?...`) so the native Oxy identity app opens directly
86
- * to approve. No-op when no `qrPayload` was returned. The socket / poll still
87
- * completes the sign-in once the approval lands.
88
- */
89
- openSameDeviceApproval: () => Promise<void>;
90
- /** Tear down the current session and create a fresh one (the retry action). */
91
- retry: () => void;
92
- /** Disconnect the socket and stop polling. Idempotent. */
93
- cleanup: () => void;
94
- }
95
- /**
96
- * Owns the full device-flow auth-session lifecycle for one mounted sign-in
97
- * surface. Both `SignInModal` and `OxyAuthScreen` consume this; neither
98
- * re-implements the socket / polling / deep-link transport.
99
- *
100
- * Subscriptions (socket connect/disconnect, the poll interval, the native
101
- * deep-link listener, and unmount cleanup) are the legitimate `useEffect` use
102
- * WITH cleanup. No effect here computes derived UI state.
103
- */
104
- export declare function useOxyAuthSession(oxyServices: OxyServices, clientId: string | null, commitSession: ((session: SessionLoginResponse) => Promise<void>) | undefined, options?: UseOxyAuthSessionOptions): UseOxyAuthSessionResult;
105
- //# sourceMappingURL=useOxyAuthSession.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOxyAuthSession.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useOxyAuthSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAM3E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,QAAgB,CAAC;AAEpD,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAgCD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,4EAA4E;IAC5E,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sEAAsE;IACtE,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC;;;;;OAKG;IACH,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,+EAA+E;IAC/E,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAoFD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,EAC7E,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,CA8YzB"}
@@ -1,31 +0,0 @@
1
- export type PasswordSignInStep = 'identifier' | 'password' | 'twoFactor';
2
- export interface UsePasswordSignInOptions {
3
- /** Fired once a session has been committed (the surface should close). */
4
- onSignedIn?: () => void;
5
- }
6
- export interface UsePasswordSignInResult {
7
- step: PasswordSignInStep;
8
- identifier: string;
9
- setIdentifier: (value: string) => void;
10
- password: string;
11
- setPassword: (value: string) => void;
12
- /** The current 2FA input — a TOTP code or a backup code, per `useBackupCode`. */
13
- code: string;
14
- setCode: (value: string) => void;
15
- useBackupCode: boolean;
16
- setUseBackupCode: (value: boolean) => void;
17
- error: string | null;
18
- isSubmitting: boolean;
19
- /** Advance identifier → password (validates a non-empty identifier). */
20
- submitIdentifier: () => void;
21
- /** Submit the password: commits a one-step session, or advances to 2FA. */
22
- submitPassword: () => Promise<void>;
23
- /** Submit the 2FA code / backup code and commit the session. */
24
- submitTwoFactor: () => Promise<void>;
25
- /** Step back one screen (2FA → password → identifier), clearing the error. */
26
- back: () => void;
27
- /** Reset every field back to the identifier step. */
28
- reset: () => void;
29
- }
30
- export declare function usePasswordSignIn(options?: UsePasswordSignInOptions): UsePasswordSignInResult;
31
- //# sourceMappingURL=usePasswordSignIn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePasswordSignIn.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/usePasswordSignIn.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAEzE,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,2EAA2E;IAC3E,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,uBAAuB,CA4JjG"}
@@ -1,11 +0,0 @@
1
- import type React from 'react';
2
- import type { BaseScreenProps } from '../types/navigation.js';
3
- /**
4
- * Bottom-sheet route wrapper around {@link AccountSwitcherView}. Used when the
5
- * switcher is opened as a sheet (e.g. from the "Your accounts" entry in
6
- * ManageAccount) rather than as the header-chip popover (which uses the
7
- * `AccountSwitcher` modal directly).
8
- */
9
- declare const AccountSwitcherScreen: React.FC<BaseScreenProps>;
10
- export default AccountSwitcherScreen;
11
- //# sourceMappingURL=AccountSwitcherScreen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccountSwitcherScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountSwitcherScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAK3D;;;;;GAKG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0BpD,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1,22 +0,0 @@
1
- /**
2
- * OxyAuthScreen — Sign in with Oxy (native bottom-sheet container).
3
- *
4
- * Two phases, Google-style:
5
- * 1. Account chooser (FRONT screen, shown when the device/user already has
6
- * accounts): pick an account to continue as — one tap switches through the
7
- * SAME `switchToAccount` path the account switcher uses — or "Use another
8
- * account" to reveal the sign-in options.
9
- * 2. Sign-in options: the first-party password flow (identifier → password →
10
- * optional 2FA, `usePasswordSignIn`) as the PRIMARY action, with the
11
- * cross-app device flow (same-device deep-link + "sign in on another device"
12
- * QR) as a SECONDARY option below an "or" divider.
13
- *
14
- * The device-flow machinery lives in the shared `useOxyAuthSession` hook (the
15
- * web `SignInModal` consumes it too). This screen should NOT be used within the
16
- * Oxy Accounts app itself.
17
- */
18
- import type React from 'react';
19
- import type { BaseScreenProps } from '../types/navigation.js';
20
- declare const OxyAuthScreen: React.FC<BaseScreenProps>;
21
- export default OxyAuthScreen;
22
- //# sourceMappingURL=OxyAuthScreen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OxyAuthScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/OxyAuthScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAmB3D,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyR5C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,97 +0,0 @@
1
- /**
2
- * Shared, pure orchestration for completing the cross-app device-flow sign-in
3
- * (the QR-code / "Open Oxy Auth" path used on native and web).
4
- *
5
- * THE FIRST BUG THIS FIXES (native): once another authenticated device
6
- * approves the pending AuthSession, the originating client is notified
7
- * (socket / poll / deep-link) with the authorized `sessionId`. Before any
8
- * session-management code can use it, the client MUST exchange the secret
9
- * 128-bit `sessionToken` (held only by this client, generated for THIS flow)
10
- * for the first access token via `claimSessionByToken` — the device-flow
11
- * equivalent of OAuth's code-for-token exchange (RFC 8628 §3.4).
12
- *
13
- * THE SECOND BUG THIS FIXES (session-sync cutover regression): the
14
- * freshly-claimed session is NOT yet registered in the device's
15
- * server-authoritative session set — nothing has run
16
- * `sessionClient.addCurrentAccount()` for it — so it must NOT be committed
17
- * through `switchSession`. That path is now an account-SWITCH between
18
- * accounts already registered on this device (`OxyContext`'s
19
- * `switchSessionForContext`), and throws `No device account found for
20
- * session "..."` for anything else, surfacing as "Authorization successful
21
- * but failed to complete sign in." Instead the claimed session must be
22
- * committed through the SAME path a fresh password sign-in uses —
23
- * `useOxy().handleWebSession` (`OxyContext`'s `handleWebSSOSession`) — which
24
- * registers the account into the device set, persists it durably, and
25
- * hydrates the full user profile.
26
- *
27
- * Skipping the claim leaves the SDK with NO bearer token: the session is
28
- * authorized server-side but the app never becomes authenticated and the UI
29
- * sits "Waiting for authorization..." forever. Consolidating the
30
- * claim->commit sequence here keeps native and web identical and
31
- * unit-testable.
32
- */
33
- import { type SessionLoginResponse, type User } from '@oxyhq/core';
34
- interface DeviceFlowClaimResult {
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;
41
- sessionId?: string;
42
- deviceId?: string;
43
- expiresAt?: string;
44
- user?: User;
45
- }
46
- /**
47
- * The minimal `OxyServices` surface this orchestration needs. Kept as a
48
- * structural type (rather than importing the full client) so the helper is
49
- * trivially unit-testable with a stub and never pulls the RN/Expo runtime into
50
- * a test bundle.
51
- *
52
- */
53
- export interface DeviceFlowClient {
54
- /**
55
- * Exchange the device-flow `sessionToken` for the first access + refresh
56
- * token, planting them on the client. Single-use; replay is rejected by the
57
- * API. No bearer required — the high-entropy `sessionToken` IS the credential.
58
- */
59
- claimSessionByToken: (sessionToken: string) => Promise<DeviceFlowClaimResult | undefined>;
60
- }
61
- export interface CompleteDeviceFlowSignInOptions {
62
- /** The OxyServices client (or any object exposing `claimSessionByToken`). */
63
- oxyServices: DeviceFlowClient;
64
- /** The authorized device session id, delivered by the socket / poll / link. */
65
- sessionId: string;
66
- /**
67
- * The secret `sessionToken` generated for THIS flow and registered via
68
- * `POST /auth/session/create`. Required to claim the first access token.
69
- */
70
- sessionToken: string;
71
- /**
72
- * `useOxy().handleWebSession` — commits the freshly-claimed session into
73
- * context state through the SAME path a password sign-in uses:
74
- * registers the account into the device's server-authoritative session set,
75
- * persists it durably, and hydrates the full user profile. Runs AFTER the
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.
81
- */
82
- commitSession: (session: SessionLoginResponse & {
83
- refreshToken?: string;
84
- }) => Promise<void>;
85
- }
86
- /**
87
- * Complete a device-flow sign-in: claim the first access token with the secret
88
- * `sessionToken` (planting the bearer), then commit the resulting session via
89
- * `commitSession` (registers it into the device's server-authoritative session
90
- * set and hydrates the full user). Returns the authenticated user.
91
- *
92
- * Throws if the claim did not return a usable session, or if either the claim
93
- * or the commit fails; callers surface a retry UI.
94
- */
95
- export declare function completeDeviceFlowSignIn({ oxyServices, sessionId, sessionToken, commitSession, }: CompleteDeviceFlowSignInOptions): Promise<User>;
96
- export {};
97
- //# sourceMappingURL=deviceFlowSignIn.d.ts.map
@@ -1 +0,0 @@
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"}