@oxyhq/services 28.0.0 → 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.
Files changed (324) hide show
  1. package/NOTICE +10 -9
  2. package/README.md +65 -2
  3. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionModule.kt +178 -0
  4. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionProvider.kt +99 -0
  5. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionStore.kt +115 -0
  6. package/expo-module.config.json +1 -0
  7. package/lib/commonjs/index.js +60 -16
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/ui/boot/runProviderColdBoot.js +7 -0
  10. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  11. package/lib/commonjs/ui/client.js +12 -7
  12. package/lib/commonjs/ui/client.js.map +1 -1
  13. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +10 -27
  14. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
  15. package/lib/commonjs/ui/components/OxyAuthChooser.js +132 -44
  16. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  17. package/lib/commonjs/ui/components/OxyProvider.js +4 -2
  18. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  19. package/lib/commonjs/ui/components/SurfaceScreen.js +31 -3
  20. package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -1
  21. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +209 -84
  22. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  23. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +25 -7
  24. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -1
  25. package/lib/commonjs/ui/components/authChooser/primitives.js +35 -22
  26. package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -1
  27. package/lib/commonjs/ui/components/authChooser/types.js +11 -0
  28. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
  29. package/lib/commonjs/ui/context/OxyContext.js +257 -306
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +27 -37
  32. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  33. package/lib/commonjs/ui/context/oxyContextHelpers.js +0 -29
  34. package/lib/commonjs/ui/context/oxyContextHelpers.js.map +1 -1
  35. package/lib/commonjs/ui/context/useOxyAccountGraph.js +6 -17
  36. package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
  37. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js +42 -0
  38. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js.map +1 -0
  39. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +0 -19
  40. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  41. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js +57 -0
  42. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js.map +1 -0
  43. package/lib/commonjs/ui/hooks/useI18n.js +22 -3
  44. package/lib/commonjs/ui/hooks/useI18n.js.map +1 -1
  45. package/lib/commonjs/ui/hooks/useSessionManagement.js +46 -153
  46. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  47. package/lib/commonjs/ui/index.js +12 -7
  48. package/lib/commonjs/ui/index.js.map +1 -1
  49. package/lib/commonjs/ui/navigation/routes.js +85 -73
  50. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  51. package/lib/commonjs/ui/navigation/surfaces.js +8 -7
  52. package/lib/commonjs/ui/navigation/surfaces.js.map +1 -1
  53. package/lib/commonjs/ui/runtime/createOxyRuntime.js +433 -0
  54. package/lib/commonjs/ui/runtime/createOxyRuntime.js.map +1 -0
  55. package/lib/commonjs/ui/runtime/index.js +63 -0
  56. package/lib/commonjs/ui/runtime/index.js.map +1 -0
  57. package/lib/commonjs/ui/runtime/runtimeContext.js +83 -0
  58. package/lib/commonjs/ui/runtime/runtimeContext.js.map +1 -0
  59. package/lib/commonjs/ui/runtime/types.js +6 -0
  60. package/lib/commonjs/ui/runtime/types.js.map +1 -0
  61. package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js +57 -0
  62. package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js.map +1 -0
  63. package/lib/commonjs/ui/server.js +1 -2
  64. package/lib/commonjs/ui/server.js.map +1 -1
  65. package/lib/commonjs/ui/session/authStore.js +45 -9
  66. package/lib/commonjs/ui/session/authStore.js.map +1 -1
  67. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js +306 -0
  68. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js.map +1 -0
  69. package/lib/commonjs/ui/stores/authStore.js +154 -55
  70. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  71. package/lib/commonjs/ui/utils/avatarUtils.js +2 -36
  72. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  73. package/lib/module/index.js +16 -8
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/ui/boot/runProviderColdBoot.js +7 -0
  76. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  77. package/lib/module/ui/client.js +1 -2
  78. package/lib/module/ui/client.js.map +1 -1
  79. package/lib/module/ui/components/OxyAccountDialogScreen.js +10 -27
  80. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
  81. package/lib/module/ui/components/OxyAuthChooser.js +134 -44
  82. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  83. package/lib/module/ui/components/OxyProvider.js +5 -3
  84. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  85. package/lib/module/ui/components/SurfaceScreen.js +33 -5
  86. package/lib/module/ui/components/SurfaceScreen.js.map +1 -1
  87. package/lib/module/ui/components/authChooser/AccountsMenuView.js +210 -85
  88. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  89. package/lib/module/ui/components/authChooser/SignInEntryView.js +25 -7
  90. package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -1
  91. package/lib/module/ui/components/authChooser/primitives.js +35 -22
  92. package/lib/module/ui/components/authChooser/primitives.js.map +1 -1
  93. package/lib/module/ui/components/authChooser/types.js +11 -0
  94. package/lib/module/ui/components/authChooser/types.js.map +1 -1
  95. package/lib/module/ui/context/OxyContext.js +251 -303
  96. package/lib/module/ui/context/OxyContext.js.map +1 -1
  97. package/lib/module/ui/context/hooks/useAuthOperations.js +27 -37
  98. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  99. package/lib/module/ui/context/oxyContextHelpers.js +0 -28
  100. package/lib/module/ui/context/oxyContextHelpers.js.map +1 -1
  101. package/lib/module/ui/context/useOxyAccountGraph.js +6 -17
  102. package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
  103. package/lib/module/ui/hooks/accountDialogSnapshot.js +38 -0
  104. package/lib/module/ui/hooks/accountDialogSnapshot.js.map +1 -0
  105. package/lib/module/ui/hooks/mutations/useAccountMutations.js +0 -19
  106. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  107. package/lib/module/ui/hooks/useDeviceSwitcher.js +53 -0
  108. package/lib/module/ui/hooks/useDeviceSwitcher.js.map +1 -0
  109. package/lib/module/ui/hooks/useI18n.js +24 -4
  110. package/lib/module/ui/hooks/useI18n.js.map +1 -1
  111. package/lib/module/ui/hooks/useSessionManagement.js +47 -155
  112. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  113. package/lib/module/ui/index.js +1 -2
  114. package/lib/module/ui/index.js.map +1 -1
  115. package/lib/module/ui/navigation/routes.js +84 -72
  116. package/lib/module/ui/navigation/routes.js.map +1 -1
  117. package/lib/module/ui/navigation/surfaces.js +6 -6
  118. package/lib/module/ui/navigation/surfaces.js.map +1 -1
  119. package/lib/module/ui/runtime/createOxyRuntime.js +430 -0
  120. package/lib/module/ui/runtime/createOxyRuntime.js.map +1 -0
  121. package/lib/module/ui/runtime/index.js +15 -0
  122. package/lib/module/ui/runtime/index.js.map +1 -0
  123. package/lib/module/ui/runtime/runtimeContext.js +75 -0
  124. package/lib/module/ui/runtime/runtimeContext.js.map +1 -0
  125. package/lib/module/ui/runtime/types.js +4 -0
  126. package/lib/module/ui/runtime/types.js.map +1 -0
  127. package/lib/module/ui/runtime/useRuntimeSnapshot.js +52 -0
  128. package/lib/module/ui/runtime/useRuntimeSnapshot.js.map +1 -0
  129. package/lib/module/ui/server.js +0 -1
  130. package/lib/module/ui/server.js.map +1 -1
  131. package/lib/module/ui/session/authStore.js +46 -11
  132. package/lib/module/ui/session/authStore.js.map +1 -1
  133. package/lib/module/ui/session/sharedDeviceCredentialStore.js +302 -0
  134. package/lib/module/ui/session/sharedDeviceCredentialStore.js.map +1 -0
  135. package/lib/module/ui/stores/authStore.js +154 -55
  136. package/lib/module/ui/stores/authStore.js.map +1 -1
  137. package/lib/module/ui/utils/avatarUtils.js +2 -35
  138. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  139. package/lib/typescript/commonjs/index.d.ts +5 -3
  140. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/ui/client.d.ts +1 -2
  143. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
  149. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +3 -1
  151. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +18 -6
  153. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +33 -1
  155. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
  156. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +35 -4
  157. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  158. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +8 -12
  159. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  160. package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts +0 -2
  161. package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts.map +1 -1
  162. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +9 -1
  163. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  164. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +1 -3
  165. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  166. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts +15 -0
  167. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts +49 -0
  170. package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts +13 -0
  172. package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts +23 -18
  174. package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/ui/index.d.ts +1 -2
  176. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +15 -1
  178. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts +144 -0
  181. package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/ui/runtime/index.d.ts +16 -0
  183. package/lib/typescript/commonjs/ui/runtime/index.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts +43 -0
  185. package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/ui/runtime/types.d.ts +89 -0
  187. package/lib/typescript/commonjs/ui/runtime/types.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
  189. package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/ui/server.d.ts +0 -1
  191. package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/ui/session/authStore.d.ts +60 -9
  193. package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
  194. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
  195. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/ui/stores/authStore.d.ts +49 -5
  197. package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
  198. package/lib/typescript/commonjs/ui/types/navigation.d.ts +26 -0
  199. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts +2 -10
  201. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
  202. package/lib/typescript/module/index.d.ts +5 -3
  203. package/lib/typescript/module/index.d.ts.map +1 -1
  204. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  205. package/lib/typescript/module/ui/client.d.ts +1 -2
  206. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  207. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  208. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  209. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  210. package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -1
  211. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
  212. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  213. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +3 -1
  214. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
  215. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +18 -6
  216. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -1
  217. package/lib/typescript/module/ui/components/authChooser/types.d.ts +33 -1
  218. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
  219. package/lib/typescript/module/ui/context/OxyContext.d.ts +35 -4
  220. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  221. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +8 -12
  222. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  223. package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts +0 -2
  224. package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts.map +1 -1
  225. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +9 -1
  226. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  227. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +1 -3
  228. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  229. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts +15 -0
  230. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
  231. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  232. package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts +49 -0
  233. package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
  234. package/lib/typescript/module/ui/hooks/useI18n.d.ts +13 -0
  235. package/lib/typescript/module/ui/hooks/useI18n.d.ts.map +1 -1
  236. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +23 -18
  237. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
  238. package/lib/typescript/module/ui/index.d.ts +1 -2
  239. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  240. package/lib/typescript/module/ui/navigation/routes.d.ts +15 -1
  241. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  242. package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -1
  243. package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts +144 -0
  244. package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts.map +1 -0
  245. package/lib/typescript/module/ui/runtime/index.d.ts +16 -0
  246. package/lib/typescript/module/ui/runtime/index.d.ts.map +1 -0
  247. package/lib/typescript/module/ui/runtime/runtimeContext.d.ts +43 -0
  248. package/lib/typescript/module/ui/runtime/runtimeContext.d.ts.map +1 -0
  249. package/lib/typescript/module/ui/runtime/types.d.ts +89 -0
  250. package/lib/typescript/module/ui/runtime/types.d.ts.map +1 -0
  251. package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
  252. package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
  253. package/lib/typescript/module/ui/server.d.ts +0 -1
  254. package/lib/typescript/module/ui/server.d.ts.map +1 -1
  255. package/lib/typescript/module/ui/session/authStore.d.ts +60 -9
  256. package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
  257. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
  258. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
  259. package/lib/typescript/module/ui/stores/authStore.d.ts +49 -5
  260. package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
  261. package/lib/typescript/module/ui/types/navigation.d.ts +26 -0
  262. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  263. package/lib/typescript/module/ui/utils/avatarUtils.d.ts +2 -10
  264. package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
  265. package/package.json +6 -7
  266. package/plugins/withSharedDeviceSessionProvider.js +102 -0
  267. package/plugins/withSharedDeviceSessionReader.js +57 -0
  268. package/src/__tests__/esmSourcePurity.test.ts +61 -0
  269. package/src/index.ts +31 -9
  270. package/src/ui/boot/runProviderColdBoot.ts +7 -0
  271. package/src/ui/client.ts +1 -2
  272. package/src/ui/components/OxyAccountDialogScreen.tsx +10 -29
  273. package/src/ui/components/OxyAuthChooser.tsx +149 -50
  274. package/src/ui/components/OxyProvider.tsx +7 -5
  275. package/src/ui/components/SurfaceScreen.tsx +28 -4
  276. package/src/ui/components/authChooser/AccountsMenuView.tsx +246 -96
  277. package/src/ui/components/authChooser/SignInEntryView.tsx +31 -8
  278. package/src/ui/components/authChooser/primitives.tsx +37 -23
  279. package/src/ui/components/authChooser/types.ts +34 -1
  280. package/src/ui/context/OxyContext.tsx +269 -324
  281. package/src/ui/context/hooks/useAuthOperations.ts +32 -35
  282. package/src/ui/context/oxyContextHelpers.ts +0 -30
  283. package/src/ui/context/oxyContextTypes.ts +9 -1
  284. package/src/ui/context/useOxyAccountGraph.ts +5 -19
  285. package/src/ui/hooks/accountDialogSnapshot.ts +37 -0
  286. package/src/ui/hooks/mutations/useAccountMutations.ts +0 -19
  287. package/src/ui/hooks/queries/__tests__/userCache.test.ts +12 -1
  288. package/src/ui/hooks/useDeviceSwitcher.ts +110 -0
  289. package/src/ui/hooks/useI18n.ts +23 -3
  290. package/src/ui/hooks/useSessionManagement.ts +62 -211
  291. package/src/ui/index.ts +1 -2
  292. package/src/ui/navigation/routes.ts +85 -75
  293. package/src/ui/navigation/surfaces.ts +6 -9
  294. package/src/ui/runtime/createOxyRuntime.ts +623 -0
  295. package/src/ui/runtime/index.ts +34 -0
  296. package/src/ui/runtime/runtimeContext.tsx +111 -0
  297. package/src/ui/runtime/types.ts +110 -0
  298. package/src/ui/runtime/useRuntimeSnapshot.ts +52 -0
  299. package/src/ui/server.ts +0 -1
  300. package/src/ui/session/__tests__/authStore.test.ts +90 -0
  301. package/src/ui/session/__tests__/sharedDeviceCredentialStore.test.ts +289 -0
  302. package/src/ui/session/authStore.ts +78 -9
  303. package/src/ui/session/sharedDeviceCredentialStore.ts +318 -0
  304. package/src/ui/stores/authStore.ts +171 -43
  305. package/src/ui/types/navigation.ts +26 -0
  306. package/src/ui/utils/avatarUtils.ts +2 -37
  307. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +0 -64
  308. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +0 -1
  309. package/lib/commonjs/ui/stores/accountStore.js +0 -221
  310. package/lib/commonjs/ui/stores/accountStore.js.map +0 -1
  311. package/lib/module/ui/hooks/useSwitchableAccounts.js +0 -60
  312. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +0 -1
  313. package/lib/module/ui/stores/accountStore.js +0 -213
  314. package/lib/module/ui/stores/accountStore.js.map +0 -1
  315. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +0 -23
  316. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
  317. package/lib/typescript/commonjs/ui/stores/accountStore.d.ts +0 -27
  318. package/lib/typescript/commonjs/ui/stores/accountStore.d.ts.map +0 -1
  319. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +0 -23
  320. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
  321. package/lib/typescript/module/ui/stores/accountStore.d.ts +0 -27
  322. package/lib/typescript/module/ui/stores/accountStore.d.ts.map +0 -1
  323. package/src/ui/hooks/useSwitchableAccounts.ts +0 -75
  324. package/src/ui/stores/accountStore.ts +0 -264
