@oxyhq/services 22.12.5 → 22.13.1

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 (464) hide show
  1. package/README.md +16 -46
  2. package/lib/commonjs/index.js +90 -10
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/notifications/deviceNotifications.js +424 -0
  5. package/lib/commonjs/notifications/deviceNotifications.js.map +1 -0
  6. package/lib/commonjs/ui/boot/runProviderColdBoot.js +51 -9
  7. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  8. package/lib/commonjs/ui/client.js +0 -13
  9. package/lib/commonjs/ui/client.js.map +1 -1
  10. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +27 -4
  11. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
  12. package/lib/commonjs/ui/components/OxyAuthChooser.js +74 -1124
  13. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  14. package/lib/commonjs/ui/components/OxyConsentScreen.js +50 -12
  15. package/lib/commonjs/ui/components/OxyConsentScreen.js.map +1 -1
  16. package/lib/commonjs/ui/components/OxyProvider.js +4 -4
  17. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  18. package/lib/commonjs/ui/components/OxySignInButton.js +74 -40
  19. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  20. package/lib/commonjs/ui/components/OxySignInRequestSurface.js +147 -0
  21. package/lib/commonjs/ui/components/OxySignInRequestSurface.js.map +1 -0
  22. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +527 -0
  23. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -0
  24. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +90 -0
  25. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -0
  26. package/lib/commonjs/ui/components/authChooser/SignInRequestView.js +106 -0
  27. package/lib/commonjs/ui/components/authChooser/SignInRequestView.js.map +1 -0
  28. package/lib/commonjs/ui/components/authChooser/SignUpView.js +188 -0
  29. package/lib/commonjs/ui/components/authChooser/SignUpView.js.map +1 -0
  30. package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js +61 -0
  31. package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
  32. package/lib/commonjs/ui/components/authChooser/primitives.js +169 -0
  33. package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -0
  34. package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +153 -0
  35. package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -0
  36. package/lib/commonjs/ui/components/authChooser/signInProgress.js +54 -0
  37. package/lib/commonjs/ui/components/authChooser/signInProgress.js.map +1 -0
  38. package/lib/commonjs/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
  39. package/lib/commonjs/ui/components/authChooser/styles.js.map +1 -0
  40. package/lib/commonjs/ui/components/authChooser/types.js +70 -0
  41. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -0
  42. package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js +50 -0
  43. package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
  44. package/lib/commonjs/ui/context/OxyContext.js +205 -30
  45. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  46. package/lib/commonjs/ui/context/commitSessionFlow.js +46 -0
  47. package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
  48. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +15 -2
  49. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  50. package/lib/commonjs/ui/context/useOxyAccountGraph.js +13 -5
  51. package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
  52. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +6 -1
  53. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +1 -1
  54. package/lib/commonjs/ui/index.js +0 -13
  55. package/lib/commonjs/ui/index.js.map +1 -1
  56. package/lib/commonjs/ui/oauth/browserAuthTransport.js +170 -0
  57. package/lib/commonjs/ui/oauth/browserAuthTransport.js.map +1 -0
  58. package/lib/commonjs/ui/oauth/completeOAuthCode.js +78 -0
  59. package/lib/commonjs/ui/oauth/completeOAuthCode.js.map +1 -0
  60. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +48 -0
  61. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +1 -0
  62. package/lib/commonjs/ui/oauth/oauthHandshake.js +53 -0
  63. package/lib/commonjs/ui/oauth/oauthHandshake.js.map +1 -0
  64. package/lib/commonjs/ui/oauth/oauthPopup.js +276 -0
  65. package/lib/commonjs/ui/oauth/oauthPopup.js.map +1 -0
  66. package/lib/commonjs/ui/oauth/oauthPopupMessages.js +141 -0
  67. package/lib/commonjs/ui/oauth/oauthPopupMessages.js.map +1 -0
  68. package/lib/commonjs/ui/oauth/types.js +2 -0
  69. package/lib/commonjs/ui/oauth/types.js.map +1 -0
  70. package/lib/commonjs/ui/server.js +2 -5
  71. package/lib/commonjs/ui/server.js.map +1 -1
  72. package/lib/commonjs/ui/session/authStore.js +6 -75
  73. package/lib/commonjs/ui/session/authStore.js.map +1 -1
  74. package/lib/commonjs/ui/session/createSessionClient.js +11 -3
  75. package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
  76. package/lib/commonjs/ui/session/identityBinding.js +95 -0
  77. package/lib/commonjs/ui/session/identityBinding.js.map +1 -0
  78. package/lib/commonjs/ui/session/index.js +13 -0
  79. package/lib/commonjs/ui/session/index.js.map +1 -1
  80. package/lib/commonjs/ui/session/nativeSecureStorage.js +90 -0
  81. package/lib/commonjs/ui/session/nativeSecureStorage.js.map +1 -0
  82. package/lib/commonjs/ui/session/tokenTransport.js +11 -1
  83. package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
  84. package/lib/commonjs/ui/utils/crossOriginRestore.js +3 -2
  85. package/lib/commonjs/ui/utils/crossOriginRestore.js.map +1 -1
  86. package/lib/commonjs/ui/utils/deliveryPlatform.js +58 -0
  87. package/lib/commonjs/ui/utils/deliveryPlatform.js.map +1 -0
  88. package/lib/commonjs/ui/utils/oauthReturn.js +33 -49
  89. package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
  90. package/lib/module/index.js +27 -4
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/notifications/deviceNotifications.js +414 -0
  93. package/lib/module/notifications/deviceNotifications.js.map +1 -0
  94. package/lib/module/ui/boot/runProviderColdBoot.js +51 -9
  95. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  96. package/lib/module/ui/client.js +0 -1
  97. package/lib/module/ui/client.js.map +1 -1
  98. package/lib/module/ui/components/OxyAccountDialogScreen.js +27 -4
  99. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
  100. package/lib/module/ui/components/OxyAuthChooser.js +78 -1129
  101. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  102. package/lib/module/ui/components/OxyConsentScreen.js +50 -12
  103. package/lib/module/ui/components/OxyConsentScreen.js.map +1 -1
  104. package/lib/module/ui/components/OxyProvider.js +4 -4
  105. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  106. package/lib/module/ui/components/OxySignInButton.js +76 -42
  107. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  108. package/lib/module/ui/components/OxySignInRequestSurface.js +141 -0
  109. package/lib/module/ui/components/OxySignInRequestSurface.js.map +1 -0
  110. package/lib/module/ui/components/authChooser/AccountsMenuView.js +523 -0
  111. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -0
  112. package/lib/module/ui/components/authChooser/SignInEntryView.js +85 -0
  113. package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -0
  114. package/lib/module/ui/components/authChooser/SignInRequestView.js +101 -0
  115. package/lib/module/ui/components/authChooser/SignInRequestView.js.map +1 -0
  116. package/lib/module/ui/components/authChooser/SignUpView.js +184 -0
  117. package/lib/module/ui/components/authChooser/SignUpView.js.map +1 -0
  118. package/lib/module/ui/components/authChooser/TroubleDisclosure.js +57 -0
  119. package/lib/module/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
  120. package/lib/module/ui/components/authChooser/primitives.js +163 -0
  121. package/lib/module/ui/components/authChooser/primitives.js.map +1 -0
  122. package/lib/module/ui/components/authChooser/requestSurfaces.js +143 -0
  123. package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -0
  124. package/lib/module/ui/components/authChooser/signInProgress.js +50 -0
  125. package/lib/module/ui/components/authChooser/signInProgress.js.map +1 -0
  126. package/lib/module/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
  127. package/lib/module/ui/components/authChooser/styles.js.map +1 -0
  128. package/lib/module/ui/components/authChooser/types.js +66 -0
  129. package/lib/module/ui/components/authChooser/types.js.map +1 -0
  130. package/lib/module/ui/components/authChooser/useUsernameAvailability.js +46 -0
  131. package/lib/module/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
  132. package/lib/module/ui/context/OxyContext.js +208 -33
  133. package/lib/module/ui/context/OxyContext.js.map +1 -1
  134. package/lib/module/ui/context/commitSessionFlow.js +45 -0
  135. package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
  136. package/lib/module/ui/context/hooks/useAuthOperations.js +15 -2
  137. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  138. package/lib/module/ui/context/useOxyAccountGraph.js +13 -5
  139. package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
  140. package/lib/module/ui/hooks/useSwitchableAccounts.js +6 -1
  141. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +1 -1
  142. package/lib/module/ui/index.js +0 -1
  143. package/lib/module/ui/index.js.map +1 -1
  144. package/lib/module/ui/oauth/browserAuthTransport.js +167 -0
  145. package/lib/module/ui/oauth/browserAuthTransport.js.map +1 -0
  146. package/lib/module/ui/oauth/completeOAuthCode.js +75 -0
  147. package/lib/module/ui/oauth/completeOAuthCode.js.map +1 -0
  148. package/lib/module/ui/oauth/legacyRedirectLanes.js +44 -0
  149. package/lib/module/ui/oauth/legacyRedirectLanes.js.map +1 -0
  150. package/lib/module/ui/oauth/oauthHandshake.js +50 -0
  151. package/lib/module/ui/oauth/oauthHandshake.js.map +1 -0
  152. package/lib/module/ui/oauth/oauthPopup.js +268 -0
  153. package/lib/module/ui/oauth/oauthPopup.js.map +1 -0
  154. package/lib/module/ui/oauth/oauthPopupMessages.js +135 -0
  155. package/lib/module/ui/oauth/oauthPopupMessages.js.map +1 -0
  156. package/lib/module/ui/oauth/types.js +2 -0
  157. package/lib/module/ui/oauth/types.js.map +1 -0
  158. package/lib/module/ui/server.js +0 -2
  159. package/lib/module/ui/server.js.map +1 -1
  160. package/lib/module/ui/session/authStore.js +5 -75
  161. package/lib/module/ui/session/authStore.js.map +1 -1
  162. package/lib/module/ui/session/createSessionClient.js +11 -3
  163. package/lib/module/ui/session/createSessionClient.js.map +1 -1
  164. package/lib/module/ui/session/identityBinding.js +89 -0
  165. package/lib/module/ui/session/identityBinding.js.map +1 -0
  166. package/lib/module/ui/session/index.js +5 -2
  167. package/lib/module/ui/session/index.js.map +1 -1
  168. package/lib/module/ui/session/nativeSecureStorage.js +88 -0
  169. package/lib/module/ui/session/nativeSecureStorage.js.map +1 -0
  170. package/lib/module/ui/session/tokenTransport.js +11 -1
  171. package/lib/module/ui/session/tokenTransport.js.map +1 -1
  172. package/lib/module/ui/utils/crossOriginRestore.js +4 -3
  173. package/lib/module/ui/utils/crossOriginRestore.js.map +1 -1
  174. package/lib/module/ui/utils/deliveryPlatform.js +55 -0
  175. package/lib/module/ui/utils/deliveryPlatform.js.map +1 -0
  176. package/lib/module/ui/utils/oauthReturn.js +35 -50
  177. package/lib/module/ui/utils/oauthReturn.js.map +1 -1
  178. package/lib/typescript/commonjs/index.d.ts +9 -1
  179. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts +173 -0
  181. package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +34 -2
  183. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/ui/client.d.ts +0 -1
  185. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  187. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +23 -29
  188. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  189. package/lib/typescript/commonjs/ui/components/OxyConsentScreen.d.ts.map +1 -1
  190. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +17 -12
  192. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts +108 -0
  194. package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
  196. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +32 -0
  198. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts +34 -0
  200. package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts +34 -0
  202. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts +36 -0
  204. package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +55 -0
  206. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +58 -0
  208. package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts +26 -0
  210. package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts.map +1 -0
  211. package/lib/typescript/{module/ui/components/oxyAuthChooserStyles.d.ts → commonjs/ui/components/authChooser/styles.d.ts} +19 -1
  212. package/lib/typescript/commonjs/ui/components/authChooser/styles.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +103 -0
  214. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
  216. package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
  217. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  218. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts +40 -0
  219. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
  220. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +11 -2
  221. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  222. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +44 -1
  223. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  224. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +7 -1
  225. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  226. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  227. package/lib/typescript/commonjs/ui/index.d.ts +0 -1
  228. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  229. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts +56 -0
  230. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts +49 -0
  232. package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts.map +1 -0
  233. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +40 -0
  234. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
  235. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts +50 -0
  236. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts.map +1 -0
  237. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts +83 -0
  238. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts.map +1 -0
  239. package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts +67 -0
  240. package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
  241. package/lib/typescript/commonjs/ui/oauth/types.d.ts +176 -0
  242. package/lib/typescript/commonjs/ui/oauth/types.d.ts.map +1 -0
  243. package/lib/typescript/commonjs/ui/server.d.ts +0 -2
  244. package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
  245. package/lib/typescript/commonjs/ui/session/authStore.d.ts +3 -7
  246. package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
  247. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +8 -1
  248. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
  249. package/lib/typescript/commonjs/ui/session/identityBinding.d.ts +66 -0
  250. package/lib/typescript/commonjs/ui/session/identityBinding.d.ts.map +1 -0
  251. package/lib/typescript/commonjs/ui/session/index.d.ts +6 -2
  252. package/lib/typescript/commonjs/ui/session/index.d.ts.map +1 -1
  253. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts +25 -0
  254. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts.map +1 -0
  255. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +8 -1
  256. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
  257. package/lib/typescript/commonjs/ui/types/navigation.d.ts +44 -0
  258. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  259. package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +1 -1
  260. package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts +33 -0
  261. package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts +11 -16
  263. package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
  264. package/lib/typescript/module/index.d.ts +9 -1
  265. package/lib/typescript/module/index.d.ts.map +1 -1
  266. package/lib/typescript/module/notifications/deviceNotifications.d.ts +173 -0
  267. package/lib/typescript/module/notifications/deviceNotifications.d.ts.map +1 -0
  268. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +34 -2
  269. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  270. package/lib/typescript/module/ui/client.d.ts +0 -1
  271. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  272. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  273. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +23 -29
  274. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  275. package/lib/typescript/module/ui/components/OxyConsentScreen.d.ts.map +1 -1
  276. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  277. package/lib/typescript/module/ui/components/OxySignInButton.d.ts +17 -12
  278. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  279. package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts +108 -0
  280. package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
  281. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
  282. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
  283. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +32 -0
  284. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
  285. package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts +34 -0
  286. package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
  287. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts +34 -0
  288. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts.map +1 -0
  289. package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts +36 -0
  290. package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
  291. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +55 -0
  292. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -0
  293. package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +58 -0
  294. package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
  295. package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts +26 -0
  296. package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts.map +1 -0
  297. package/lib/typescript/{commonjs/ui/components/oxyAuthChooserStyles.d.ts → module/ui/components/authChooser/styles.d.ts} +19 -1
  298. package/lib/typescript/module/ui/components/authChooser/styles.d.ts.map +1 -0
  299. package/lib/typescript/module/ui/components/authChooser/types.d.ts +103 -0
  300. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -0
  301. package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
  302. package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
  303. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  304. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts +40 -0
  305. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
  306. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +11 -2
  307. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  308. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +44 -1
  309. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  310. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +7 -1
  311. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  312. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  313. package/lib/typescript/module/ui/index.d.ts +0 -1
  314. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  315. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts +56 -0
  316. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts.map +1 -0
  317. package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts +49 -0
  318. package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts.map +1 -0
  319. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +40 -0
  320. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
  321. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts +50 -0
  322. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts.map +1 -0
  323. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts +83 -0
  324. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts.map +1 -0
  325. package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts +67 -0
  326. package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
  327. package/lib/typescript/module/ui/oauth/types.d.ts +176 -0
  328. package/lib/typescript/module/ui/oauth/types.d.ts.map +1 -0
  329. package/lib/typescript/module/ui/server.d.ts +0 -2
  330. package/lib/typescript/module/ui/server.d.ts.map +1 -1
  331. package/lib/typescript/module/ui/session/authStore.d.ts +3 -7
  332. package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
  333. package/lib/typescript/module/ui/session/createSessionClient.d.ts +8 -1
  334. package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
  335. package/lib/typescript/module/ui/session/identityBinding.d.ts +66 -0
  336. package/lib/typescript/module/ui/session/identityBinding.d.ts.map +1 -0
  337. package/lib/typescript/module/ui/session/index.d.ts +6 -2
  338. package/lib/typescript/module/ui/session/index.d.ts.map +1 -1
  339. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts +25 -0
  340. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts.map +1 -0
  341. package/lib/typescript/module/ui/session/tokenTransport.d.ts +8 -1
  342. package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
  343. package/lib/typescript/module/ui/types/navigation.d.ts +44 -0
  344. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  345. package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +1 -1
  346. package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts +33 -0
  347. package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts.map +1 -0
  348. package/lib/typescript/module/ui/utils/oauthReturn.d.ts +11 -16
  349. package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
  350. package/package.json +18 -10
  351. package/src/index.ts +51 -5
  352. package/src/notifications/deviceNotifications.ts +458 -0
  353. package/src/ui/boot/__tests__/coldBootWebAuthMode.test.ts +281 -0
  354. package/src/ui/boot/runProviderColdBoot.ts +83 -13
  355. package/src/ui/client.ts +0 -1
  356. package/src/ui/components/OxyAccountDialogScreen.tsx +33 -4
  357. package/src/ui/components/OxyAuthChooser.tsx +102 -1231
  358. package/src/ui/components/OxyConsentScreen.tsx +56 -13
  359. package/src/ui/components/OxyProvider.tsx +4 -4
  360. package/src/ui/components/OxySignInButton.tsx +119 -78
  361. package/src/ui/components/OxySignInRequestSurface.tsx +202 -0
  362. package/src/ui/components/__tests__/OxyConsentScreen.test.tsx +27 -0
  363. package/src/ui/components/authChooser/AccountsMenuView.tsx +569 -0
  364. package/src/ui/components/authChooser/SignInEntryView.tsx +121 -0
  365. package/src/ui/components/authChooser/SignInRequestView.tsx +130 -0
  366. package/src/ui/components/authChooser/SignUpView.tsx +174 -0
  367. package/src/ui/components/authChooser/TroubleDisclosure.tsx +73 -0
  368. package/src/ui/components/authChooser/primitives.tsx +144 -0
  369. package/src/ui/components/authChooser/requestSurfaces.tsx +120 -0
  370. package/src/ui/components/authChooser/signInProgress.ts +54 -0
  371. package/src/ui/components/{oxyAuthChooserStyles.ts → authChooser/styles.ts} +18 -0
  372. package/src/ui/components/authChooser/types.ts +120 -0
  373. package/src/ui/components/authChooser/useUsernameAvailability.ts +60 -0
  374. package/src/ui/context/OxyContext.tsx +226 -24
  375. package/src/ui/context/__tests__/commitSessionFlow.test.ts +102 -0
  376. package/src/ui/context/commitSessionFlow.ts +64 -0
  377. package/src/ui/context/hooks/useAuthOperations.ts +26 -1
  378. package/src/ui/context/oxyContextTypes.ts +45 -1
  379. package/src/ui/context/useOxyAccountGraph.ts +19 -5
  380. package/src/ui/hooks/useSwitchableAccounts.ts +12 -1
  381. package/src/ui/index.ts +0 -1
  382. package/src/ui/oauth/__tests__/browserAuthTransport.test.ts +335 -0
  383. package/src/ui/oauth/__tests__/completeOAuthCode.test.ts +142 -0
  384. package/src/ui/oauth/__tests__/oauthPopup.test.ts +352 -0
  385. package/src/ui/oauth/__tests__/oauthPopupMessages.test.ts +189 -0
  386. package/src/ui/oauth/__tests__/sharedCompletionPath.test.ts +174 -0
  387. package/src/ui/oauth/browserAuthTransport.ts +193 -0
  388. package/src/ui/oauth/completeOAuthCode.ts +93 -0
  389. package/src/ui/oauth/legacyRedirectLanes.ts +43 -0
  390. package/src/ui/oauth/oauthHandshake.ts +74 -0
  391. package/src/ui/oauth/oauthPopup.ts +277 -0
  392. package/src/ui/oauth/oauthPopupMessages.ts +136 -0
  393. package/src/ui/oauth/types.ts +150 -0
  394. package/src/ui/server.ts +0 -2
  395. package/src/ui/session/__tests__/createSessionClient.test.ts +26 -0
  396. package/src/ui/session/__tests__/tokenTransport.test.ts +34 -0
  397. package/src/ui/session/authStore.ts +5 -89
  398. package/src/ui/session/createSessionClient.ts +15 -2
  399. package/src/ui/session/identityBinding.ts +116 -0
  400. package/src/ui/session/index.ts +6 -2
  401. package/src/ui/session/nativeSecureStorage.ts +98 -0
  402. package/src/ui/session/tokenTransport.ts +14 -1
  403. package/src/ui/types/navigation.ts +44 -1
  404. package/src/ui/utils/__tests__/crossOriginRestore.test.ts +17 -0
  405. package/src/ui/utils/crossOriginRestore.ts +7 -6
  406. package/src/ui/utils/deliveryPlatform.ts +65 -0
  407. package/src/ui/utils/oauthReturn.ts +38 -62
  408. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  409. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  410. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  411. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  412. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  413. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  414. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  415. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  416. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  417. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  418. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  419. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  420. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  421. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  422. package/lib/commonjs/ui/components/FontLoader.js +0 -35
  423. package/lib/commonjs/ui/components/FontLoader.js.map +0 -1
  424. package/lib/commonjs/ui/components/FontLoader.native.js +0 -88
  425. package/lib/commonjs/ui/components/FontLoader.native.js.map +0 -1
  426. package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +0 -1
  427. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  428. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  429. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  430. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  431. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  432. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  433. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  434. package/lib/module/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  435. package/lib/module/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  436. package/lib/module/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  437. package/lib/module/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  438. package/lib/module/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  439. package/lib/module/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  440. package/lib/module/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  441. package/lib/module/ui/components/FontLoader.js +0 -29
  442. package/lib/module/ui/components/FontLoader.js.map +0 -1
  443. package/lib/module/ui/components/FontLoader.native.js +0 -83
  444. package/lib/module/ui/components/FontLoader.native.js.map +0 -1
  445. package/lib/module/ui/components/oxyAuthChooserStyles.js.map +0 -1
  446. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +0 -24
  447. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +0 -1
  448. package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts +0 -13
  449. package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts.map +0 -1
  450. package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
  451. package/lib/typescript/module/ui/components/FontLoader.d.ts +0 -24
  452. package/lib/typescript/module/ui/components/FontLoader.d.ts.map +0 -1
  453. package/lib/typescript/module/ui/components/FontLoader.native.d.ts +0 -13
  454. package/lib/typescript/module/ui/components/FontLoader.native.d.ts.map +0 -1
  455. package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
  456. package/src/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  457. package/src/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  458. package/src/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  459. package/src/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  460. package/src/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  461. package/src/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  462. package/src/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  463. package/src/ui/components/FontLoader.native.tsx +0 -88
  464. package/src/ui/components/FontLoader.tsx +0 -27
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The PRIMARY visual of an active "Sign in with Oxy" request — one surface per
5
+ * route, chosen by {@link RequestPrimarySurface} from the controller's own facts.
6
+ *
7
+ * Each is a leading visual and nothing else: the status sentence underneath is
8
+ * owned by `signInProgressLabel`, and the alternatives by `TroubleDisclosure`.
9
+ * That separation is what keeps exactly one primary action on screen (issue
10
+ * #691) — a surface here can never grow a competing button.
11
+ *
12
+ * Anti-phishing: the QR plate encodes `signIn.qrPayload` and renders NOTHING
13
+ * derived from it. Application identity, origin, and scopes are resolved
14
+ * server-side by the approver (Commons), never read out of the payload here.
15
+ */
16
+
17
+ import { View } from 'react-native';
18
+ import { MaterialCommunityIcons } from '@expo/vector-icons';
19
+ import QRCode from 'react-native-qrcode-svg';
20
+ import { Button } from '@oxyhq/bloom/button';
21
+ import { Loading } from '@oxyhq/bloom/loading';
22
+ import { Text } from '@oxyhq/bloom/typography';
23
+ import { authChooserStyles as styles } from "./styles.js";
24
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
25
+ /** High-contrast QR colors — intentionally fixed (NOT themed) for scan reliability. */
26
+ const QR_PLATE_BG = '#FFFFFF';
27
+ const QR_FOREGROUND = '#000000';
28
+ const QR_SIZE = 196;
29
+ /** The leading route glyph, sized to sit where the QR plate otherwise would. */
30
+ const ROUTE_GLYPH_SIZE = 44;
31
+
32
+ /** The indeterminate leading visual: the request exists but has nothing to show yet. */
33
+ export const PreparingSurface = () => /*#__PURE__*/_jsx(Loading, {
34
+ variant: "spinner",
35
+ size: "large"
36
+ });
37
+
38
+ /** The leading glyph for a route whose surface is elsewhere (the phone, Commons). */
39
+ export const RouteGlyph = ({
40
+ name,
41
+ color
42
+ }) => /*#__PURE__*/_jsx(MaterialCommunityIcons, {
43
+ name: name,
44
+ size: ROUTE_GLYPH_SIZE,
45
+ color: color
46
+ });
47
+
48
+ /** The cross-device handoff: a headline over the fixed-contrast QR plate. */
49
+ export const QrPlate = ({
50
+ payload,
51
+ theme,
52
+ t
53
+ }) => /*#__PURE__*/_jsxs(_Fragment, {
54
+ children: [/*#__PURE__*/_jsx(Text, {
55
+ style: [styles.qrHeadline, {
56
+ color: theme.colors.text
57
+ }],
58
+ children: t('accountSwitcher.qrHeadline')
59
+ }), /*#__PURE__*/_jsx(View, {
60
+ style: styles.qrPlate,
61
+ children: /*#__PURE__*/_jsx(QRCode, {
62
+ value: payload,
63
+ size: QR_SIZE,
64
+ backgroundColor: QR_PLATE_BG,
65
+ color: QR_FOREGROUND
66
+ })
67
+ })]
68
+ });
69
+
70
+ /**
71
+ * The acquisition surface. For someone with no Commons at all this is the
72
+ * GENUINE primary route, not a fallback — a same-device QR they would have to
73
+ * scan with the very screen showing it is a dead end — so it renders as the
74
+ * surface's one primary action.
75
+ */
76
+ export const GetCommonsPrompt = ({
77
+ theme,
78
+ t,
79
+ onGetCommons
80
+ }) => /*#__PURE__*/_jsxs(_Fragment, {
81
+ children: [/*#__PURE__*/_jsx(Text, {
82
+ style: [styles.mutedText, {
83
+ color: theme.colors.textSecondary
84
+ }],
85
+ children: t('accountSwitcher.commonsNotInstalled')
86
+ }), /*#__PURE__*/_jsx(Button, {
87
+ variant: "primary",
88
+ onPress: onGetCommons,
89
+ style: styles.primaryButton,
90
+ testID: "get-commons-button",
91
+ children: t('accountSwitcher.getCommons')
92
+ })]
93
+ });
94
+
95
+ /**
96
+ * The one primary visual for the request's current state.
97
+ *
98
+ * Ordered most-terminal-first, so a late-arriving route can never pull the
99
+ * surface back from "confirming" to a QR the user has already scanned. Every
100
+ * branch reads only the facts it is handed — there is no local timeline, and no
101
+ * dependency on WHICH kind of request produced them (the account dialog's device
102
+ * flow and the IdP's OAuth-bound lane both resolve the same three).
103
+ */
104
+ export const RequestPrimarySurface = ({
105
+ route,
106
+ progress,
107
+ qrPayload,
108
+ theme,
109
+ t
110
+ }) => {
111
+ if (progress === 'identity-confirmed') {
112
+ return /*#__PURE__*/_jsx(RouteGlyph, {
113
+ name: "check-circle",
114
+ color: theme.colors.success
115
+ });
116
+ }
117
+ if (progress === 'confirming-identity') {
118
+ return /*#__PURE__*/_jsx(PreparingSurface, {});
119
+ }
120
+ if (route === 'qr' && qrPayload) {
121
+ return /*#__PURE__*/_jsx(QrPlate, {
122
+ payload: qrPayload,
123
+ theme: theme,
124
+ t: t
125
+ });
126
+ }
127
+ if (route === 'await-push') {
128
+ return /*#__PURE__*/_jsx(RouteGlyph, {
129
+ name: "cellphone-message",
130
+ color: theme.colors.primary
131
+ });
132
+ }
133
+ if (route === 'open-commons') {
134
+ return /*#__PURE__*/_jsx(RouteGlyph, {
135
+ name: "open-in-app",
136
+ color: theme.colors.primary
137
+ });
138
+ }
139
+ // No route resolved yet (or a route with no payload to render): the request is
140
+ // being prepared. Honest, and the only state that is not route-specific.
141
+ return /*#__PURE__*/_jsx(PreparingSurface, {});
142
+ };
143
+ //# sourceMappingURL=requestSurfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","MaterialCommunityIcons","QRCode","Button","Loading","Text","authChooserStyles","styles","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","QR_PLATE_BG","QR_FOREGROUND","QR_SIZE","ROUTE_GLYPH_SIZE","PreparingSurface","variant","size","RouteGlyph","name","color","QrPlate","payload","theme","t","children","style","qrHeadline","colors","text","qrPlate","value","backgroundColor","GetCommonsPrompt","onGetCommons","mutedText","textSecondary","onPress","primaryButton","testID","RequestPrimarySurface","route","progress","qrPayload","success","primary"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/requestSurfaces.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,OAAOC,MAAM,MAAM,yBAAyB;AAC5C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,IAAI,QAAQ,yBAAyB;AAE9C,SAASC,iBAAiB,IAAIC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGvD;AACA,MAAMC,WAAW,GAAG,SAAS;AAC7B,MAAMC,aAAa,GAAG,SAAS;AAC/B,MAAMC,OAAO,GAAG,GAAG;AACnB;AACA,MAAMC,gBAAgB,GAAG,EAAE;;AAE3B;AACA,OAAO,MAAMC,gBAA0B,GAAGA,CAA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AC;AAC7B,CAAC","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The sign-in status line's copy (issue #691, Phase 5).
5
+ *
6
+ * One responsibility: map the controller's DERIVED `signIn.progress` — plus the
7
+ * chosen route, which only disambiguates the generic waiting step — onto a
8
+ * sentence. Pure and total, with no clock and no state of its own: the line can
9
+ * therefore only advance when the controller observed a real signal, never on a
10
+ * timer and never optimistically.
11
+ *
12
+ * The ladder the user sees:
13
+ *
14
+ * Preparing request
15
+ * Check Commons on your phone
16
+ * Opened in Commons
17
+ * Confirming identity
18
+ * Identity confirmed
19
+ */
20
+
21
+ /**
22
+ * The status sentence for the active request, or `null` when there is nothing
23
+ * honest to say (no live request, or a terminal error — which is toasted, never
24
+ * rendered inline).
25
+ */
26
+ export function signInProgressLabel(progress, route, t) {
27
+ switch (progress) {
28
+ case 'idle':
29
+ return null;
30
+ case 'preparing':
31
+ return t('accountSwitcher.progress.preparing');
32
+ case 'awaiting-approval':
33
+ // The only step whose copy depends on the route: waiting means something
34
+ // different when the user is holding a QR than when Commons was opened
35
+ // for them. `await-push` never reaches here — a chosen push route is
36
+ // itself a confirmed dispatch, so it derives to `delivered-to-commons`.
37
+ if (route === 'qr') return t('accountSwitcher.progress.scanWithCommons');
38
+ if (route === 'open-commons') return t('accountSwitcher.progress.continueInCommons');
39
+ return t('accountSwitcher.progress.awaitingApproval');
40
+ case 'delivered-to-commons':
41
+ return t('accountSwitcher.progress.checkCommons');
42
+ case 'opened-in-commons':
43
+ return t('accountSwitcher.progress.openedInCommons');
44
+ case 'confirming-identity':
45
+ return t('accountSwitcher.progress.confirming');
46
+ case 'identity-confirmed':
47
+ return t('accountSwitcher.progress.confirmed');
48
+ }
49
+ }
50
+ //# sourceMappingURL=signInProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["signInProgressLabel","progress","route","t"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/signInProgress.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CACjCC,QAAwB,EACxBC,KAAkC,EAClCC,CAAY,EACG;EACf,QAAQF,QAAQ;IACd,KAAK,MAAM;MACT,OAAO,IAAI;IACb,KAAK,WAAW;MACd,OAAOE,CAAC,CAAC,oCAAoC,CAAC;IAChD,KAAK,mBAAmB;MACtB;MACA;MACA;MACA;MACA,IAAID,KAAK,KAAK,IAAI,EAAE,OAAOC,CAAC,CAAC,0CAA0C,CAAC;MACxE,IAAID,KAAK,KAAK,cAAc,EAAE,OAAOC,CAAC,CAAC,4CAA4C,CAAC;MACpF,OAAOA,CAAC,CAAC,2CAA2C,CAAC;IACvD,KAAK,sBAAsB;MACzB,OAAOA,CAAC,CAAC,uCAAuC,CAAC;IACnD,KAAK,mBAAmB;MACtB,OAAOA,CAAC,CAAC,0CAA0C,CAAC;IACtD,KAAK,qBAAqB;MACxB,OAAOA,CAAC,CAAC,qCAAqC,CAAC;IACjD,KAAK,oBAAoB;MACvB,OAAOA,CAAC,CAAC,oCAAoC,CAAC;EAClD;AACF","ignoreList":[]}
@@ -9,6 +9,10 @@ const QR_PLATE_BG = '#FFFFFF';
9
9
  * Shared styles for `OxyAuthChooser`'s views. Extracted from `OxyAccountDialogScreen`
10
10
  * so both the Dialog-wrapped host and any bare host (e.g. a future
11
11
  * auth.oxy.so hub page) render identically without duplicating a StyleSheet.
12
+ *
13
+ * Only what NativeWind cannot express lives here: the animated collapse, the
14
+ * fixed-contrast QR plate, per-account accent rings, and the small subordinate
15
+ * text-link rhythm every view's fallback affordances share.
12
16
  */
13
17
  export const authChooserStyles = StyleSheet.create({
14
18
  rows: {
@@ -193,6 +197,20 @@ export const authChooserStyles = StyleSheet.create({
193
197
  padding: 16,
194
198
  borderRadius: 16,
195
199
  backgroundColor: QR_PLATE_BG
200
+ },
201
+ /**
202
+ * The revealed "Having trouble?" alternatives — a tight stack of subordinate
203
+ * text links. They share `footerLink`'s rhythm, so the stack itself only has
204
+ * to stop them drifting apart.
205
+ */
206
+ troubleActions: {
207
+ width: '100%',
208
+ alignItems: 'center'
209
+ },
210
+ /** The disclosure trigger, aligned with the subordinate links it reveals. */
211
+ troubleTrigger: {
212
+ alignSelf: 'center',
213
+ marginTop: 12
196
214
  }
197
215
  });
198
- //# sourceMappingURL=oxyAuthChooserStyles.js.map
216
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","QR_PLATE_BG","authChooserStyles","create","rows","width","gap","accountRow","flexDirection","alignItems","borderWidth","hairlineWidth","borderRadius","paddingVertical","paddingHorizontal","rowDisabled","opacity","avatarRing","padding","rowMeta","flex","minWidth","rowName","fontSize","fontWeight","rowHandle","marginTop","collapse","overflow","collapseMeasure","hero","paddingTop","paddingBottom","currentAvatarRing","position","top","left","right","bottom","heroAvatarPressable","heroAvatarRing","heroNameBlock","heroGreeting","textAlign","heroAddress","chevronCircle","height","justifyContent","footerLink","alignSelf","linkText","signInBlock","primaryButton","secondaryButton","usernameInput","dividerRow","marginVertical","dividerLine","dividerText","marginHorizontal","centeredBlock","mutedText","qrHeadline","qrPlate","backgroundColor","troubleActions","troubleTrigger"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA,MAAMC,WAAW,GAAG,SAAS;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGF,UAAU,CAACG,MAAM,CAAC;EACjDC,IAAI,EAAE;IACJC,KAAK,EAAE,MAAM;IACbC,GAAG,EAAE;EACP,CAAC;EACDC,UAAU,EAAE;IACVC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBH,GAAG,EAAE,EAAE;IACPI,WAAW,EAAEV,UAAU,CA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AAE,MAAM;IACbmD,cAAc,EAAE;EAClB,CAAC;EACDC,WAAW,EAAE;IACXrC,IAAI,EAAE,CAAC;IACP0B,MAAM,EAAE9C,UAAU,CAACW;EACrB,CAAC;EACD+C,WAAW,EAAE;IACXC,gBAAgB,EAAE,EAAE;IACpBpC,QAAQ,EAAE;EACZ,CAAC;EACDqC,aAAa,EAAE;IACbnD,UAAU,EAAE,QAAQ;IACpBsC,cAAc,EAAE,QAAQ;IACxBzC,GAAG,EAAE,EAAE;IACPO,eAAe,EAAE;EACnB,CAAC;EACDgD,SAAS,EAAE;IACTtC,QAAQ,EAAE,EAAE;IACZoB,SAAS,EAAE;EACb,CAAC;EACDmB,UAAU,EAAE;IACVvC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBmB,SAAS,EAAE;EACb,CAAC;EACDoB,OAAO,EAAE;IACP7C,OAAO,EAAE,EAAE;IACXN,YAAY,EAAE,EAAE;IAChBoD,eAAe,EAAE/D;EACnB,CAAC;EACD;AACF;AACA;AACA;AACA;EACEgE,cAAc,EAAE;IACd5D,KAAK,EAAE,MAAM;IACbI,UAAU,EAAE;EACd,CAAC;EACD;EACAyD,cAAc,EAAE;IACdjB,SAAS,EAAE,QAAQ;IACnBvB,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Shared types + per-account color resolution for the auth chooser's views.
5
+ *
6
+ * One responsibility: the vocabulary every view module in this folder speaks
7
+ * (theme/translate aliases, the container-supplied action bundles, and the
8
+ * account accent). No JSX, no state, no I/O — so a view can import it without
9
+ * dragging any other view in.
10
+ */
11
+
12
+ import { APP_COLOR_NAMES, APP_COLOR_PRESETS } from '@oxyhq/bloom/theme';
13
+
14
+ /**
15
+ * One SUBORDINATE action on a sign-in surface — an alternative revealed behind
16
+ * "Having trouble?", or a non-competing link under the primary.
17
+ *
18
+ * Never a primary button: a sign-in surface presents exactly ONE of those (issue
19
+ * #691), and keeping every other affordance on this single shape is what stops
20
+ * one of them quietly growing into a co-equal button again.
21
+ *
22
+ * Part of the public SDK surface — `OxySignInRequestSurface` takes these.
23
+ */
24
+
25
+ /** The account-row actions the container wires for the switcher + menu views. */
26
+
27
+ /** Used/total storage bytes for the "Oxy storage" block, or `null` when unknown. */
28
+
29
+ /** The account-menu row actions the container wires (deep-links / sheets / sign-out). */
30
+
31
+ /**
32
+ * Where a WebAuthn ceremony can run from the current origin.
33
+ *
34
+ * A credential minted for `oxy.so` can only be ASSERTED there (or a loopback
35
+ * dev host) — a hard, browser-enforced RP-ID boundary, not feature detection.
36
+ * `'direct'` = a first-party Oxy web origin, the ceremony runs here.
37
+ * `'hub'` = any other web origin; it runs in the auth.oxy.so popup instead.
38
+ * `'none'` = native, where Commons owns identity.
39
+ */
40
+
41
+ /**
42
+ * Everything that is NOT the sign-in surface's one primary action.
43
+ *
44
+ * The container wires these once; each view decides which of them are genuine
45
+ * alternatives to ITS primary surface and hands those to `TroubleDisclosure`
46
+ * (issue #691: fallbacks stay hidden until the user asks or the primary route
47
+ * fails). A view never renders one of these as a button.
48
+ */
49
+
50
+ /**
51
+ * Resolve an account's stored color (a named Bloom preset, e.g. `'purple'`) to
52
+ * a concrete brand hex for the row accent. Falls back to the theme primary when
53
+ * the account has no color or the value is not a recognized preset, so the accent
54
+ * renders in EVERY consumer regardless of NativeWind availability.
55
+ */
56
+ export function resolveAccentHex(color, fallback) {
57
+ const preset = toPreset(color);
58
+ return preset ? APP_COLOR_PRESETS[preset].hex : fallback;
59
+ }
60
+
61
+ /** Narrow a stored color string to a known `AppColorName`, or `undefined`. */
62
+ export function toPreset(color) {
63
+ if (!color) return undefined;
64
+ return APP_COLOR_NAMES.includes(color) ? color : undefined;
65
+ }
66
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["APP_COLOR_NAMES","APP_COLOR_PRESETS","resolveAccentHex","color","fallback","preset","toPreset","hex","undefined","includes"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/types.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,EAAEC,iBAAiB,QAA0C,oBAAoB;;AAMzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;;AAcA;;AAMA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAAoB,EAAEC,QAAgB,EAAU;EAC/E,MAAMC,MAAM,GAAGC,QAAQ,CAACH,KAAK,CAAC;EAC9B,OAAOE,MAAM,GAAGJ,iBAAiB,CAACI,MAAM,CAAC,CAACE,GAAG,GAAGH,QAAQ;AAC1D;;AAEA;AACA,OAAO,SAASE,QAAQA,CAACH,KAAoB,EAA4B;EACvE,IAAI,CAACA,KAAK,EAAE,OAAOK,SAAS;EAC5B,OAAQR,eAAe,CAAuBS,QAAQ,CAACN,KAAK,CAAC,GACxDA,KAAK,GACNK,SAAS;AACf","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Debounced username-availability check over the existing SDK method.
5
+ *
6
+ * One responsibility: turn keystrokes into an `idle | checking | available |
7
+ * taken` verdict without racing. A sequence guard drops superseded responses,
8
+ * and a NETWORK failure resets the (now stale) verdict and toasts — it never
9
+ * paints an inline error inside the dialog (owner mandate).
10
+ */
11
+
12
+ import { useCallback, useRef, useState } from 'react';
13
+ import { toast } from '@oxyhq/bloom';
14
+ /** Keystrokes settle for this long before a check is issued. */
15
+ const DEBOUNCE_MS = 400;
16
+ /** Shorter than this and there is nothing worth asking the server about. */
17
+ const MIN_USERNAME_LENGTH = 3;
18
+ export function useUsernameAvailability(oxyServices, t) {
19
+ const [status, setStatus] = useState('idle');
20
+ const timerRef = useRef(null);
21
+ const requestSeqRef = useRef(0);
22
+ const check = useCallback(value => {
23
+ if (timerRef.current) clearTimeout(timerRef.current);
24
+ const seq = ++requestSeqRef.current;
25
+ if (!value || value.length < MIN_USERNAME_LENGTH) {
26
+ setStatus('idle');
27
+ return;
28
+ }
29
+ setStatus('checking');
30
+ timerRef.current = setTimeout(() => {
31
+ void oxyServices.checkUsernameAvailability(value).then(result => {
32
+ if (seq !== requestSeqRef.current) return; // superseded by a newer check
33
+ setStatus(result.available ? 'available' : 'taken');
34
+ }).catch(() => {
35
+ if (seq !== requestSeqRef.current) return;
36
+ setStatus('idle');
37
+ toast.error(t('accounts.create.username.checkFailed'));
38
+ });
39
+ }, DEBOUNCE_MS);
40
+ }, [oxyServices, t]);
41
+ return {
42
+ status,
43
+ check
44
+ };
45
+ }
46
+ //# sourceMappingURL=useUsernameAvailability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useRef","useState","toast","DEBOUNCE_MS","MIN_USERNAME_LENGTH","useUsernameAvailability","oxyServices","t","status","setStatus","timerRef","requestSeqRef","check","value","current","clearTimeout","seq","length","setTimeout","checkUsernameAvailability","then","result","available","catch","error"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/useUsernameAvailability.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrD,SAASC,KAAK,QAAQ,cAAc;AAMpC;AACA,MAAMC,WAAW,GAAG,GAAG;AACvB;AACA,MAAMC,mBAAmB,GAAG,CAAC;AAE7B,OAAO,SAASC,uBAAuBA,CACrCC,WAAwB,EACxBC,CAAY,EAIZ;EACA,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGR,QAAQ,CAAiB,MAAM,CAAC;EAC5D,MAAMS,QAAQ,GAAGV,MAAM,CAAuC,IAAI,CAAC;EACnE,MAAMW,aAAa,GAAGX,MAAM,CAAC,CAAC,CAAC;EAE/B,MAAMY,K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