@data-club/ai-hub 0.0.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 (344) hide show
  1. package/dist/auth/passwordPolicy.d.ts +55 -0
  2. package/dist/auth/passwordPolicy.d.ts.map +1 -0
  3. package/dist/auth/passwordPolicy.js +63 -0
  4. package/dist/auth/passwordPolicy.js.map +1 -0
  5. package/dist/auth/texts.d.ts +815 -0
  6. package/dist/auth/texts.d.ts.map +1 -0
  7. package/dist/auth/texts.js +429 -0
  8. package/dist/auth/texts.js.map +1 -0
  9. package/dist/client/AIHubClient.d.ts +1058 -0
  10. package/dist/client/AIHubClient.d.ts.map +1 -0
  11. package/dist/client/AIHubClient.js +950 -0
  12. package/dist/client/AIHubClient.js.map +1 -0
  13. package/dist/client/index.d.ts +11 -0
  14. package/dist/client/index.d.ts.map +1 -0
  15. package/dist/client/index.js +9 -0
  16. package/dist/client/index.js.map +1 -0
  17. package/dist/client/sseParser.d.ts +41 -0
  18. package/dist/client/sseParser.d.ts.map +1 -0
  19. package/dist/client/sseParser.js +153 -0
  20. package/dist/client/sseParser.js.map +1 -0
  21. package/dist/client/tokenStorage.d.ts +56 -0
  22. package/dist/client/tokenStorage.d.ts.map +1 -0
  23. package/dist/client/tokenStorage.js +116 -0
  24. package/dist/client/tokenStorage.js.map +1 -0
  25. package/dist/components/AgentsPicker/index.d.ts +70 -0
  26. package/dist/components/AgentsPicker/index.d.ts.map +1 -0
  27. package/dist/components/AgentsPicker/index.js +63 -0
  28. package/dist/components/AgentsPicker/index.js.map +1 -0
  29. package/dist/components/AuthGate/index.d.ts +79 -0
  30. package/dist/components/AuthGate/index.d.ts.map +1 -0
  31. package/dist/components/AuthGate/index.js +61 -0
  32. package/dist/components/AuthGate/index.js.map +1 -0
  33. package/dist/components/CacheBadge/index.d.ts +88 -0
  34. package/dist/components/CacheBadge/index.d.ts.map +1 -0
  35. package/dist/components/CacheBadge/index.js +127 -0
  36. package/dist/components/CacheBadge/index.js.map +1 -0
  37. package/dist/components/ChangePassword/index.d.ts +109 -0
  38. package/dist/components/ChangePassword/index.d.ts.map +1 -0
  39. package/dist/components/ChangePassword/index.js +142 -0
  40. package/dist/components/ChangePassword/index.js.map +1 -0
  41. package/dist/components/ChatShell/ShellHeader.d.ts +44 -0
  42. package/dist/components/ChatShell/ShellHeader.d.ts.map +1 -0
  43. package/dist/components/ChatShell/ShellHeader.js +14 -0
  44. package/dist/components/ChatShell/ShellHeader.js.map +1 -0
  45. package/dist/components/ChatShell/UserMenu.d.ts +48 -0
  46. package/dist/components/ChatShell/UserMenu.d.ts.map +1 -0
  47. package/dist/components/ChatShell/UserMenu.js +86 -0
  48. package/dist/components/ChatShell/UserMenu.js.map +1 -0
  49. package/dist/components/ChatShell/index.d.ts +98 -0
  50. package/dist/components/ChatShell/index.d.ts.map +1 -0
  51. package/dist/components/ChatShell/index.js +124 -0
  52. package/dist/components/ChatShell/index.js.map +1 -0
  53. package/dist/components/DataClubAIHub/index.d.ts +132 -0
  54. package/dist/components/DataClubAIHub/index.d.ts.map +1 -0
  55. package/dist/components/DataClubAIHub/index.js +124 -0
  56. package/dist/components/DataClubAIHub/index.js.map +1 -0
  57. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts +89 -0
  58. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts.map +1 -0
  59. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js +199 -0
  60. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js.map +1 -0
  61. package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts +33 -0
  62. package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts.map +1 -0
  63. package/dist/components/DataClubAIHubAdmin/AgentsPage.js +137 -0
  64. package/dist/components/DataClubAIHubAdmin/AgentsPage.js.map +1 -0
  65. package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts +50 -0
  66. package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts.map +1 -0
  67. package/dist/components/DataClubAIHubAdmin/CreateUserModal.js +93 -0
  68. package/dist/components/DataClubAIHubAdmin/CreateUserModal.js.map +1 -0
  69. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts +49 -0
  70. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts.map +1 -0
  71. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js +94 -0
  72. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js.map +1 -0
  73. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts +37 -0
  74. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts.map +1 -0
  75. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js +44 -0
  76. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js.map +1 -0
  77. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts +56 -0
  78. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts.map +1 -0
  79. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js +158 -0
  80. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js.map +1 -0
  81. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts +29 -0
  82. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts.map +1 -0
  83. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js +183 -0
  84. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js.map +1 -0
  85. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts +38 -0
  86. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts.map +1 -0
  87. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js +294 -0
  88. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js.map +1 -0
  89. package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts +36 -0
  90. package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts.map +1 -0
  91. package/dist/components/DataClubAIHubAdmin/SettingsPage.js +373 -0
  92. package/dist/components/DataClubAIHubAdmin/SettingsPage.js.map +1 -0
  93. package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts +47 -0
  94. package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts.map +1 -0
  95. package/dist/components/DataClubAIHubAdmin/UsersPage.js +233 -0
  96. package/dist/components/DataClubAIHubAdmin/UsersPage.js.map +1 -0
  97. package/dist/components/DataClubAIHubAdmin/index.d.ts +87 -0
  98. package/dist/components/DataClubAIHubAdmin/index.d.ts.map +1 -0
  99. package/dist/components/DataClubAIHubAdmin/index.js +137 -0
  100. package/dist/components/DataClubAIHubAdmin/index.js.map +1 -0
  101. package/dist/components/DataClubAIHubLogin/index.d.ts +113 -0
  102. package/dist/components/DataClubAIHubLogin/index.d.ts.map +1 -0
  103. package/dist/components/DataClubAIHubLogin/index.js +123 -0
  104. package/dist/components/DataClubAIHubLogin/index.js.map +1 -0
  105. package/dist/components/EffortControl/index.d.ts +57 -0
  106. package/dist/components/EffortControl/index.d.ts.map +1 -0
  107. package/dist/components/EffortControl/index.js +84 -0
  108. package/dist/components/EffortControl/index.js.map +1 -0
  109. package/dist/components/Layout/index.d.ts +63 -0
  110. package/dist/components/Layout/index.d.ts.map +1 -0
  111. package/dist/components/Layout/index.js +45 -0
  112. package/dist/components/Layout/index.js.map +1 -0
  113. package/dist/components/MainColumn/index.d.ts +69 -0
  114. package/dist/components/MainColumn/index.d.ts.map +1 -0
  115. package/dist/components/MainColumn/index.js +47 -0
  116. package/dist/components/MainColumn/index.js.map +1 -0
  117. package/dist/components/MarkdownRenderer/index.d.ts +66 -0
  118. package/dist/components/MarkdownRenderer/index.d.ts.map +1 -0
  119. package/dist/components/MarkdownRenderer/index.js +153 -0
  120. package/dist/components/MarkdownRenderer/index.js.map +1 -0
  121. package/dist/components/MessageInput/index.d.ts +85 -0
  122. package/dist/components/MessageInput/index.d.ts.map +1 -0
  123. package/dist/components/MessageInput/index.js +139 -0
  124. package/dist/components/MessageInput/index.js.map +1 -0
  125. package/dist/components/MessageList/index.d.ts +156 -0
  126. package/dist/components/MessageList/index.d.ts.map +1 -0
  127. package/dist/components/MessageList/index.js +352 -0
  128. package/dist/components/MessageList/index.js.map +1 -0
  129. package/dist/components/ReasoningSelector/index.d.ts +77 -0
  130. package/dist/components/ReasoningSelector/index.d.ts.map +1 -0
  131. package/dist/components/ReasoningSelector/index.js +156 -0
  132. package/dist/components/ReasoningSelector/index.js.map +1 -0
  133. package/dist/components/ReasoningView/index.d.ts +94 -0
  134. package/dist/components/ReasoningView/index.d.ts.map +1 -0
  135. package/dist/components/ReasoningView/index.js +83 -0
  136. package/dist/components/ReasoningView/index.js.map +1 -0
  137. package/dist/components/ScrollToPresentButton/index.d.ts +54 -0
  138. package/dist/components/ScrollToPresentButton/index.d.ts.map +1 -0
  139. package/dist/components/ScrollToPresentButton/index.js +44 -0
  140. package/dist/components/ScrollToPresentButton/index.js.map +1 -0
  141. package/dist/components/SessionsPanel/SessionTitleModal.d.ts +79 -0
  142. package/dist/components/SessionsPanel/SessionTitleModal.d.ts.map +1 -0
  143. package/dist/components/SessionsPanel/SessionTitleModal.js +102 -0
  144. package/dist/components/SessionsPanel/SessionTitleModal.js.map +1 -0
  145. package/dist/components/SessionsPanel/index.d.ts +100 -0
  146. package/dist/components/SessionsPanel/index.d.ts.map +1 -0
  147. package/dist/components/SessionsPanel/index.js +176 -0
  148. package/dist/components/SessionsPanel/index.js.map +1 -0
  149. package/dist/components/SystemNotice/index.d.ts +66 -0
  150. package/dist/components/SystemNotice/index.d.ts.map +1 -0
  151. package/dist/components/SystemNotice/index.js +81 -0
  152. package/dist/components/SystemNotice/index.js.map +1 -0
  153. package/dist/components/ThemeSwitcher/index.d.ts +66 -0
  154. package/dist/components/ThemeSwitcher/index.d.ts.map +1 -0
  155. package/dist/components/ThemeSwitcher/index.js +73 -0
  156. package/dist/components/ThemeSwitcher/index.js.map +1 -0
  157. package/dist/components/ToolCallView/formatContent.d.ts +36 -0
  158. package/dist/components/ToolCallView/formatContent.d.ts.map +1 -0
  159. package/dist/components/ToolCallView/formatContent.js +53 -0
  160. package/dist/components/ToolCallView/formatContent.js.map +1 -0
  161. package/dist/components/ToolCallView/index.d.ts +120 -0
  162. package/dist/components/ToolCallView/index.d.ts.map +1 -0
  163. package/dist/components/ToolCallView/index.js +104 -0
  164. package/dist/components/ToolCallView/index.js.map +1 -0
  165. package/dist/components/TpmBanner/index.d.ts +53 -0
  166. package/dist/components/TpmBanner/index.d.ts.map +1 -0
  167. package/dist/components/TpmBanner/index.js +116 -0
  168. package/dist/components/TpmBanner/index.js.map +1 -0
  169. package/dist/components/TurnStatusIndicator/index.d.ts +77 -0
  170. package/dist/components/TurnStatusIndicator/index.d.ts.map +1 -0
  171. package/dist/components/TurnStatusIndicator/index.js +122 -0
  172. package/dist/components/TurnStatusIndicator/index.js.map +1 -0
  173. package/dist/components/internal/PasswordInput.d.ts +62 -0
  174. package/dist/components/internal/PasswordInput.d.ts.map +1 -0
  175. package/dist/components/internal/PasswordInput.js +42 -0
  176. package/dist/components/internal/PasswordInput.js.map +1 -0
  177. package/dist/context/AIHubContext.d.ts +220 -0
  178. package/dist/context/AIHubContext.d.ts.map +1 -0
  179. package/dist/context/AIHubContext.js +19 -0
  180. package/dist/context/AIHubContext.js.map +1 -0
  181. package/dist/context/AIHubProvider.d.ts +75 -0
  182. package/dist/context/AIHubProvider.d.ts.map +1 -0
  183. package/dist/context/AIHubProvider.js +954 -0
  184. package/dist/context/AIHubProvider.js.map +1 -0
  185. package/dist/context/index.d.ts +9 -0
  186. package/dist/context/index.d.ts.map +1 -0
  187. package/dist/context/index.js +9 -0
  188. package/dist/context/index.js.map +1 -0
  189. package/dist/context/theme.d.ts +43 -0
  190. package/dist/context/theme.d.ts.map +1 -0
  191. package/dist/context/theme.js +70 -0
  192. package/dist/context/theme.js.map +1 -0
  193. package/dist/context/useAIHub.d.ts +104 -0
  194. package/dist/context/useAIHub.d.ts.map +1 -0
  195. package/dist/context/useAIHub.js +63 -0
  196. package/dist/context/useAIHub.js.map +1 -0
  197. package/dist/context/useAIHubAuth.d.ts +44 -0
  198. package/dist/context/useAIHubAuth.d.ts.map +1 -0
  199. package/dist/context/useAIHubAuth.js +35 -0
  200. package/dist/context/useAIHubAuth.js.map +1 -0
  201. package/dist/index.d.ts +76 -0
  202. package/dist/index.d.ts.map +1 -0
  203. package/dist/index.js +57 -0
  204. package/dist/index.js.map +1 -0
  205. package/dist/primitives/index.d.ts +99 -0
  206. package/dist/primitives/index.d.ts.map +1 -0
  207. package/dist/primitives/index.js +97 -0
  208. package/dist/primitives/index.js.map +1 -0
  209. package/dist/state/affordances.d.ts +182 -0
  210. package/dist/state/affordances.d.ts.map +1 -0
  211. package/dist/state/affordances.js +189 -0
  212. package/dist/state/affordances.js.map +1 -0
  213. package/dist/state/stateReducer.d.ts +72 -0
  214. package/dist/state/stateReducer.d.ts.map +1 -0
  215. package/dist/state/stateReducer.js +122 -0
  216. package/dist/state/stateReducer.js.map +1 -0
  217. package/dist/stories/EffortControl.stories.d.ts +14 -0
  218. package/dist/stories/EffortControl.stories.d.ts.map +1 -0
  219. package/dist/stories/EffortControl.stories.js +43 -0
  220. package/dist/stories/EffortControl.stories.js.map +1 -0
  221. package/dist/stories/MarkdownRenderer.stories.d.ts +25 -0
  222. package/dist/stories/MarkdownRenderer.stories.d.ts.map +1 -0
  223. package/dist/stories/MarkdownRenderer.stories.js +178 -0
  224. package/dist/stories/MarkdownRenderer.stories.js.map +1 -0
  225. package/dist/stories/MessageBubble.stories.d.ts +21 -0
  226. package/dist/stories/MessageBubble.stories.d.ts.map +1 -0
  227. package/dist/stories/MessageBubble.stories.js +59 -0
  228. package/dist/stories/MessageBubble.stories.js.map +1 -0
  229. package/dist/stories/ReasoningView.stories.d.ts +18 -0
  230. package/dist/stories/ReasoningView.stories.d.ts.map +1 -0
  231. package/dist/stories/ReasoningView.stories.js +62 -0
  232. package/dist/stories/ReasoningView.stories.js.map +1 -0
  233. package/dist/stories/ScrollToPresentButton.stories.d.ts +18 -0
  234. package/dist/stories/ScrollToPresentButton.stories.d.ts.map +1 -0
  235. package/dist/stories/ScrollToPresentButton.stories.js +34 -0
  236. package/dist/stories/ScrollToPresentButton.stories.js.map +1 -0
  237. package/dist/stories/SystemNotice.stories.d.ts +17 -0
  238. package/dist/stories/SystemNotice.stories.d.ts.map +1 -0
  239. package/dist/stories/SystemNotice.stories.js +42 -0
  240. package/dist/stories/SystemNotice.stories.js.map +1 -0
  241. package/dist/stories/ThemeSwitcher.stories.d.ts +15 -0
  242. package/dist/stories/ThemeSwitcher.stories.d.ts.map +1 -0
  243. package/dist/stories/ThemeSwitcher.stories.js +35 -0
  244. package/dist/stories/ThemeSwitcher.stories.js.map +1 -0
  245. package/dist/stories/ToolCallView.stories.d.ts +20 -0
  246. package/dist/stories/ToolCallView.stories.d.ts.map +1 -0
  247. package/dist/stories/ToolCallView.stories.js +65 -0
  248. package/dist/stories/ToolCallView.stories.js.map +1 -0
  249. package/dist/stories/TpmBanner.stories.d.ts +24 -0
  250. package/dist/stories/TpmBanner.stories.d.ts.map +1 -0
  251. package/dist/stories/TpmBanner.stories.js +63 -0
  252. package/dist/stories/TpmBanner.stories.js.map +1 -0
  253. package/dist/stories/TurnStatusIndicator.stories.d.ts +25 -0
  254. package/dist/stories/TurnStatusIndicator.stories.d.ts.map +1 -0
  255. package/dist/stories/TurnStatusIndicator.stories.js +56 -0
  256. package/dist/stories/TurnStatusIndicator.stories.js.map +1 -0
  257. package/dist/stories/_mockProvider.d.ts +44 -0
  258. package/dist/stories/_mockProvider.d.ts.map +1 -0
  259. package/dist/stories/_mockProvider.js +84 -0
  260. package/dist/stories/_mockProvider.js.map +1 -0
  261. package/dist/types.d.ts +787 -0
  262. package/dist/types.d.ts.map +1 -0
  263. package/dist/types.js +19 -0
  264. package/dist/types.js.map +1 -0
  265. package/dist/webcomponent/defineWebComponent.d.ts +106 -0
  266. package/dist/webcomponent/defineWebComponent.d.ts.map +1 -0
  267. package/dist/webcomponent/defineWebComponent.js +126 -0
  268. package/dist/webcomponent/defineWebComponent.js.map +1 -0
  269. package/dist/webcomponent/index.d.ts +7 -0
  270. package/dist/webcomponent/index.d.ts.map +1 -0
  271. package/dist/webcomponent/index.js +7 -0
  272. package/dist/webcomponent/index.js.map +1 -0
  273. package/package.json +63 -0
  274. package/src/__lint-canary__/step1-lint-canary.ts.disabled +28 -0
  275. package/src/auth/passwordPolicy.ts +75 -0
  276. package/src/auth/texts.ts +1294 -0
  277. package/src/client/AIHubClient.ts +1718 -0
  278. package/src/client/index.ts +30 -0
  279. package/src/client/sseParser.ts +168 -0
  280. package/src/client/tokenStorage.ts +131 -0
  281. package/src/components/AgentsPicker/index.tsx +147 -0
  282. package/src/components/AuthGate/index.tsx +132 -0
  283. package/src/components/CacheBadge/index.tsx +245 -0
  284. package/src/components/ChangePassword/index.tsx +375 -0
  285. package/src/components/ChatShell/ShellHeader.tsx +80 -0
  286. package/src/components/ChatShell/UserMenu.tsx +196 -0
  287. package/src/components/ChatShell/index.tsx +307 -0
  288. package/src/components/DataClubAIHub/index.tsx +300 -0
  289. package/src/components/DataClubAIHubAdmin/AgentEditorModal.tsx +505 -0
  290. package/src/components/DataClubAIHubAdmin/AgentsPage.tsx +342 -0
  291. package/src/components/DataClubAIHubAdmin/CreateUserModal.tsx +214 -0
  292. package/src/components/DataClubAIHubAdmin/PasswordRevealModal.tsx +204 -0
  293. package/src/components/DataClubAIHubAdmin/ResetPasswordModal.tsx +122 -0
  294. package/src/components/DataClubAIHubAdmin/RotatingMessageEditorModal.tsx +408 -0
  295. package/src/components/DataClubAIHubAdmin/RotatingMessagesPage.tsx +373 -0
  296. package/src/components/DataClubAIHubAdmin/SessionsOverviewPage.tsx +639 -0
  297. package/src/components/DataClubAIHubAdmin/SettingsPage.tsx +979 -0
  298. package/src/components/DataClubAIHubAdmin/UsersPage.tsx +495 -0
  299. package/src/components/DataClubAIHubAdmin/index.tsx +277 -0
  300. package/src/components/DataClubAIHubLogin/index.tsx +282 -0
  301. package/src/components/EffortControl/index.tsx +138 -0
  302. package/src/components/Layout/index.tsx +92 -0
  303. package/src/components/MainColumn/index.tsx +131 -0
  304. package/src/components/MarkdownRenderer/index.tsx +256 -0
  305. package/src/components/MessageInput/index.tsx +283 -0
  306. package/src/components/MessageList/index.tsx +753 -0
  307. package/src/components/ReasoningSelector/index.tsx +268 -0
  308. package/src/components/ReasoningView/index.tsx +183 -0
  309. package/src/components/ScrollToPresentButton/index.tsx +85 -0
  310. package/src/components/SessionsPanel/SessionTitleModal.tsx +256 -0
  311. package/src/components/SessionsPanel/index.tsx +406 -0
  312. package/src/components/SystemNotice/index.tsx +151 -0
  313. package/src/components/ThemeSwitcher/index.tsx +136 -0
  314. package/src/components/ToolCallView/formatContent.ts +50 -0
  315. package/src/components/ToolCallView/index.tsx +274 -0
  316. package/src/components/TpmBanner/index.tsx +172 -0
  317. package/src/components/TurnStatusIndicator/index.tsx +203 -0
  318. package/src/components/internal/PasswordInput.tsx +145 -0
  319. package/src/context/AIHubContext.ts +249 -0
  320. package/src/context/AIHubProvider.tsx +1084 -0
  321. package/src/context/index.ts +9 -0
  322. package/src/context/theme.ts +76 -0
  323. package/src/context/useAIHub.ts +151 -0
  324. package/src/context/useAIHubAuth.ts +65 -0
  325. package/src/index.ts +275 -0
  326. package/src/primitives/index.ts +101 -0
  327. package/src/state/affordances.ts +321 -0
  328. package/src/state/stateReducer.ts +131 -0
  329. package/src/stories/EffortControl.stories.tsx +63 -0
  330. package/src/stories/MarkdownRenderer.stories.tsx +201 -0
  331. package/src/stories/MessageBubble.stories.tsx +101 -0
  332. package/src/stories/ReasoningView.stories.tsx +81 -0
  333. package/src/stories/ScrollToPresentButton.stories.tsx +52 -0
  334. package/src/stories/SystemNotice.stories.tsx +59 -0
  335. package/src/stories/ThemeSwitcher.stories.tsx +55 -0
  336. package/src/stories/ToolCallView.stories.tsx +95 -0
  337. package/src/stories/TpmBanner.stories.tsx +93 -0
  338. package/src/stories/TurnStatusIndicator.stories.tsx +86 -0
  339. package/src/stories/_mockProvider.tsx +116 -0
  340. package/src/styles/CLASSES.md +356 -0
  341. package/src/styles/default.css +2937 -0
  342. package/src/types.ts +867 -0
  343. package/src/webcomponent/defineWebComponent.tsx +193 -0
  344. package/src/webcomponent/index.ts +11 -0