@@ -0,0 +1,49 @@
1
+ import { type DeviceContext, type SwitcherPrincipalRow } from '@oxyhq/core';
2
+ export interface UseDeviceSwitcherResult {
3
+ /**
4
+ * Everyone signed in on this device, each with the accounts they may act as,
5
+ * with names, handles and avatar URLs already resolved.
6
+ *
7
+ * Grouped by PERSON, which is the whole point: the same organization
8
+ * reachable through two people is two rows under two humans. The flat list
9
+ * this replaced was keyed by account id and could show only one of them.
10
+ */
11
+ principals: SwitcherPrincipalRow[];
12
+ /** The active `principal acting as account` pair, or `null`. */
13
+ activeContext: DeviceContext | null;
14
+ /** True until the first directory read settles with nothing to show. */
15
+ isLoading: boolean;
16
+ /** The `contextId` of an activation in flight, or `null`. */
17
+ activatingContextId: string | null;
18
+ /** The `contextId` of a context removal in flight, or `null`. */
19
+ removingContextId: string | null;
20
+ /** The `principalId` of a principal removal in flight, or `null`. */
21
+ removingPrincipalId: string | null;
22
+ /**
23
+ * Make one pair active. Resolves `false` when it was refused — the reason is
24
+ * on the dialog controller's `error`, and the row is simply not offered
25
+ * again after the refresh that follows.
26
+ */
27
+ activateContext: (contextId: string) => Promise<boolean>;
28
+ /** Drop ONE `principal → account` pair, leaving anyone else's route intact. */
29
+ signOutContext: (contextId: string) => Promise<boolean>;
30
+ /** Drop ONE PERSON and every context they reach, and nobody else's. */
31
+ signOutPrincipal: (principalId: string) => Promise<boolean>;
32
+ }
33
+ /**
34
+ * The device switcher, straight from `GET /session/device/directory` (ADR 0002).
35
+ *
36
+ * A thin binding over the shared `AccountDialogController` in `@oxyhq/core` —
37
+ * the SAME headless source `OxyAccountDialogScreen` renders — so the SDK's own
38
+ * dialog and the `auth.oxy.so` chooser show one list, built once, on the server.
39
+ *
40
+ * It used to hand back a flat `SwitchableAccount[]` assembled here from
41
+ * `listAccounts()` + `getUsersByIds()` unioned with the device's session set.
42
+ * That union was not merely redundant: the client holds ONE caller's account
43
+ * graph, so on a device holding two people it presented one person's answer as
44
+ * the device's, and switchability — an authorization question — was decided
45
+ * client-side. Both are the server's answers now, and selecting a row activates
46
+ * a `contextId`, never an `accountId`.
47
+ */
48
+ export declare function useDeviceSwitcher(): UseDeviceSwitcherResult;
49
+ //# sourceMappingURL=useDeviceSwitcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeviceSwitcher.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useDeviceSwitcher.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,uBAAuB;IACpC;;;;;;;OAOG;IACH,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,gEAAgE;IAChE,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,qEAAqE;IACrE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC;;;;OAIG;IACH,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,+EAA+E;IAC/E,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,uEAAuE;IACvE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CAmD3D"}
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Display copy for SDK surfaces.
3
+ *
4
+ * This is the ONE hook that reads the runtime optionally. The locale is display
5
+ * metadata, not session state — ADR 0004 lists it among the things that come off
6
+ * the central value entirely — and purely presentational surfaces
7
+ * (`OxyConsentScreen`, `OxySignInRequestSurface`) are rendered outside a
8
+ * provider on purpose: `packages/auth`'s production-bundle probe builds the real
9
+ * Vite bundle and renders the surface standalone to prove every element beneath
10
+ * it links. Throwing there would report a linkage failure that is not one.
11
+ *
12
+ * Anything that reads or mutates session state uses `useOxy()`, which throws.
13
+ */
1
14
  export declare function useI18n(): {
2
15
  t: (key: string, vars?: Record<string, string | number>) => string;
3
16
  locale: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useI18n.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO;aAGN,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;;EAG9D"}
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useI18n.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO;aAIN,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;;EAG9D"}
@@ -1,41 +1,46 @@
1
1
  import { type ApiError, type User } from '@oxyhq/core';
2
- import type { ClientSession } from '@oxyhq/core';
3
2
  import { getStorageKeys, type StorageInterface } from '../utils/storageHelpers';
4
3
  import type { OxyServices } from '@oxyhq/core';
5
4
  import type { QueryClient } from '@tanstack/react-query';
5
+ import type { OxyRuntime } from '../runtime';
6
6
  export interface UseSessionManagementOptions {
7
7
  oxyServices: OxyServices;
8
+ /** The one owner of `sessions` / `activeSessionId` / the signed-in account. */
9
+ runtime: OxyRuntime;
8
10
  storage: StorageInterface | null;
9
11
  storageKeyPrefix?: string;
10
- loginSuccess: (user: User) => void;
11
- logoutStore: () => void;
12
12
  onAuthStateChange?: (user: User | null) => void;
13
13
  onError?: (error: ApiError) => void;
14
14
  setAuthError?: (message: string | null) => void;
15
15
  logger?: (message: string, error?: unknown) => void;
16
- setTokenReady?: (ready: boolean) => void;
17
16
  queryClient?: QueryClient | null;
18
17
  }
19
18
  export interface UseSessionManagementResult {
20
- sessions: ClientSession[];
21
- activeSessionId: string | null;
22
- setActiveSessionId: (sessionId: string | null) => void;
23
- updateSessions: (incoming: ClientSession[], options?: {
24
- merge?: boolean;
25
- preserveSessionIds?: string[];
26
- }) => void;
19
+ /** Persist the projected session-id list. Handed to the runtime as its projection sink. */
20
+ saveSessionIds: (sessionIds: string[]) => void;
21
+ saveActiveSessionId: (sessionId: string) => Promise<void>;
22
+ /**
23
+ * The legacy `validateSession`-keyed switch. Reachable from exactly ONE
24
+ * caller: `performSignIn`'s same-user duplicate-session dedup. The switch a
25
+ * consumer sees on the context is the `SessionClient` one in `OxyContext`.
26
+ */
27
27
  switchSession: (sessionId: string) => Promise<User>;
28
- refreshSessions: (activeUserId?: string) => Promise<void>;
28
+ /** Tear down the local session: runtime projection, caches, storage, tokens. */
29
29
  clearSessionState: () => Promise<void>;
30
- saveActiveSessionId: (sessionId: string) => Promise<void>;
31
- trackRemovedSession: (sessionId: string) => void;
32
30
  storageKeys: ReturnType<typeof getStorageKeys>;
33
- isRefreshInFlight: boolean;
34
31
  }
35
32
  /**
36
- * Manage session state, persistence, and high-level multi-session operations.
33
+ * Session persistence and the one legacy switch left, over the runtime.
34
+ *
35
+ * This hook used to hold its OWN `sessions` / `activeSessionId` React state
36
+ * plus six refs mirroring them so its callbacks could avoid widening their
37
+ * dependency arrays. That made it a second owner of facts `SessionClient`
38
+ * already had, reconciled only by whichever `useEffect` ran last. Both are gone:
39
+ * the runtime owns them, this hook writes through it, and the refs mirrored
40
+ * nothing once there was nothing local to mirror.
37
41
  *
38
- * @param options - Session management configuration
42
+ * `refreshSessions`, `trackRemovedSession` and `isRefreshInFlight` are deleted
43
+ * outright — every one of them was dropped unread at the single call site.
39
44
  */
40
- export declare const useSessionManagement: ({ oxyServices, storage, storageKeyPrefix, loginSuccess, logoutStore, onAuthStateChange, onError, setAuthError, logger, setTokenReady, queryClient, }: UseSessionManagementOptions) => UseSessionManagementResult;
45
+ export declare const useSessionManagement: ({ oxyServices, runtime, storage, storageKeyPrefix, onAuthStateChange, onError, setAuthError, logger, queryClient, }: UseSessionManagementOptions) => UseSessionManagementResult;
41
46
  //# sourceMappingURL=useSessionManagement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSessionManagement.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useSessionManagement.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKzD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GA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CAAC,CAAC;IACvC,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;CAChD;AAKD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAAI,qHAUlC,2BAA2B,KAAG,0BAgKhC,CAAC"}
@@ -22,7 +22,7 @@ export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './components/Req
22
22
  export { default as FollowButton } from './components/FollowButton';
23
23
  export { default as OxyPayButton } from './components/OxyPayButton';
24
24
  export { default as ProfileButton } from './components/ProfileButton';
25
- export { useOxy } from './context/OxyContext';
25
+ export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyContext';
26
26
  export { useAuth } from './hooks/useAuth';
27
27
  export { useFollow, useSeedFollowStatuses } from './hooks/useFollow';
28
28
  export { useStorage } from './hooks/useStorage';
@@ -33,7 +33,6 @@ export { default as CreateAccountScreen } from './screens/CreateAccountScreen';
33
33
  export { default as AccountMembersScreen } from './screens/AccountMembersScreen';
34
34
  export { default as AccountSettingsScreen } from './screens/AccountSettingsScreen';
35
35
  export { useAuthStore } from './stores/authStore';
36
- export { useAccountStore } from './stores/accountStore';
37
36
  export { handleAuthError, isInvalidSessionError, isTimeoutOrNetworkError, extractErrorMessage, } from './utils/errorHandlers';
38
37
  export type { HandleAuthErrorOptions } from './utils/errorHandlers';
39
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,QAAQ,E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AO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,6 +1,20 @@
1
- import type { ComponentType } from 'react';
1
+ import { type ComponentType } from 'react';
2
2
  import type { BaseScreenProps } from '../types/navigation';
3
3
  export type RouteName = 'ManageAccount' | 'AccountVerification' | 'PaymentGateway' | 'Profile' | 'LanguageSelector' | 'PrivacySettings' | 'SearchSettings' | 'FileManagement' | 'HelpSupport' | 'FAQ' | 'Feedback' | 'LegalDocuments' | 'AppInfo' | 'PremiumSubscription' | 'WelcomeNewUser' | 'UserLinks' | 'HistoryView' | 'SavesCollections' | 'EditProfile' | 'EditProfileField' | 'LearnMoreUsernames' | 'TrustCenter' | 'TrustLeaderboard' | 'TrustRewards' | 'TrustRules' | 'AboutTrust' | 'TrustFAQ' | 'FollowersList' | 'FollowingList' | 'CreateAccount' | 'AccountMembers' | 'AccountSettings' | 'ChangeAvatar' | 'AvatarCrop' | 'Notifications' | 'ConnectedApps' | 'Preferences' | 'AccountDialog';
4
+ /**
5
+ * Resolve the component for a route.
6
+ *
7
+ * The map is total over {@link RouteName} — the compiler enforces that at its
8
+ * declaration — so this returns `undefined` only for a caller that reached here
9
+ * with an unchecked string; {@link isValidRoute} is how such a caller narrows.
10
+ *
11
+ * The surface host renders the result with {@link BaseScreenProps} merged with
12
+ * the route's own props bag, so that is the type it is handed back as. This one
13
+ * widening is where the gap documented on {@link screenComponents} lives: the map
14
+ * dispatches on a string key, so a screen's extra prop requirements are met at
15
+ * `present(route, props)` call sites, not provable here. No caching is needed —
16
+ * React memoizes each `lazy()` component's module after its first load.
17
+ */
4
18
  export declare const getScreenComponent: (routeName: RouteName) => ComponentType<BaseScreenProps> | undefined;
5
19
  export declare const isValidRoute: (routeName: string) => routeName is RouteName;
6
20
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAO3D,MAAM,MAAM,SAAS,GACf,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,SAAS,GACT,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,KAAK,GACL,UAAU,GACV,gBAAgB,GAChB,SAAS,GACT,qBAAqB,GACrB,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,eAAe,GACf,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,YAAY,GACZ,eAAe,GACf,eAAe,GACf,aAAa,GACb,eAAe,CAAC;AAuDtB,eAAO,MAAM,kBAAkB,GAAI,WAAW,SAAS,KAAG,aAAa,CAAC,eAAe,CAAC,GAAG,SAsB1F,CAAC;AAIF,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,KAAG,SAAS,IAAI,SAE7D,CAAC"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,MAAM,SAAS,GACf,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,SAAS,GACT,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,KAAK,GACL,UAAU,GACV,gBAAgB,GAChB,SAAS,GACT,qBAAqB,GACrB,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,eAAe,GACf,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,YAAY,GACZ,eAAe,GACf,eAAe,GACf,aAAa,GACb,eAAe,CAAC;AA4EtB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,SAAS,KAAG,aAAa,CAAC,eAAe,CAAC,GAAG,SAC1B,CAAC;AAIlE,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,KAAG,SAAS,IAAI,SAE7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/surfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA6EhF;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,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ED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,SAAS,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAON;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,SAAS,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EACrD,KAAK,EAAE,CAAC,EACR,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAUvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;uBACT,CAAC,SAAS,SAAS,SAAS,CAAC,UAAU,YAAY,CAAC,CAAC,CAAC,SAAS,cAAc;;CAG/E,CAAC;AAEX,wDAAwD;AACxD,wBAAgB,WAAW,IAAI,OAAO,QAAQ,CAE7C"}
@@ -0,0 +1,144 @@
1
+ import type { DeviceDirectory, DeviceSessionState } from '@oxyhq/contracts';
2
+ import type { ClientSession, User } from '@oxyhq/core';
3
+ import type { IdentitySessionBinding } from '../session/identityBinding';
4
+ import type { OxyRuntimeSnapshot } from './types';
5
+ /**
6
+ * A change of SUBJECT — the account the session acts as.
7
+ *
8
+ * `previous === null` is an initial sign-in (nothing account-scoped is cached
9
+ * yet); `next === null` is a sign-out; both non-null and different is a switch,
10
+ * the only case that must invalidate a warm cache.
11
+ */
12
+ export interface SubjectTransition {
13
+ previous: string | null;
14
+ next: string | null;
15
+ }
16
+ /**
17
+ * The three seams the runtime reads, declared STRUCTURALLY rather than as the
18
+ * concrete `OxyServices` / `SessionClient` / `SessionClientHost` types.
19
+ *
20
+ * The real classes satisfy them, so nothing changes at the call site — but a
21
+ * test can hand the runtime three plain objects instead of casting a stub
22
+ * through `unknown`, which is how a stub silently drifts from the interface it
23
+ * pretends to implement.
24
+ */
25
+ export interface RuntimeClient {
26
+ getAccessToken(): string | null;
27
+ getUsersByIds(ids: string[]): Promise<User[]>;
28
+ }
29
+ export interface RuntimeSessionClient {
30
+ getState(): DeviceSessionState | null;
31
+ getDirectory(): DeviceDirectory | null;
32
+ subscribe(listener: (state: DeviceSessionState | null) => void): () => void;
33
+ refreshDirectory(): Promise<void>;
34
+ activateContext(contextId: string): Promise<void>;
35
+ signOutContext(contextId: string): Promise<void>;
36
+ signOutPrincipal(principalId: string): Promise<void>;
37
+ }
38
+ export interface RuntimeSessionHost {
39
+ setCurrentAccountId(accountId: string | null): void;
40
+ }
41
+ export interface OxyRuntimeConfig {
42
+ oxyServices: RuntimeClient;
43
+ sessionClient: RuntimeSessionClient;
44
+ sessionClientHost: RuntimeSessionHost;
45
+ /** `null` for every account-mode runtime; the pin binding in identity mode. */
46
+ identity: IdentitySessionBinding | null;
47
+ /**
48
+ * Reset account-scoped caches. Called BETWEEN the bearer commit and the
49
+ * snapshot publish, which is the whole point of routing every fact change
50
+ * through one transition (ADR 0002's ordering invariant): a consumer woken by
51
+ * a switch must never read a cache entry belonging to the previous subject.
52
+ */
53
+ onSubjectChange?: (transition: SubjectTransition) => void;
54
+ /**
55
+ * The device reports zero accounts. Local UI teardown only — the durable
56
+ * device credential is the caller's decision, gated on a `request`-origin
57
+ * verdict.
58
+ */
59
+ onDeviceEmpty: () => Promise<void>;
60
+ /** Persist the projected session-id list (display/bookkeeping storage). */
61
+ onSessionsProjected?: (sessionIds: string[]) => void;
62
+ /**
63
+ * Identity mode only: the pinned account is unknown or has left this device's
64
+ * session set, so the session must be re-derived from the local identity key.
65
+ * Projecting anything here would mean projecting somebody else's account.
66
+ */
67
+ onIdentityUnbound?: (binding: IdentitySessionBinding, revision: number) => void;
68
+ logger: (message: string, error?: unknown) => void;
69
+ }
70
+ /**
71
+ * The headless session runtime (ADR 0004).
72
+ *
73
+ * It owns the session facts and the ORDER in which they become visible. React
74
+ * is an adapter: the provider hands components this object and they subscribe
75
+ * with selectors, so an unrelated change (a locale, a dialog opening) cannot
76
+ * rebuild an auth consumer's view.
77
+ */
78
+ export interface OxyRuntime {
79
+ getSnapshot(): OxyRuntimeSnapshot;
80
+ subscribe(listener: () => void): () => void;
81
+ /** Begin projecting `SessionClient` transitions. Returns the disposer. */
82
+ start(): () => void;
83
+ /**
84
+ * Project the client's current device state onto the snapshot. Idempotent and
85
+ * revision-guarded: a projection whose profile fetch was overtaken by a
86
+ * fresher state discards itself rather than publishing a stale subject.
87
+ */
88
+ reconcileFromClient(): Promise<void>;
89
+ /** Read the device directory and publish it (opts this runtime into ADR 0002). */
90
+ refreshDirectory(): Promise<void>;
91
+ /**
92
+ * Make one `principal acting as account` context active (ADR 0002).
93
+ *
94
+ * `contextId`, never an account id: on a device holding two people the same
95
+ * organization is reachable through both, and an account id cannot name which
96
+ * route to take.
97
+ */
98
+ activateContext(contextId: string): Promise<void>;
99
+ /**
100
+ * Remove ONE `principal → account` pair. The same account reached through a
101
+ * second person is a different session with a different audit actor, and it
102
+ * stays.
103
+ *
104
+ * Context ids are NOT stable across a removal: the server offers the pair
105
+ * again under a NEW id on the next directory read, so nothing may cache one
106
+ * across this call.
107
+ */
108
+ signOutContext(contextId: string): Promise<void>;
109
+ /** Remove ONE PERSON and every context they reach, and nobody else's. */
110
+ signOutPrincipal(principalId: string): Promise<void>;
111
+ /**
112
+ * Run several fact changes as ONE transition.
113
+ *
114
+ * A session commit sets the optimistic session mirror, the active session id
115
+ * and the account. Left as three transitions those are three publishes, and
116
+ * — worse — the account is compared against a different baseline each time,
117
+ * so an account-scoped cache reset could run against a half-applied session.
118
+ * Batched, subscribers are woken once, after all of it, with the reset having
119
+ * run exactly once in between.
120
+ */
121
+ batch(mutate: () => void): void;
122
+ setAccount(user: User): void;
123
+ setLoading(loading: boolean): void;
124
+ setError(error: string | null): void;
125
+ setStorageReady(ready: boolean): void;
126
+ setTokenReady(ready: boolean): void;
127
+ setHasAccessToken(has: boolean): void;
128
+ setSwitching(switching: boolean): void;
129
+ markAuthResolved(): void;
130
+ /**
131
+ * Merge an optimistic local session mirror so the UI moves before the server
132
+ * round-trip. The authoritative projection overwrites it a moment later; both
133
+ * write the SAME field, so there is still exactly one owner.
134
+ */
135
+ mergeSessions(incoming: ClientSession[], options?: {
136
+ merge?: boolean;
137
+ preserveSessionIds?: string[];
138
+ }): void;
139
+ setActiveSessionId(sessionId: string | null): void;
140
+ /** Local teardown: drop the session projection without touching the server. */
141
+ clearSession(): void;
142
+ }
143
+ export declare function createOxyRuntime(config: OxyRuntimeConfig): OxyRuntime;
144
+ //# sourceMappingURL=createOxyRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOxyRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/createOxyRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAYtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAoC,MAAM,SAAS,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,IAAI,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,IAAI,kBAAkB,GA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I,CAAC;IAC7G,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAEnD,+EAA+E;IAC/E,YAAY,IAAI,IAAI,CAAC;CACtB;AA2DD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAyYrE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The headless session runtime (ADR 0004).
3
+ *
4
+ * `createOxyRuntime` owns the session facts and the order in which they become
5
+ * visible; `useRuntimeSnapshot` / `useRuntimeSelector` are the React adapter
6
+ * over it. Nothing here imports React except the adapter, and nothing in the
7
+ * runtime reads React state — which is what lets the provider hold ONE stable
8
+ * reference and stop rebuilding a 58-field context value on every keystroke.
9
+ */
10
+ export { createOxyRuntime } from './createOxyRuntime';
11
+ export type { OxyRuntime, OxyRuntimeConfig, RuntimeClient, RuntimeSessionClient, RuntimeSessionHost, SubjectTransition, } from './createOxyRuntime';
12
+ export { useRuntimeSnapshot, useRuntimeSelector } from './useRuntimeSnapshot';
13
+ export { OxyRuntimeHandleProvider, OxyRuntimeMissingError, useActiveAccount, useDeviceDirectory, useOxyRuntime, useOxySnapshot, } from './runtimeContext';
14
+ export type { ActiveAccount } from './runtimeContext';
15
+ export type { OxyRuntimeError, OxyRuntimeSnapshot, OxyRuntimeStatus, OxyTokenStatus, } from './types';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { DeviceDirectory } from '@oxyhq/contracts';
2
+ import type { DeviceContext, User } from '@oxyhq/core';
3
+ import type { OxyRuntime } from './createOxyRuntime';
4
+ import type { OxyRuntimeStatus } from './types';
5
+ export declare const OxyRuntimeHandleProvider: import("react").Provider<OxyRuntime | null>;
6
+ export declare class OxyRuntimeMissingError extends Error {
7
+ readonly code = "oxy_runtime_missing";
8
+ constructor();
9
+ }
10
+ /** The runtime this provider owns. THROWS when no `<OxyProvider>` is mounted. */
11
+ export declare function useOxyRuntime(): OxyRuntime;
12
+ export interface ActiveAccount {
13
+ /**
14
+ * The human whose authentication backs the session — the audit actor. Equal
15
+ * to {@link ActiveAccount.account} unless a delegated context is active.
16
+ */
17
+ principal: User | null;
18
+ /** The account the session acts AS — what a profile header renders. */
19
+ account: User | null;
20
+ /** The resolved `principal acting as account` pair, when a directory is held. */
21
+ context: DeviceContext | null;
22
+ /** Whether the actor and the subject are different accounts. */
23
+ isDelegated: boolean;
24
+ status: OxyRuntimeStatus;
25
+ }
26
+ /**
27
+ * Who this app is running as, with the actor and the subject kept apart.
28
+ *
29
+ * Unlike `useOxy()`, this re-renders only when one of those five facts moves —
30
+ * a locale change, a dialog opening or a session-list refresh does not reach it.
31
+ */
32
+ export declare function useActiveAccount(): ActiveAccount;
33
+ /**
34
+ * The device directory — every principal on this device and the contexts each
35
+ * may act as (ADR 0002).
36
+ *
37
+ * `null` until something calls `runtime.refreshDirectory()`. A client that
38
+ * never asks for one never pays for the round trip.
39
+ */
40
+ export declare function useDeviceDirectory(): DeviceDirectory | null;
41
+ /** The whole runtime snapshot. Prefer a narrower hook where one exists. */
42
+ export declare function useOxySnapshot(): ReturnType<OxyRuntime['getSnapshot']>;
43
+ //# sourceMappingURL=runtimeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeContext.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/runtimeContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgBhD,eAAO,MAAM,wBAAwB,6CAAmC,CAAC;AAKzE,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,yBAAyB;;CAMvC;AAED,iFAAiF;AACjF,wBAAgB,aAAa,IAAI,UAAU,CAM1C;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,uEAAuE;IACvE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,iFAAiF;IACjF,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,gEAAgE;IAChE,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AA2BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAE3D;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,IAAI,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAEtE"}
@@ -0,0 +1,89 @@
1
+ import type { DeviceDirectory, DeviceSessionState } from '@oxyhq/contracts';
2
+ import type { ClientSession, DeviceContext, User } from '@oxyhq/core';
3
+ /**
4
+ * The runtime's coarse verdict about this device's session.
5
+ *
6
+ * `'booting'` is NOT "signed out but we are still looking": it is the honest
7
+ * "undetermined" that every readiness gate in the SDK exists to express, and it
8
+ * ends exactly once at the first cold-boot resolution. `'error'` is reserved for
9
+ * a resolved boot that produced no account AND recorded a failure — a failed
10
+ * sign-in against a signed-out device is `'signed_out'` with an `error`, because
11
+ * the device really is signed out.
12
+ */
13
+ export type OxyRuntimeStatus = 'booting' | 'authenticated' | 'signed_out' | 'error';
14
+ /**
15
+ * Whether a bearer usable for private calls is planted right now.
16
+ *
17
+ * `'refreshing'` covers both halves of the gap the SDK already tracked with two
18
+ * separate booleans: a bearer that is present but whose readiness gate is shut
19
+ * (a commit in flight), and an authenticated account whose bearer has been
20
+ * invalidated and is being re-minted. Both mean the same thing to a caller —
21
+ * wait, do not treat this as signed out.
22
+ */
23
+ export type OxyTokenStatus = 'missing' | 'refreshing' | 'ready' | 'error';
24
+ export interface OxyRuntimeError {
25
+ message: string;
26
+ code: string;
27
+ }
28
+ /**
29
+ * The ONE observable state of an `OxyRuntime` (ADR 0004).
30
+ *
31
+ * Frozen and referentially stable: a new object is published only when
32
+ * something actually changed, so `useSyncExternalStore` can compare by identity
33
+ * and a selector over an unchanged field never re-renders.
34
+ *
35
+ * Every field is either a fact the runtime owns or a pure derivation of one.
36
+ * There is no second writable store: `sessions`, `activeSessionId`, `status`
37
+ * and `tokenStatus` are computed by the one snapshot builder, so two of them can
38
+ * never disagree about the same device.
39
+ */
40
+ export interface OxyRuntimeSnapshot {
41
+ status: OxyRuntimeStatus;
42
+ /**
43
+ * The device DIRECTORY (ADR 0002) — principals and the contexts each may act
44
+ * as. `null` until something asks for one; the flat lane never pays for it.
45
+ */
46
+ device: DeviceDirectory | null;
47
+ /**
48
+ * The flat, server-authoritative device state. Kept beside {@link device}
49
+ * because it is what the compatibility projections below are derived from,
50
+ * and because the two describe the same device at the same `revision`.
51
+ */
52
+ deviceState: DeviceSessionState | null;
53
+ /** The active `principal acting as account` pair, when a directory is held. */
54
+ activeContext: DeviceContext | null;
55
+ /**
56
+ * The human whose authentication backs the session — the audit actor.
57
+ *
58
+ * Equal to {@link account} on a device with no directory and on any
59
+ * non-delegated context: the flat lane cannot tell the two apart, and saying
60
+ * so by making them the same object is more honest than leaving this `null`.
61
+ */
62
+ principal: User | null;
63
+ /** The account the session acts AS — what a profile header renders. */
64
+ account: User | null;
65
+ tokenStatus: OxyTokenStatus;
66
+ /**
67
+ * Whether the first cold boot has concluded. Monotonic: once `true` it never
68
+ * reverts, so a later transient signed-out state is never mistaken for
69
+ * "still booting".
70
+ */
71
+ authResolved: boolean;
72
+ /** A context activation / account switch is in flight. */
73
+ switching: boolean;
74
+ error: OxyRuntimeError | null;
75
+ sessions: ClientSession[];
76
+ activeSessionId: string | null;
77
+ /** A sign-in / sign-out operation is in flight. */
78
+ isLoading: boolean;
79
+ /** The local display/bookkeeping storage has resolved. */
80
+ storageReady: boolean;
81
+ /** A bearer is planted on the client instance right now. */
82
+ hasAccessToken: boolean;
83
+ /**
84
+ * The commit gate. Shut while a session commit is mid-flight so a consumer
85
+ * cannot fire a private call between the token landing and the projection.
86
+ */
87
+ tokenReady: boolean;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,GAAG,YAAY,GAAG,OAAO,CAAC;AAEpF;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEvC,+EAA+E;IAC/E,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB,uEAAuE;IACvE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IAErB,WAAW,EAAE,cAAc,CAAC;IAE5B;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IAEnB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAM9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IAEnB,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAC;IAEtB,4DAA4D;IAC5D,cAAc,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,23 @@
1
+ import type { OxyRuntime } from './createOxyRuntime';
2
+ import type { OxyRuntimeSnapshot } from './types';
3
+ /**
4
+ * Subscribe to the whole runtime snapshot.
5
+ *
6
+ * The runtime publishes a frozen object only when a fact actually changed, so
7
+ * identity comparison is exact: a locale change, a dialog opening or an
8
+ * unrelated query settling does not wake anything subscribed here.
9
+ */
10
+ export declare function useRuntimeSnapshot(runtime: OxyRuntime): OxyRuntimeSnapshot;
11
+ /**
12
+ * Subscribe to one derived value of the runtime snapshot.
13
+ *
14
+ * The selection is cached against the snapshot it was computed from, which is
15
+ * what makes a selector returning a fresh object (`{user, isAuthenticated}`)
16
+ * safe here: `useSyncExternalStore` calls `getSnapshot` several times per
17
+ * commit and would otherwise see a new object every call and loop.
18
+ *
19
+ * `selector` must be stable — hoist it to module scope or wrap it in
20
+ * `useCallback`. An inline arrow re-subscribes on every render.
21
+ */
22
+ export declare function useRuntimeSelector<T>(runtime: OxyRuntime, selector: (snapshot: OxyRuntimeSnapshot) => T, isEqual?: (a: T, b: T) => boolean): T;
23
+ //# sourceMappingURL=useRuntimeSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRuntimeSnapshot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/useRuntimeSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAE1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,CAAC,EAC7C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAqBH"}
@@ -22,7 +22,6 @@ export declare const useStorage: () => {
22
22
  };
23
23
  export declare const ProfileScreen: () => null;
24
24
  export declare const useAuthStore: () => {};
25
- export declare const useAccountStore: () => {};
26
25
  export declare const toast: (() => void) & {
27
26
  success: () => void;
28
27
  error: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/ui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO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