@@ -0,0 +1,204 @@
1
+ /**
2
+ * `<PasswordRevealModal />` โ€” one-time-display of a server-generated
3
+ * password. Reused for the create-user and reset-password flows on the
4
+ * Admin Users page ([05-admin-users.md]).
5
+ *
6
+ * Once dismissed, the password is gone โ€” there's no path back. The
7
+ * component never logs the value and never lifts it into any persistent
8
+ * store; it lives in the host component's local state until `onClose`.
9
+ *
10
+ * Behavior contracts:
11
+ *
12
+ * - Clicking the copy button writes the password to the clipboard and
13
+ * flashes the "Copied!" confirmation for ~2s. The flash uses a timer
14
+ * that the host doesn't need to manage.
15
+ * - There is no "click outside to dismiss" โ€” the modal must be explicitly
16
+ * closed via the Done button. This is deliberate ([05-admin-users.md]):
17
+ * the admin can't accidentally lose the password by misclicking.
18
+ * - The password field is a read-only `<input>` so a screen-reader user
19
+ * can read + select it like any other text field (rather than putting
20
+ * it inside a `<div>` and forcing the user to mouse-drag-select).
21
+ *
22
+ * @see SPECIFICATIONS.md ยง8.5 โ€” password reset semantics
23
+ * @see ui-sketches/05-admin-users.md โ€” password_reveal_modal
24
+ */
25
+ import { useEffect, useRef, useState, type ReactNode } from "react";
26
+
27
+ import type { AIHubAdminTexts } from "../../auth/texts.js";
28
+
29
+ /**
30
+ * Props for `<PasswordRevealModal />`.
31
+ */
32
+ export interface PasswordRevealModalProps {
33
+ /** Modal-title variant โ€” drives which texts key is used. */
34
+ variant: "create" | "reset";
35
+ /** Username the password belongs to. */
36
+ username: string;
37
+ /** The 16-char alphanumeric plaintext. Never logged; never stored. */
38
+ password: string;
39
+ /** Resolved admin texts (admin namespace). */
40
+ texts: AIHubAdminTexts;
41
+ /** Fired when the admin clicks Done โ€” the password is unrecoverable after. */
42
+ onClose: () => void;
43
+ }
44
+
45
+ /**
46
+ * Renders the reveal modal.
47
+ *
48
+ * @param props - see `PasswordRevealModalProps`.
49
+ * @returns the rendered modal.
50
+ */
51
+ export function PasswordRevealModal(
52
+ props: PasswordRevealModalProps,
53
+ ): ReactNode {
54
+ const [copied, setCopied] = useState(false);
55
+ // Stash the timeout id so unmount during the flash cleans up properly.
56
+ const flashTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
57
+
58
+ useEffect(() => {
59
+ return () => {
60
+ if (flashTimer.current !== null) clearTimeout(flashTimer.current);
61
+ };
62
+ }, []);
63
+
64
+ async function handleCopy(): Promise<void> {
65
+ // Two clipboard backends to cover JSDOM tests AND old browsers without
66
+ // the async clipboard API: prefer the modern one, fall back to
67
+ // `document.execCommand` via a hidden textarea.
68
+ let ok = false;
69
+ try {
70
+ if (
71
+ typeof navigator !== "undefined" &&
72
+ navigator.clipboard?.writeText
73
+ ) {
74
+ await navigator.clipboard.writeText(props.password);
75
+ ok = true;
76
+ }
77
+ } catch {
78
+ ok = false;
79
+ }
80
+ if (!ok && typeof document !== "undefined") {
81
+ try {
82
+ const ta = document.createElement("textarea");
83
+ ta.value = props.password;
84
+ ta.setAttribute("readonly", "");
85
+ ta.style.position = "absolute";
86
+ ta.style.left = "-9999px";
87
+ document.body.appendChild(ta);
88
+ ta.select();
89
+ try {
90
+ document.execCommand("copy");
91
+ ok = true;
92
+ } finally {
93
+ document.body.removeChild(ta);
94
+ }
95
+ } catch {
96
+ ok = false;
97
+ }
98
+ }
99
+ // Even if both paths failed (unlikely outside test envs), surface the
100
+ // flash so the admin knows their click registered; the password is
101
+ // still visible on screen for manual transcription.
102
+ setCopied(true);
103
+ if (flashTimer.current !== null) clearTimeout(flashTimer.current);
104
+ flashTimer.current = setTimeout(() => setCopied(false), 2000);
105
+ }
106
+
107
+ const title =
108
+ props.variant === "create"
109
+ ? props.texts.passwordRevealCreateTitle
110
+ : props.texts.passwordRevealResetTitle;
111
+
112
+ return (
113
+ <div
114
+ className="data-club-ai-hub-admin__modal-backdrop"
115
+ data-testid="password-reveal-modal-backdrop"
116
+ role="presentation"
117
+ >
118
+ <div
119
+ className="data-club-ai-hub-admin__modal data-club-ai-hub-admin__modal--password-reveal"
120
+ role="dialog"
121
+ aria-modal="true"
122
+ aria-labelledby="password-reveal-title"
123
+ data-testid="password-reveal-modal"
124
+ >
125
+ <h2
126
+ id="password-reveal-title"
127
+ className="data-club-ai-hub-admin__modal-title"
128
+ >
129
+ {title}
130
+ </h2>
131
+ <p
132
+ className="data-club-ai-hub-admin__modal-warning"
133
+ data-testid="password-reveal-warning"
134
+ >
135
+ โš  {props.texts.passwordRevealWarning}
136
+ </p>
137
+ <label
138
+ className="data-club-ai-hub-admin__modal-field"
139
+ data-testid="password-reveal-username-row"
140
+ >
141
+ <span className="data-club-ai-hub-admin__modal-label">
142
+ {props.texts.passwordRevealUsernameLabel}
143
+ </span>
144
+ <input
145
+ type="text"
146
+ readOnly
147
+ value={props.username}
148
+ className="data-club-ai-hub-admin__modal-input"
149
+ data-testid="password-reveal-username"
150
+ />
151
+ </label>
152
+ <label
153
+ className="data-club-ai-hub-admin__modal-field"
154
+ data-testid="password-reveal-password-row"
155
+ >
156
+ <span className="data-club-ai-hub-admin__modal-label">
157
+ {props.texts.passwordRevealPasswordLabel}
158
+ </span>
159
+ <div className="data-club-ai-hub-admin__password-reveal-row">
160
+ <input
161
+ type="text"
162
+ readOnly
163
+ value={props.password}
164
+ className="data-club-ai-hub-admin__modal-input data-club-ai-hub-admin__modal-input--password"
165
+ data-testid="password-reveal-password"
166
+ spellCheck={false}
167
+ />
168
+ <button
169
+ type="button"
170
+ className="data-club-ai-hub-admin__copy-button"
171
+ data-testid="password-reveal-copy"
172
+ aria-label={props.texts.passwordRevealCopyAriaLabel}
173
+ onClick={() => {
174
+ void handleCopy();
175
+ }}
176
+ >
177
+ ๐Ÿ“‹
178
+ </button>
179
+ {copied ? (
180
+ <span
181
+ className="data-club-ai-hub-admin__copy-flash"
182
+ data-testid="password-reveal-copied-flash"
183
+ role="status"
184
+ aria-live="polite"
185
+ >
186
+ {props.texts.passwordRevealCopiedFlash}
187
+ </span>
188
+ ) : null}
189
+ </div>
190
+ </label>
191
+ <div className="data-club-ai-hub-admin__modal-actions">
192
+ <button
193
+ type="button"
194
+ className="data-club-ai-hub-admin__button data-club-ai-hub-admin__button--primary"
195
+ data-testid="password-reveal-done"
196
+ onClick={props.onClose}
197
+ >
198
+ {props.texts.passwordRevealDoneButton}
199
+ </button>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ );
204
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * `<ResetPasswordModal />` โ€” Phase-1 confirm dialog for the password-reset
3
+ * flow ([05-admin-users.md]).
4
+ *
5
+ * Phase 2 (revealing the new plaintext) reuses `<PasswordRevealModal />`
6
+ * exactly as the create-user flow does โ€” the parent (`<AdminUsersPage />`)
7
+ * owns the phase transition.
8
+ *
9
+ * @see SPECIFICATIONS.md ยง8.5 โ€” password reset semantics
10
+ * @see ui-sketches/05-admin-users.md โ€” reset_password_confirm_modal
11
+ */
12
+ import { useState, type ReactNode } from "react";
13
+
14
+ import type { AIHubAdminTexts } from "../../auth/texts.js";
15
+
16
+ /**
17
+ * Props for `<ResetPasswordModal />`.
18
+ */
19
+ export interface ResetPasswordModalProps {
20
+ /** Username of the target โ€” substituted into the modal title. */
21
+ username: string;
22
+ /** Resolved admin texts. */
23
+ texts: AIHubAdminTexts;
24
+ /**
25
+ * Confirms the reset. Resolves on success; throws on failure so the modal
26
+ * can surface the message inline.
27
+ */
28
+ onConfirm: () => Promise<void>;
29
+ /** Fired when the admin cancels โ€” no server call. */
30
+ onCancel: () => void;
31
+ }
32
+
33
+ /**
34
+ * Renders the reset-password confirm modal.
35
+ *
36
+ * @param props - see `ResetPasswordModalProps`.
37
+ * @returns the rendered modal.
38
+ */
39
+ export function ResetPasswordModal(
40
+ props: ResetPasswordModalProps,
41
+ ): ReactNode {
42
+ const [submitting, setSubmitting] = useState(false);
43
+ const [errorText, setErrorText] = useState<string | null>(null);
44
+
45
+ async function handleConfirm(): Promise<void> {
46
+ setErrorText(null);
47
+ setSubmitting(true);
48
+ try {
49
+ await props.onConfirm();
50
+ } catch (err) {
51
+ const message =
52
+ err instanceof Error && err.message
53
+ ? err.message
54
+ : props.texts.resetPasswordGenericError;
55
+ setErrorText(message);
56
+ setSubmitting(false);
57
+ }
58
+ }
59
+
60
+ const title = props.texts.resetPasswordModalTitle.replace(
61
+ "{username}",
62
+ props.username,
63
+ );
64
+
65
+ return (
66
+ <div
67
+ className="data-club-ai-hub-admin__modal-backdrop"
68
+ role="presentation"
69
+ >
70
+ <div
71
+ className="data-club-ai-hub-admin__modal"
72
+ role="dialog"
73
+ aria-modal="true"
74
+ aria-labelledby="reset-password-modal-title"
75
+ data-testid="reset-password-modal"
76
+ >
77
+ <h2
78
+ id="reset-password-modal-title"
79
+ className="data-club-ai-hub-admin__modal-title"
80
+ >
81
+ {title}
82
+ </h2>
83
+ {errorText !== null ? (
84
+ <div
85
+ className="data-club-ai-hub-admin__modal-error"
86
+ data-testid="reset-password-error"
87
+ role="alert"
88
+ >
89
+ {errorText}
90
+ </div>
91
+ ) : null}
92
+ <p className="data-club-ai-hub-admin__modal-body">
93
+ {props.texts.resetPasswordModalBody}
94
+ </p>
95
+ <div className="data-club-ai-hub-admin__modal-actions">
96
+ <button
97
+ type="button"
98
+ className="data-club-ai-hub-admin__button"
99
+ data-testid="reset-password-cancel"
100
+ onClick={props.onCancel}
101
+ disabled={submitting}
102
+ >
103
+ {props.texts.resetPasswordCancelButton}
104
+ </button>
105
+ <button
106
+ type="button"
107
+ className="data-club-ai-hub-admin__button data-club-ai-hub-admin__button--primary"
108
+ data-testid="reset-password-confirm"
109
+ onClick={() => {
110
+ void handleConfirm();
111
+ }}
112
+ disabled={submitting}
113
+ >
114
+ {submitting
115
+ ? props.texts.resetPasswordConfirmingButton
116
+ : props.texts.resetPasswordConfirmButton}
117
+ </button>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ );
122
+ }