@stigmer/react 0.0.71 → 0.0.73

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 (440) hide show
  1. package/agent/AgentEnvForm.d.ts +2 -0
  2. package/agent/AgentEnvForm.d.ts.map +1 -1
  3. package/agent/AgentEnvForm.js.map +1 -1
  4. package/agent/AgentPicker.d.ts +2 -0
  5. package/agent/AgentPicker.d.ts.map +1 -1
  6. package/agent/AgentPicker.js.map +1 -1
  7. package/agent/agentSetupReducer.d.ts +69 -7
  8. package/agent/agentSetupReducer.d.ts.map +1 -1
  9. package/agent/agentSetupReducer.js.map +1 -1
  10. package/agent/useAgentCount.d.ts +2 -0
  11. package/agent/useAgentCount.d.ts.map +1 -1
  12. package/agent/useAgentCount.js.map +1 -1
  13. package/attachment/AttachmentChipList.d.ts +15 -0
  14. package/attachment/AttachmentChipList.d.ts.map +1 -1
  15. package/attachment/AttachmentChipList.js +15 -0
  16. package/attachment/AttachmentChipList.js.map +1 -1
  17. package/attachment/useAttachments.d.ts +14 -0
  18. package/attachment/useAttachments.d.ts.map +1 -1
  19. package/attachment/useAttachments.js.map +1 -1
  20. package/composer/useComposer.d.ts +5 -0
  21. package/composer/useComposer.d.ts.map +1 -1
  22. package/composer/useComposer.js.map +1 -1
  23. package/execution/ExecutionPhaseBadge.d.ts +1 -1
  24. package/execution/ExecutionPhaseBadge.js +1 -1
  25. package/execution/McpToolDetail.d.ts +16 -8
  26. package/execution/McpToolDetail.d.ts.map +1 -1
  27. package/execution/McpToolDetail.js +0 -6
  28. package/execution/McpToolDetail.js.map +1 -1
  29. package/execution/TodoList.d.ts +8 -0
  30. package/execution/TodoList.d.ts.map +1 -1
  31. package/execution/TodoList.js +8 -0
  32. package/execution/TodoList.js.map +1 -1
  33. package/execution/ToolArgsView.d.ts +1 -0
  34. package/execution/ToolArgsView.d.ts.map +1 -1
  35. package/execution/ToolArgsView.js.map +1 -1
  36. package/execution/UsageWidget.d.ts +1 -1
  37. package/execution/UsageWidget.js +1 -1
  38. package/execution/file-path-resolver.d.ts +10 -0
  39. package/execution/file-path-resolver.d.ts.map +1 -1
  40. package/execution/file-path-resolver.js.map +1 -1
  41. package/execution/index.d.ts +1 -1
  42. package/execution/index.d.ts.map +1 -1
  43. package/execution/index.js.map +1 -1
  44. package/execution/useArtifactContent.d.ts +33 -0
  45. package/execution/useArtifactContent.d.ts.map +1 -1
  46. package/execution/useArtifactContent.js +33 -0
  47. package/execution/useArtifactContent.js.map +1 -1
  48. package/execution/useSubmitApproval.d.ts +2 -0
  49. package/execution/useSubmitApproval.d.ts.map +1 -1
  50. package/execution/useSubmitApproval.js.map +1 -1
  51. package/github/GitHubRepoPicker.d.ts +13 -0
  52. package/github/GitHubRepoPicker.d.ts.map +1 -1
  53. package/github/GitHubRepoPicker.js +13 -0
  54. package/github/GitHubRepoPicker.js.map +1 -1
  55. package/github/useGitHubConnection.d.ts +29 -1
  56. package/github/useGitHubConnection.d.ts.map +1 -1
  57. package/github/useGitHubConnection.js +29 -1
  58. package/github/useGitHubConnection.js.map +1 -1
  59. package/github/useGitHubRepos.d.ts +31 -0
  60. package/github/useGitHubRepos.d.ts.map +1 -1
  61. package/github/useGitHubRepos.js +31 -0
  62. package/github/useGitHubRepos.js.map +1 -1
  63. package/github/useGitHubSearch.d.ts +25 -0
  64. package/github/useGitHubSearch.d.ts.map +1 -1
  65. package/github/useGitHubSearch.js +25 -0
  66. package/github/useGitHubSearch.js.map +1 -1
  67. package/iam-policy/GrantAccessForm.d.ts +39 -0
  68. package/iam-policy/GrantAccessForm.d.ts.map +1 -0
  69. package/iam-policy/GrantAccessForm.js +75 -0
  70. package/iam-policy/GrantAccessForm.js.map +1 -0
  71. package/iam-policy/OrgMembersPanel.d.ts +28 -0
  72. package/iam-policy/OrgMembersPanel.d.ts.map +1 -0
  73. package/iam-policy/OrgMembersPanel.js +192 -0
  74. package/iam-policy/OrgMembersPanel.js.map +1 -0
  75. package/iam-policy/RoleSelector.d.ts +37 -0
  76. package/iam-policy/RoleSelector.d.ts.map +1 -0
  77. package/iam-policy/RoleSelector.js +42 -0
  78. package/iam-policy/RoleSelector.js.map +1 -0
  79. package/iam-policy/index.d.ts +12 -0
  80. package/iam-policy/index.d.ts.map +1 -0
  81. package/iam-policy/index.js +12 -0
  82. package/iam-policy/index.js.map +1 -0
  83. package/iam-policy/useCreateIamPolicy.d.ts +35 -0
  84. package/iam-policy/useCreateIamPolicy.d.ts.map +1 -0
  85. package/iam-policy/useCreateIamPolicy.js +46 -0
  86. package/iam-policy/useCreateIamPolicy.js.map +1 -0
  87. package/iam-policy/useDeleteIamPolicy.d.ts +34 -0
  88. package/iam-policy/useDeleteIamPolicy.d.ts.map +1 -0
  89. package/iam-policy/useDeleteIamPolicy.js +45 -0
  90. package/iam-policy/useDeleteIamPolicy.js.map +1 -0
  91. package/iam-policy/useGrantableRoles.d.ts +28 -0
  92. package/iam-policy/useGrantableRoles.d.ts.map +1 -0
  93. package/iam-policy/useGrantableRoles.js +32 -0
  94. package/iam-policy/useGrantableRoles.js.map +1 -0
  95. package/iam-policy/usePrincipalsCount.d.ts +31 -0
  96. package/iam-policy/usePrincipalsCount.d.ts.map +1 -0
  97. package/iam-policy/usePrincipalsCount.js +72 -0
  98. package/iam-policy/usePrincipalsCount.js.map +1 -0
  99. package/iam-policy/useResourceAccess.d.ts +51 -0
  100. package/iam-policy/useResourceAccess.d.ts.map +1 -0
  101. package/iam-policy/useResourceAccess.js +85 -0
  102. package/iam-policy/useResourceAccess.js.map +1 -0
  103. package/iam-policy/useRevokeOrgAccess.d.ts +36 -0
  104. package/iam-policy/useRevokeOrgAccess.d.ts.map +1 -0
  105. package/iam-policy/useRevokeOrgAccess.js +48 -0
  106. package/iam-policy/useRevokeOrgAccess.js.map +1 -0
  107. package/iam-policy/useRoleSelector.d.ts +52 -0
  108. package/iam-policy/useRoleSelector.d.ts.map +1 -0
  109. package/iam-policy/useRoleSelector.js +50 -0
  110. package/iam-policy/useRoleSelector.js.map +1 -0
  111. package/iam-policy/useWhoAmI.d.ts +30 -0
  112. package/iam-policy/useWhoAmI.d.ts.map +1 -0
  113. package/iam-policy/useWhoAmI.js +56 -0
  114. package/iam-policy/useWhoAmI.js.map +1 -0
  115. package/identity-provider/CreateIdentityProviderForm.d.ts +39 -0
  116. package/identity-provider/CreateIdentityProviderForm.d.ts.map +1 -0
  117. package/identity-provider/CreateIdentityProviderForm.js +102 -0
  118. package/identity-provider/CreateIdentityProviderForm.js.map +1 -0
  119. package/identity-provider/IdentityProviderDetailPanel.d.ts +42 -0
  120. package/identity-provider/IdentityProviderDetailPanel.d.ts.map +1 -0
  121. package/identity-provider/IdentityProviderDetailPanel.js +156 -0
  122. package/identity-provider/IdentityProviderDetailPanel.js.map +1 -0
  123. package/identity-provider/IdentityProviderListPanel.d.ts +41 -0
  124. package/identity-provider/IdentityProviderListPanel.d.ts.map +1 -0
  125. package/identity-provider/IdentityProviderListPanel.js +110 -0
  126. package/identity-provider/IdentityProviderListPanel.js.map +1 -0
  127. package/identity-provider/IdentityProviderWizard.d.ts +40 -0
  128. package/identity-provider/IdentityProviderWizard.d.ts.map +1 -0
  129. package/identity-provider/IdentityProviderWizard.js +180 -0
  130. package/identity-provider/IdentityProviderWizard.js.map +1 -0
  131. package/identity-provider/ProviderPicker.d.ts +28 -0
  132. package/identity-provider/ProviderPicker.d.ts.map +1 -0
  133. package/identity-provider/ProviderPicker.js +64 -0
  134. package/identity-provider/ProviderPicker.js.map +1 -0
  135. package/identity-provider/SsoLoginPrompt.d.ts +51 -0
  136. package/identity-provider/SsoLoginPrompt.d.ts.map +1 -0
  137. package/identity-provider/SsoLoginPrompt.js +119 -0
  138. package/identity-provider/SsoLoginPrompt.js.map +1 -0
  139. package/identity-provider/index.d.ts +14 -0
  140. package/identity-provider/index.d.ts.map +1 -0
  141. package/identity-provider/index.js +14 -0
  142. package/identity-provider/index.js.map +1 -0
  143. package/identity-provider/presets.d.ts +65 -0
  144. package/identity-provider/presets.d.ts.map +1 -0
  145. package/identity-provider/presets.js +200 -0
  146. package/identity-provider/presets.js.map +1 -0
  147. package/identity-provider/useCreateIdentityProvider.d.ts +37 -0
  148. package/identity-provider/useCreateIdentityProvider.d.ts.map +1 -0
  149. package/identity-provider/useCreateIdentityProvider.js +48 -0
  150. package/identity-provider/useCreateIdentityProvider.js.map +1 -0
  151. package/identity-provider/useDeleteIdentityProvider.d.ts +34 -0
  152. package/identity-provider/useDeleteIdentityProvider.d.ts.map +1 -0
  153. package/identity-provider/useDeleteIdentityProvider.js +45 -0
  154. package/identity-provider/useDeleteIdentityProvider.js.map +1 -0
  155. package/identity-provider/useIdentityProvider.d.ts +37 -0
  156. package/identity-provider/useIdentityProvider.d.ts.map +1 -0
  157. package/identity-provider/useIdentityProvider.js +62 -0
  158. package/identity-provider/useIdentityProvider.js.map +1 -0
  159. package/identity-provider/useIdentityProviderList.d.ts +48 -0
  160. package/identity-provider/useIdentityProviderList.d.ts.map +1 -0
  161. package/identity-provider/useIdentityProviderList.js +75 -0
  162. package/identity-provider/useIdentityProviderList.js.map +1 -0
  163. package/identity-provider/useOidcDiscovery.d.ts +39 -0
  164. package/identity-provider/useOidcDiscovery.d.ts.map +1 -0
  165. package/identity-provider/useOidcDiscovery.js +76 -0
  166. package/identity-provider/useOidcDiscovery.js.map +1 -0
  167. package/identity-provider/useSsoProvider.d.ts +50 -0
  168. package/identity-provider/useSsoProvider.d.ts.map +1 -0
  169. package/identity-provider/useSsoProvider.js +83 -0
  170. package/identity-provider/useSsoProvider.js.map +1 -0
  171. package/identity-provider/useUpdateIdentityProvider.d.ts +38 -0
  172. package/identity-provider/useUpdateIdentityProvider.d.ts.map +1 -0
  173. package/identity-provider/useUpdateIdentityProvider.js +49 -0
  174. package/identity-provider/useUpdateIdentityProvider.js.map +1 -0
  175. package/index.d.ts +14 -5
  176. package/index.d.ts.map +1 -1
  177. package/index.js +10 -2
  178. package/index.js.map +1 -1
  179. package/internal/CloudFeatureNotice.d.ts +12 -0
  180. package/internal/CloudFeatureNotice.d.ts.map +1 -1
  181. package/internal/CloudFeatureNotice.js +12 -0
  182. package/internal/CloudFeatureNotice.js.map +1 -1
  183. package/invitation/InvitationCreatedAlert.d.ts +35 -0
  184. package/invitation/InvitationCreatedAlert.d.ts.map +1 -0
  185. package/invitation/InvitationCreatedAlert.js +60 -0
  186. package/invitation/InvitationCreatedAlert.js.map +1 -0
  187. package/invitation/InvitationManager.d.ts +44 -0
  188. package/invitation/InvitationManager.d.ts.map +1 -0
  189. package/invitation/InvitationManager.js +248 -0
  190. package/invitation/InvitationManager.js.map +1 -0
  191. package/invitation/InvitationRedemption.d.ts +69 -0
  192. package/invitation/InvitationRedemption.d.ts.map +1 -0
  193. package/invitation/InvitationRedemption.js +140 -0
  194. package/invitation/InvitationRedemption.js.map +1 -0
  195. package/invitation/index.d.ts +17 -0
  196. package/invitation/index.d.ts.map +1 -0
  197. package/invitation/index.js +9 -0
  198. package/invitation/index.js.map +1 -0
  199. package/invitation/useCreateInvitation.d.ts +52 -0
  200. package/invitation/useCreateInvitation.d.ts.map +1 -0
  201. package/invitation/useCreateInvitation.js +55 -0
  202. package/invitation/useCreateInvitation.js.map +1 -0
  203. package/invitation/useInvitationPreview.d.ts +51 -0
  204. package/invitation/useInvitationPreview.d.ts.map +1 -0
  205. package/invitation/useInvitationPreview.js +80 -0
  206. package/invitation/useInvitationPreview.js.map +1 -0
  207. package/invitation/useOrgInvitations.d.ts +36 -0
  208. package/invitation/useOrgInvitations.d.ts.map +1 -0
  209. package/invitation/useOrgInvitations.js +65 -0
  210. package/invitation/useOrgInvitations.js.map +1 -0
  211. package/invitation/useRedeemInvitation.d.ts +47 -0
  212. package/invitation/useRedeemInvitation.d.ts.map +1 -0
  213. package/invitation/useRedeemInvitation.js +53 -0
  214. package/invitation/useRedeemInvitation.js.map +1 -0
  215. package/invitation/useRevokeInvitation.d.ts +35 -0
  216. package/invitation/useRevokeInvitation.d.ts.map +1 -0
  217. package/invitation/useRevokeInvitation.js +47 -0
  218. package/invitation/useRevokeInvitation.js.map +1 -0
  219. package/library/detect-skill-package.d.ts +1 -0
  220. package/library/detect-skill-package.d.ts.map +1 -1
  221. package/library/detect-skill-package.js.map +1 -1
  222. package/library/detect-stigmer-resource.d.ts +1 -0
  223. package/library/detect-stigmer-resource.d.ts.map +1 -1
  224. package/library/detect-stigmer-resource.js.map +1 -1
  225. package/library/parse-resource-yaml.d.ts +4 -0
  226. package/library/parse-resource-yaml.d.ts.map +1 -1
  227. package/library/parse-resource-yaml.js.map +1 -1
  228. package/mcp-server/McpServerDetailView.d.ts +2 -2
  229. package/mcp-server/McpServerDetailView.d.ts.map +1 -1
  230. package/mcp-server/McpServerDetailView.js.map +1 -1
  231. package/mcp-server/index.d.ts +1 -1
  232. package/mcp-server/index.d.ts.map +1 -1
  233. package/mcp-server/index.js.map +1 -1
  234. package/mcp-server/mcpServerSetupReducer.d.ts +54 -0
  235. package/mcp-server/mcpServerSetupReducer.d.ts.map +1 -1
  236. package/mcp-server/mcpServerSetupReducer.js.map +1 -1
  237. package/models/ModelSelector.d.ts +9 -0
  238. package/models/ModelSelector.d.ts.map +1 -1
  239. package/models/ModelSelector.js +9 -0
  240. package/models/ModelSelector.js.map +1 -1
  241. package/models/registry.d.ts +11 -1
  242. package/models/registry.d.ts.map +1 -1
  243. package/models/registry.js.map +1 -1
  244. package/models/useModelRegistry.d.ts +20 -0
  245. package/models/useModelRegistry.d.ts.map +1 -1
  246. package/models/useModelRegistry.js +20 -0
  247. package/models/useModelRegistry.js.map +1 -1
  248. package/organization/OrgProfilePanel.d.ts +31 -0
  249. package/organization/OrgProfilePanel.d.ts.map +1 -0
  250. package/organization/OrgProfilePanel.js +147 -0
  251. package/organization/OrgProfilePanel.js.map +1 -0
  252. package/organization/index.d.ts +6 -0
  253. package/organization/index.d.ts.map +1 -1
  254. package/organization/index.js +3 -0
  255. package/organization/index.js.map +1 -1
  256. package/organization/useOrganization.d.ts +31 -0
  257. package/organization/useOrganization.d.ts.map +1 -0
  258. package/organization/useOrganization.js +56 -0
  259. package/organization/useOrganization.js.map +1 -0
  260. package/organization/useUpdateOrganization.d.ts +40 -0
  261. package/organization/useUpdateOrganization.d.ts.map +1 -0
  262. package/organization/useUpdateOrganization.js +51 -0
  263. package/organization/useUpdateOrganization.js.map +1 -0
  264. package/package.json +4 -4
  265. package/provider.d.ts +1 -0
  266. package/provider.d.ts.map +1 -1
  267. package/provider.js.map +1 -1
  268. package/search/useResourceList.d.ts +4 -2
  269. package/search/useResourceList.d.ts.map +1 -1
  270. package/search/useResourceList.js +2 -1
  271. package/search/useResourceList.js.map +1 -1
  272. package/search/useResourceSearch.d.ts +10 -2
  273. package/search/useResourceSearch.d.ts.map +1 -1
  274. package/search/useResourceSearch.js +2 -1
  275. package/search/useResourceSearch.js.map +1 -1
  276. package/session/group-sessions.d.ts +23 -0
  277. package/session/group-sessions.d.ts.map +1 -1
  278. package/session/group-sessions.js +23 -0
  279. package/session/group-sessions.js.map +1 -1
  280. package/session/index.d.ts +1 -1
  281. package/session/index.d.ts.map +1 -1
  282. package/session/index.js.map +1 -1
  283. package/session/useCreateSession.d.ts +11 -2
  284. package/session/useCreateSession.d.ts.map +1 -1
  285. package/session/useCreateSession.js.map +1 -1
  286. package/session/useSession.d.ts +24 -0
  287. package/session/useSession.d.ts.map +1 -1
  288. package/session/useSession.js +24 -0
  289. package/session/useSession.js.map +1 -1
  290. package/session/useSessionArtifacts.d.ts +1 -0
  291. package/session/useSessionArtifacts.d.ts.map +1 -1
  292. package/session/useSessionArtifacts.js.map +1 -1
  293. package/session/useSessionConversation.d.ts +7 -0
  294. package/session/useSessionConversation.d.ts.map +1 -1
  295. package/session/useSessionConversation.js.map +1 -1
  296. package/session/useSessionExecutions.d.ts +23 -0
  297. package/session/useSessionExecutions.d.ts.map +1 -1
  298. package/session/useSessionExecutions.js +23 -0
  299. package/session/useSessionExecutions.js.map +1 -1
  300. package/session/useSessionList.d.ts +19 -0
  301. package/session/useSessionList.d.ts.map +1 -1
  302. package/session/useSessionList.js +19 -0
  303. package/session/useSessionList.js.map +1 -1
  304. package/session/useSessionWriteBacks.d.ts +1 -0
  305. package/session/useSessionWriteBacks.d.ts.map +1 -1
  306. package/session/useSessionWriteBacks.js.map +1 -1
  307. package/session/useUpdateSession.d.ts +22 -0
  308. package/session/useUpdateSession.d.ts.map +1 -1
  309. package/session/useUpdateSession.js +22 -0
  310. package/session/useUpdateSession.js.map +1 -1
  311. package/skill/SkillPicker.d.ts +15 -0
  312. package/skill/SkillPicker.d.ts.map +1 -1
  313. package/skill/SkillPicker.js +15 -0
  314. package/skill/SkillPicker.js.map +1 -1
  315. package/src/agent/AgentEnvForm.tsx +2 -0
  316. package/src/agent/AgentPicker.tsx +2 -0
  317. package/src/agent/agentSetupReducer.ts +109 -20
  318. package/src/agent/useAgentCount.ts +2 -0
  319. package/src/attachment/AttachmentChipList.tsx +15 -0
  320. package/src/attachment/useAttachments.ts +14 -0
  321. package/src/composer/useComposer.ts +5 -0
  322. package/src/execution/ExecutionPhaseBadge.tsx +1 -1
  323. package/src/execution/McpToolDetail.tsx +18 -6
  324. package/src/execution/TodoList.tsx +8 -0
  325. package/src/execution/ToolArgsView.tsx +1 -0
  326. package/src/execution/UsageWidget.tsx +1 -1
  327. package/src/execution/file-path-resolver.ts +28 -4
  328. package/src/execution/index.ts +5 -1
  329. package/src/execution/useArtifactContent.ts +33 -0
  330. package/src/execution/useSubmitApproval.ts +2 -0
  331. package/src/github/GitHubRepoPicker.tsx +13 -0
  332. package/src/github/useGitHubConnection.ts +29 -1
  333. package/src/github/useGitHubRepos.ts +31 -0
  334. package/src/github/useGitHubSearch.ts +25 -0
  335. package/src/iam-policy/GrantAccessForm.tsx +198 -0
  336. package/src/iam-policy/OrgMembersPanel.tsx +572 -0
  337. package/src/iam-policy/RoleSelector.tsx +105 -0
  338. package/src/iam-policy/index.ts +51 -0
  339. package/src/iam-policy/useCreateIamPolicy.ts +66 -0
  340. package/src/iam-policy/useDeleteIamPolicy.ts +65 -0
  341. package/src/iam-policy/useGrantableRoles.ts +45 -0
  342. package/src/iam-policy/usePrincipalsCount.ts +96 -0
  343. package/src/iam-policy/useResourceAccess.ts +128 -0
  344. package/src/iam-policy/useRevokeOrgAccess.ts +74 -0
  345. package/src/iam-policy/useRoleSelector.ts +97 -0
  346. package/src/iam-policy/useWhoAmI.ts +78 -0
  347. package/src/identity-provider/CreateIdentityProviderForm.tsx +308 -0
  348. package/src/identity-provider/IdentityProviderDetailPanel.tsx +583 -0
  349. package/src/identity-provider/IdentityProviderListPanel.tsx +370 -0
  350. package/src/identity-provider/IdentityProviderWizard.tsx +684 -0
  351. package/src/identity-provider/ProviderPicker.tsx +152 -0
  352. package/src/identity-provider/SsoLoginPrompt.tsx +404 -0
  353. package/src/identity-provider/index.ts +67 -0
  354. package/src/identity-provider/presets.ts +262 -0
  355. package/src/identity-provider/useCreateIdentityProvider.ts +68 -0
  356. package/src/identity-provider/useDeleteIdentityProvider.ts +65 -0
  357. package/src/identity-provider/useIdentityProvider.ts +86 -0
  358. package/src/identity-provider/useIdentityProviderList.ts +100 -0
  359. package/src/identity-provider/useOidcDiscovery.ts +124 -0
  360. package/src/identity-provider/useSsoProvider.ts +99 -0
  361. package/src/identity-provider/useUpdateIdentityProvider.ts +69 -0
  362. package/src/index.ts +121 -1
  363. package/src/internal/CloudFeatureNotice.tsx +12 -0
  364. package/src/invitation/InvitationCreatedAlert.tsx +185 -0
  365. package/src/invitation/InvitationManager.tsx +842 -0
  366. package/src/invitation/InvitationRedemption.tsx +434 -0
  367. package/src/invitation/index.ts +16 -0
  368. package/src/invitation/useCreateInvitation.ts +83 -0
  369. package/src/invitation/useInvitationPreview.ts +103 -0
  370. package/src/invitation/useOrgInvitations.ts +88 -0
  371. package/src/invitation/useRedeemInvitation.ts +82 -0
  372. package/src/invitation/useRevokeInvitation.ts +66 -0
  373. package/src/library/detect-skill-package.ts +4 -1
  374. package/src/library/detect-stigmer-resource.ts +4 -1
  375. package/src/library/parse-resource-yaml.ts +12 -2
  376. package/src/mcp-server/McpServerDetailView.tsx +2 -1
  377. package/src/mcp-server/index.ts +4 -1
  378. package/src/mcp-server/mcpServerSetupReducer.ts +86 -8
  379. package/src/models/ModelSelector.tsx +9 -0
  380. package/src/models/registry.ts +11 -1
  381. package/src/models/useModelRegistry.ts +20 -0
  382. package/src/organization/OrgProfilePanel.tsx +451 -0
  383. package/src/organization/index.ts +6 -0
  384. package/src/organization/useOrganization.ts +79 -0
  385. package/src/organization/useUpdateOrganization.ts +71 -0
  386. package/src/provider.tsx +1 -0
  387. package/src/search/useResourceList.ts +6 -3
  388. package/src/search/useResourceSearch.ts +12 -3
  389. package/src/session/group-sessions.ts +23 -0
  390. package/src/session/index.ts +1 -0
  391. package/src/session/useCreateSession.ts +19 -3
  392. package/src/session/useSession.ts +24 -0
  393. package/src/session/useSessionArtifacts.ts +1 -0
  394. package/src/session/useSessionConversation.ts +7 -0
  395. package/src/session/useSessionExecutions.ts +23 -0
  396. package/src/session/useSessionList.ts +19 -0
  397. package/src/session/useSessionWriteBacks.ts +1 -0
  398. package/src/session/useUpdateSession.ts +22 -0
  399. package/src/skill/SkillPicker.tsx +15 -0
  400. package/src/usage/OrgUsagePanel.tsx +465 -0
  401. package/src/usage/date-range.ts +86 -0
  402. package/src/usage/index.ts +13 -0
  403. package/src/usage/useOrgUsageReport.ts +110 -0
  404. package/src/workspace/FolderBrowser.tsx +9 -0
  405. package/src/workspace/WorkspaceEditor.tsx +17 -0
  406. package/src/workspace/useFolderListing.ts +24 -0
  407. package/src/workspace/useWorkspaceEntries.ts +38 -0
  408. package/styles.css +1 -1
  409. package/usage/OrgUsagePanel.d.ts +24 -0
  410. package/usage/OrgUsagePanel.d.ts.map +1 -0
  411. package/usage/OrgUsagePanel.js +134 -0
  412. package/usage/OrgUsagePanel.js.map +1 -0
  413. package/usage/date-range.d.ts +36 -0
  414. package/usage/date-range.d.ts.map +1 -0
  415. package/usage/date-range.js +69 -0
  416. package/usage/date-range.js.map +1 -0
  417. package/usage/index.d.ts +7 -0
  418. package/usage/index.d.ts.map +1 -0
  419. package/usage/index.js +4 -0
  420. package/usage/index.js.map +1 -0
  421. package/usage/useOrgUsageReport.d.ts +48 -0
  422. package/usage/useOrgUsageReport.d.ts.map +1 -0
  423. package/usage/useOrgUsageReport.js +72 -0
  424. package/usage/useOrgUsageReport.js.map +1 -0
  425. package/workspace/FolderBrowser.d.ts +9 -0
  426. package/workspace/FolderBrowser.d.ts.map +1 -1
  427. package/workspace/FolderBrowser.js +9 -0
  428. package/workspace/FolderBrowser.js.map +1 -1
  429. package/workspace/WorkspaceEditor.d.ts +17 -0
  430. package/workspace/WorkspaceEditor.d.ts.map +1 -1
  431. package/workspace/WorkspaceEditor.js +17 -0
  432. package/workspace/WorkspaceEditor.js.map +1 -1
  433. package/workspace/useFolderListing.d.ts +24 -0
  434. package/workspace/useFolderListing.d.ts.map +1 -1
  435. package/workspace/useFolderListing.js +24 -0
  436. package/workspace/useFolderListing.js.map +1 -1
  437. package/workspace/useWorkspaceEntries.d.ts +38 -0
  438. package/workspace/useWorkspaceEntries.d.ts.map +1 -1
  439. package/workspace/useWorkspaceEntries.js +25 -0
  440. package/workspace/useWorkspaceEntries.js.map +1 -1
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useState } from "react";
4
+ import { cn } from "@stigmer/theme";
5
+ /**
6
+ * One-time banner displayed after a new invitation link is created.
7
+ *
8
+ * Shows the invite URL in a monospace read-only field with a **Copy**
9
+ * button. While invite URLs are always retrievable from the invitation
10
+ * list, surfacing the URL immediately after creation provides the
11
+ * critical "copy and share" moment that admins expect.
12
+ *
13
+ * This is a standalone alert component, not a modal — the parent
14
+ * decides how to present and position it.
15
+ *
16
+ * All visual properties flow through `--stgm-*` design tokens.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <InvitationCreatedAlert
21
+ * inviteUrl="https://app.stigmer.ai/invite/abc123..."
22
+ * label="Engineering team invite"
23
+ * onDismiss={() => setCreatedUrl(null)}
24
+ * />
25
+ * ```
26
+ */
27
+ export function InvitationCreatedAlert({ inviteUrl, label, onDismiss, className, }) {
28
+ const [copied, setCopied] = useState(false);
29
+ const handleCopy = useCallback(async () => {
30
+ try {
31
+ await navigator.clipboard.writeText(inviteUrl);
32
+ setCopied(true);
33
+ setTimeout(() => setCopied(false), 2000);
34
+ }
35
+ catch {
36
+ const el = document.getElementById("stgm-invite-url-reveal");
37
+ if (el) {
38
+ const selection = window.getSelection();
39
+ const range = document.createRange();
40
+ range.selectNodeContents(el);
41
+ selection?.removeAllRanges();
42
+ selection?.addRange(range);
43
+ }
44
+ }
45
+ }, [inviteUrl]);
46
+ return (_jsxs("div", { role: "alert", className: cn("rounded-lg border border-primary/30 bg-primary-subtle p-4", className), children: [_jsxs("div", { className: "mb-2 flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("p", { className: "text-sm font-medium text-foreground", children: ["Invite link created: ", label] }), _jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: "Share this link to invite people to your organization." })] }), _jsx("button", { type: "button", onClick: onDismiss, "aria-label": "Dismiss", className: cn("shrink-0 rounded p-1", "text-muted-foreground hover:text-foreground hover:bg-accent/50", "transition-colors"), children: _jsx(CloseIcon, {}) })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("code", { id: "stgm-invite-url-reveal", className: cn("min-w-0 flex-1 select-all truncate rounded-md", "border border-input bg-background px-2.5 py-1.5", "font-mono text-xs text-foreground"), children: inviteUrl }), _jsxs("button", { type: "button", onClick: handleCopy, className: cn("inline-flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium", "bg-primary text-primary-foreground hover:bg-primary/90", "transition-colors"), children: [copied ? _jsx(CheckIcon, {}) : _jsx(CopyIcon, {}), copied ? "Copied" : "Copy"] })] })] }));
47
+ }
48
+ // ---------------------------------------------------------------------------
49
+ // Icons
50
+ // ---------------------------------------------------------------------------
51
+ function CopyIcon() {
52
+ return (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("rect", { x: "5", y: "5", width: "9", height: "9", rx: "1.5" }), _jsx("path", { d: "M5 11H3.5A1.5 1.5 0 0 1 2 9.5V3.5A1.5 1.5 0 0 1 3.5 2h6A1.5 1.5 0 0 1 11 3.5V5" })] }));
53
+ }
54
+ function CheckIcon() {
55
+ return (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M3 8.5l3.5 3.5L13 5" }) }));
56
+ }
57
+ function CloseIcon() {
58
+ return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) }));
59
+ }
60
+ //# sourceMappingURL=InvitationCreatedAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationCreatedAlert.js","sourceRoot":"","sources":["../../src/invitation/InvitationCreatedAlert.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAkBpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,GACmB;IAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC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,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,iBACT,MAAM,YAElB,eAAM,CAAC,EAAC,oBAAoB,GAAG,GAC3B,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** Props for {@link InvitationManager}. */
2
+ export interface InvitationManagerProps {
3
+ /** Organization slug whose invitations to manage. */
4
+ readonly org: string;
5
+ /**
6
+ * Build the full invite URL from a token.
7
+ *
8
+ * Platform builders override this when their invite route differs
9
+ * from the default `/invite/<token>` path or runs on a different
10
+ * domain.
11
+ *
12
+ * @default `${window.location.origin}/invite/${token}`
13
+ */
14
+ readonly buildInviteUrl?: (token: string) => string;
15
+ /** Additional CSS class names for the root container. */
16
+ readonly className?: string;
17
+ }
18
+ /**
19
+ * Self-contained panel for managing organization invitation links.
20
+ *
21
+ * Displays all invitations for the organization with inline actions
22
+ * (copy link, revoke) and a create form for generating new invite
23
+ * links. Follows the same pattern as {@link OrgMembersPanel}: a
24
+ * single embeddable component that handles the full management flow.
25
+ *
26
+ * The component composes three invitation hooks internally:
27
+ * - {@link useOrgInvitations} for listing
28
+ * - {@link useCreateInvitation} for creation
29
+ * - {@link useRevokeInvitation} for revocation
30
+ *
31
+ * All visual properties flow through `--stgm-*` design tokens.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * <InvitationManager org="acme" />
36
+ *
37
+ * <InvitationManager
38
+ * org="acme"
39
+ * buildInviteUrl={(token) => `https://myapp.com/join/${token}`}
40
+ * />
41
+ * ```
42
+ */
43
+ export declare function InvitationManager({ org, buildInviteUrl, className, }: InvitationManagerProps): import("react/jsx-runtime").JSX.Element;
44
+ //# sourceMappingURL=InvitationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationManager.d.ts","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AAuBA,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,cAAsC,EACtC,SAAS,GACV,EAAE,sBAAsB,2CA2HxB"}
@@ -0,0 +1,248 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useState } from "react";
4
+ import { cn } from "@stigmer/theme";
5
+ import { getUserMessage, iamRoleDisplayName, } from "@stigmer/sdk";
6
+ import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
7
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
8
+ import { InvitationState } from "@stigmer/protos/ai/stigmer/iam/invitation/v1/enum_pb";
9
+ import { timestampDate } from "@bufbuild/protobuf/wkt";
10
+ import { useOrgInvitations } from "./useOrgInvitations";
11
+ import { useCreateInvitation } from "./useCreateInvitation";
12
+ import { useRevokeInvitation } from "./useRevokeInvitation";
13
+ import { InvitationCreatedAlert } from "./InvitationCreatedAlert";
14
+ import { RoleSelector } from "../iam-policy/RoleSelector";
15
+ function defaultBuildInviteUrl(token) {
16
+ if (typeof window !== "undefined") {
17
+ return `${window.location.origin}/invite/${token}`;
18
+ }
19
+ return `/invite/${token}`;
20
+ }
21
+ /**
22
+ * Self-contained panel for managing organization invitation links.
23
+ *
24
+ * Displays all invitations for the organization with inline actions
25
+ * (copy link, revoke) and a create form for generating new invite
26
+ * links. Follows the same pattern as {@link OrgMembersPanel}: a
27
+ * single embeddable component that handles the full management flow.
28
+ *
29
+ * The component composes three invitation hooks internally:
30
+ * - {@link useOrgInvitations} for listing
31
+ * - {@link useCreateInvitation} for creation
32
+ * - {@link useRevokeInvitation} for revocation
33
+ *
34
+ * All visual properties flow through `--stgm-*` design tokens.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <InvitationManager org="acme" />
39
+ *
40
+ * <InvitationManager
41
+ * org="acme"
42
+ * buildInviteUrl={(token) => `https://myapp.com/join/${token}`}
43
+ * />
44
+ * ```
45
+ */
46
+ export function InvitationManager({ org, buildInviteUrl = defaultBuildInviteUrl, className, }) {
47
+ const { invitations, isLoading, error, refetch } = useOrgInvitations(org);
48
+ const [flow, setFlow] = useState({ phase: "idle" });
49
+ const [revokingId, setRevokingId] = useState(null);
50
+ const activeCount = invitations.filter((inv) => inv.status?.state === InvitationState.active).length;
51
+ const handleCreated = useCallback((invitation) => {
52
+ const token = invitation.status?.token ?? "";
53
+ const label = invitation.spec?.label || invitation.metadata?.name || "Invite link";
54
+ setFlow({ phase: "created", inviteUrl: buildInviteUrl(token), label });
55
+ refetch();
56
+ }, [buildInviteUrl, refetch]);
57
+ const handleRevoked = useCallback(() => {
58
+ setRevokingId(null);
59
+ refetch();
60
+ }, [refetch]);
61
+ if (isLoading) {
62
+ return (_jsx("div", { className: cn("space-y-2", className), "aria-busy": "true", "aria-label": "Loading invitations", children: Array.from({ length: 2 }, (_, i) => (_jsx("div", { className: "bg-muted/40 h-14 animate-pulse rounded-lg" }, i))) }));
63
+ }
64
+ if (error) {
65
+ return (_jsx("p", { className: cn("text-destructive text-xs", className), role: "alert", children: getUserMessage(error) }));
66
+ }
67
+ return (_jsxs("div", { className: cn("space-y-3", className), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-semibold text-foreground", children: "Invite Links" }), activeCount > 0 && (_jsxs("span", { className: "inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[0.65rem] font-medium text-muted-foreground", children: [activeCount, " active"] }))] }), flow.phase === "idle" && (_jsx("button", { type: "button", onClick: () => setFlow({ phase: "creating" }), className: "text-primary hover:text-foreground text-xs font-medium transition-colors", children: "+ Create invite link" }))] }), flow.phase === "created" && (_jsx(InvitationCreatedAlert, { inviteUrl: flow.inviteUrl, label: flow.label, onDismiss: () => setFlow({ phase: "idle" }) })), flow.phase === "creating" && (_jsx("div", { className: "border-border bg-card rounded-lg border p-4", children: _jsx(CreateInvitationForm, { org: org, onCreated: handleCreated, onCancel: () => setFlow({ phase: "idle" }) }) })), invitations.length === 0 ? (_jsx("p", { className: "text-muted-foreground py-4 text-center text-xs", children: "No invite links yet. Create one to start inviting people." })) : (_jsx("div", { role: "list", "aria-label": "Invitation links", className: "space-y-2", children: invitations.map((inv) => {
68
+ const id = inv.metadata?.id ?? "";
69
+ return (_jsx(InvitationRow, { invitation: inv, buildInviteUrl: buildInviteUrl, isRevoking: revokingId === id, onStartRevoke: () => setRevokingId(id), onCancelRevoke: () => setRevokingId(null), onRevoked: handleRevoked }, id));
70
+ }) }))] }));
71
+ }
72
+ const EXPIRY_OPTIONS = [
73
+ { value: "7", label: "7 days" },
74
+ { value: "14", label: "14 days" },
75
+ { value: "30", label: "30 days" },
76
+ ];
77
+ function CreateInvitationForm({ org, onCreated, onCancel, }) {
78
+ const { create, isCreating, error, clearError } = useCreateInvitation();
79
+ const [label, setLabel] = useState("");
80
+ const [role, setRole] = useState(IamRole.viewer);
81
+ const [expiry, setExpiry] = useState("30");
82
+ const [redemptionMode, setRedemptionMode] = useState("unlimited");
83
+ const canSubmit = !isCreating;
84
+ const handleSubmit = useCallback(async (e) => {
85
+ e.preventDefault();
86
+ if (!canSubmit)
87
+ return;
88
+ clearError();
89
+ try {
90
+ const invitation = await create({
91
+ name: label.trim() || `invite-${Date.now()}`,
92
+ org,
93
+ role,
94
+ expiresAt: daysFromNow(Number(expiry)),
95
+ maxRedemptions: redemptionMode === "single" ? 1 : 0,
96
+ label: label.trim() || undefined,
97
+ });
98
+ onCreated(invitation);
99
+ }
100
+ catch {
101
+ // error state is managed by useCreateInvitation
102
+ }
103
+ }, [canSubmit, label, org, role, expiry, redemptionMode, create, clearError, onCreated]);
104
+ return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("label", { htmlFor: "stgm-new-invite-label", className: "text-xs font-medium text-foreground", children: ["Label", " ", _jsx("span", { className: "font-normal text-muted-foreground", children: "(optional)" })] }), _jsx("input", { id: "stgm-new-invite-label", type: "text", value: label, onChange: (e) => setLabel(e.target.value), placeholder: "e.g. Engineering team link", disabled: isCreating, autoFocus: true, maxLength: 200, className: cn("w-full rounded-md border border-input bg-background px-2.5 py-1.5 text-xs text-foreground", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50") })] }), _jsx(RoleSelector, { kind: ApiResourceKind.organization, selected: role, onSelect: (r) => setRole(r), disabled: isCreating }), _jsxs("fieldset", { className: "space-y-1.5", children: [_jsx("legend", { className: "text-xs font-medium text-foreground", children: "Expires in" }), _jsx("div", { className: "flex flex-wrap gap-2", children: EXPIRY_OPTIONS.map(({ value, label: optLabel }) => (_jsx(ExpiryRadio, { value: value, label: optLabel, checked: expiry === value, disabled: isCreating, onChange: setExpiry }, value))) })] }), _jsxs("fieldset", { className: "space-y-1.5", children: [_jsx("legend", { className: "text-xs font-medium text-foreground", children: "Usage limit" }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(RedemptionRadio, { value: "unlimited", label: "Unlimited", description: "Anyone with the link can join", checked: redemptionMode === "unlimited", disabled: isCreating, onChange: setRedemptionMode }), _jsx(RedemptionRadio, { value: "single", label: "Single use", description: "One person only", checked: redemptionMode === "single", disabled: isCreating, onChange: setRedemptionMode })] })] }), error && (_jsx("p", { className: "text-destructive text-[0.65rem]", role: "alert", children: getUserMessage(error) })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("button", { type: "submit", disabled: !canSubmit, className: cn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium", "bg-primary text-primary-foreground hover:bg-primary/90", "disabled:pointer-events-none disabled:opacity-40"), children: [isCreating && _jsx(SpinnerIcon, {}), "Create invite link"] }), _jsx("button", { type: "button", onClick: onCancel, disabled: isCreating, className: cn("rounded-md px-3 py-1.5 text-xs", "text-muted-foreground hover:text-foreground hover:bg-accent/50", "disabled:pointer-events-none disabled:opacity-50"), children: "Cancel" })] })] }));
105
+ }
106
+ // ---------------------------------------------------------------------------
107
+ // InvitationRow (internal)
108
+ // ---------------------------------------------------------------------------
109
+ function InvitationRow({ invitation, buildInviteUrl, isRevoking, onStartRevoke, onCancelRevoke, onRevoked, }) {
110
+ const [copied, setCopied] = useState(false);
111
+ const id = invitation.metadata?.id ?? "";
112
+ const label = invitation.spec?.label || invitation.metadata?.name || "Unnamed invite";
113
+ const role = invitation.spec?.role ?? IamRole.iam_role_unspecified;
114
+ const state = invitation.status?.state ?? InvitationState.invitation_state_unspecified;
115
+ const token = invitation.status?.token ?? "";
116
+ const redemptionCount = invitation.status?.redemptionCount ?? 0;
117
+ const maxRedemptions = invitation.spec?.maxRedemptions ?? 0;
118
+ const expiresAt = invitation.spec?.expiresAt;
119
+ const isActive = state === InvitationState.active;
120
+ const handleCopy = useCallback(async () => {
121
+ try {
122
+ await navigator.clipboard.writeText(buildInviteUrl(token));
123
+ setCopied(true);
124
+ setTimeout(() => setCopied(false), 2000);
125
+ }
126
+ catch {
127
+ // silently fail — copy is a convenience, not critical
128
+ }
129
+ }, [token, buildInviteUrl]);
130
+ if (isRevoking) {
131
+ return (_jsx(RevokeConfirmation, { invitationId: id, label: label, onRevoked: onRevoked, onCancel: onCancelRevoke }));
132
+ }
133
+ return (_jsxs("div", { role: "listitem", className: "flex items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5 hover:border-border transition-colors", children: [_jsx(LinkIcon, { active: isActive }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: cn("block truncate text-sm font-medium", isActive ? "text-foreground" : "text-muted-foreground"), children: label }), _jsx("span", { className: "block text-xs text-muted-foreground", children: formatRedemptions(redemptionCount, maxRedemptions) })] }), _jsxs("div", { className: "hidden sm:flex shrink-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-2 py-0.5 text-[0.65rem] font-medium text-foreground", children: iamRoleDisplayName(role) }), _jsx(StateBadge, { state: state }), expiresAt && (_jsx("span", { className: "text-xs text-muted-foreground", title: timestampDate(expiresAt).toISOString(), children: isActive
134
+ ? formatRelativeExpiry(timestampDate(expiresAt))
135
+ : formatShortDate(timestampDate(expiresAt)) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [isActive && (_jsx("button", { type: "button", onClick: handleCopy, "aria-label": copied ? "Link copied" : `Copy invite link for ${label}`, className: cn("shrink-0 rounded p-1 transition-colors", copied
136
+ ? "text-primary"
137
+ : "text-muted-foreground hover:text-foreground hover:bg-accent/50"), children: copied ? _jsx(CheckIcon, {}) : _jsx(CopyIcon, {}) })), isActive && (_jsx("button", { type: "button", onClick: onStartRevoke, "aria-label": `Revoke ${label}`, className: "shrink-0 rounded p-1 text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors", children: _jsx(RevokeIcon, {}) }))] })] }));
138
+ }
139
+ // ---------------------------------------------------------------------------
140
+ // RevokeConfirmation (internal)
141
+ // ---------------------------------------------------------------------------
142
+ function RevokeConfirmation({ invitationId, label, onRevoked, onCancel, }) {
143
+ const { revoke, isRevoking, error } = useRevokeInvitation();
144
+ const handleConfirm = useCallback(async () => {
145
+ try {
146
+ await revoke(invitationId);
147
+ onRevoked();
148
+ }
149
+ catch {
150
+ // error state is surfaced via the hook
151
+ }
152
+ }, [invitationId, revoke, onRevoked]);
153
+ return (_jsxs("div", { role: "listitem", className: "flex items-center justify-between rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("p", { className: "text-xs text-foreground", children: ["Revoke ", _jsx("span", { className: "font-medium", children: label }), "? The link will stop working immediately."] }), error && (_jsx("p", { className: "mt-0.5 text-[0.65rem] text-destructive", children: getUserMessage(error) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1.5 ml-3", children: [_jsxs("button", { type: "button", onClick: handleConfirm, disabled: isRevoking, className: cn("inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium", "bg-destructive text-destructive-foreground hover:bg-destructive/90", "disabled:pointer-events-none disabled:opacity-50"), children: [isRevoking && _jsx(SpinnerIcon, {}), "Revoke"] }), _jsx("button", { type: "button", onClick: onCancel, disabled: isRevoking, className: cn("rounded-md px-2.5 py-1 text-xs", "text-muted-foreground hover:text-foreground hover:bg-accent/50", "disabled:pointer-events-none disabled:opacity-50"), children: "Cancel" })] })] }));
154
+ }
155
+ // ---------------------------------------------------------------------------
156
+ // StateBadge (internal)
157
+ // ---------------------------------------------------------------------------
158
+ function StateBadge({ state }) {
159
+ const config = STATE_BADGE_CONFIG[state] ?? STATE_BADGE_CONFIG[InvitationState.invitation_state_unspecified];
160
+ return (_jsx("span", { className: cn("inline-flex items-center rounded-full px-2 py-0.5 text-[0.6rem] font-medium", config.className), children: config.label }));
161
+ }
162
+ const STATE_BADGE_CONFIG = {
163
+ [InvitationState.invitation_state_unspecified]: {
164
+ label: "Unknown",
165
+ className: "bg-muted text-muted-foreground",
166
+ },
167
+ [InvitationState.active]: {
168
+ label: "Active",
169
+ className: "bg-primary-subtle text-primary",
170
+ },
171
+ [InvitationState.expired]: {
172
+ label: "Expired",
173
+ className: "bg-muted text-muted-foreground",
174
+ },
175
+ [InvitationState.revoked]: {
176
+ label: "Revoked",
177
+ className: "bg-muted text-muted-foreground",
178
+ },
179
+ [InvitationState.fully_redeemed]: {
180
+ label: "Fully redeemed",
181
+ className: "bg-muted text-muted-foreground",
182
+ },
183
+ };
184
+ // ---------------------------------------------------------------------------
185
+ // Radio helpers (internal)
186
+ // ---------------------------------------------------------------------------
187
+ function ExpiryRadio({ value, label, checked, disabled, onChange, }) {
188
+ return (_jsxs("label", { className: cn("inline-flex cursor-pointer items-center rounded-md border px-2.5 py-1 text-xs transition-colors", checked
189
+ ? "border-primary bg-primary-subtle text-primary font-medium"
190
+ : "border-input bg-background text-muted-foreground hover:border-border hover:text-foreground", disabled && "pointer-events-none opacity-50"), children: [_jsx("input", { type: "radio", name: "stgm-invite-expiry", value: value, checked: checked, disabled: disabled, onChange: () => onChange(value), className: "sr-only" }), label] }));
191
+ }
192
+ function RedemptionRadio({ value, label, description, checked, disabled, onChange, }) {
193
+ return (_jsxs("label", { className: cn("inline-flex cursor-pointer flex-col rounded-md border px-3 py-1.5 text-xs transition-colors", checked
194
+ ? "border-primary bg-primary-subtle text-primary font-medium"
195
+ : "border-input bg-background text-muted-foreground hover:border-border hover:text-foreground", disabled && "pointer-events-none opacity-50"), children: [_jsx("input", { type: "radio", name: "stgm-invite-redemption", value: value, checked: checked, disabled: disabled, onChange: () => onChange(value), className: "sr-only" }), _jsx("span", { children: label }), _jsx("span", { className: "text-[0.625rem] text-muted-foreground font-normal mt-0.5", children: description })] }));
196
+ }
197
+ // ---------------------------------------------------------------------------
198
+ // Formatting helpers
199
+ // ---------------------------------------------------------------------------
200
+ function daysFromNow(days) {
201
+ const date = new Date();
202
+ date.setDate(date.getDate() + days);
203
+ return date;
204
+ }
205
+ function formatRedemptions(count, max) {
206
+ if (max === 0) {
207
+ return count === 0 ? "No redemptions yet" : `${count} redeemed`;
208
+ }
209
+ return `${count} / ${max} redeemed`;
210
+ }
211
+ function formatRelativeExpiry(date) {
212
+ const now = Date.now();
213
+ const diffMs = date.getTime() - now;
214
+ if (diffMs <= 0)
215
+ return "Expired";
216
+ const days = Math.ceil(diffMs / 86_400_000);
217
+ if (days === 1)
218
+ return "Expires tomorrow";
219
+ if (days <= 30)
220
+ return `Expires in ${days} days`;
221
+ return `Expires ${formatShortDate(date)}`;
222
+ }
223
+ function formatShortDate(date) {
224
+ return date.toLocaleDateString(undefined, {
225
+ month: "short",
226
+ day: "numeric",
227
+ year: "numeric",
228
+ });
229
+ }
230
+ // ---------------------------------------------------------------------------
231
+ // Icons
232
+ // ---------------------------------------------------------------------------
233
+ function LinkIcon({ active }) {
234
+ return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className: cn("shrink-0", active ? "text-primary" : "text-muted-foreground"), children: [_jsx("path", { d: "M6.5 9.5a3.5 3.5 0 0 0 5 0l2-2a3.5 3.5 0 0 0-5-5l-1 1" }), _jsx("path", { d: "M9.5 6.5a3.5 3.5 0 0 0-5 0l-2 2a3.5 3.5 0 0 0 5 5l1-1" })] }));
235
+ }
236
+ function CopyIcon() {
237
+ return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("rect", { x: "5", y: "5", width: "9", height: "9", rx: "1.5" }), _jsx("path", { d: "M5 11H3.5A1.5 1.5 0 0 1 2 9.5V3.5A1.5 1.5 0 0 1 3.5 2h6A1.5 1.5 0 0 1 11 3.5V5" })] }));
238
+ }
239
+ function CheckIcon() {
240
+ return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M3 8.5l3.5 3.5L13 5" }) }));
241
+ }
242
+ function RevokeIcon() {
243
+ return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("circle", { cx: "8", cy: "8", r: "6" }), _jsx("path", { d: "M4.5 11.5l7-7" })] }));
244
+ }
245
+ function SpinnerIcon() {
246
+ return (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", className: "animate-spin", "aria-hidden": "true", children: _jsx("path", { d: "M8 2a6 6 0 1 0 6 6" }) }));
247
+ }
248
+ //# sourceMappingURL=InvitationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationManager.js","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAwB1D,SAAS,qBAAqB,CAAC,KAAa;IAC1C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,WAAW,KAAK,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,WAAW,KAAK,EAAE,CAAC;AAC5B,CAAC;AAOD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,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,oBAAoB,GAAG,GAC3B,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,69 @@
1
+ import type { Invitation } from "@stigmer/protos/ai/stigmer/iam/invitation/v1/api_pb";
2
+ /** Props for {@link InvitationRedemption}. */
3
+ export interface InvitationRedemptionProps {
4
+ /** The invitation token from the invite URL. */
5
+ readonly token: string;
6
+ /**
7
+ * Whether the current user is authenticated.
8
+ *
9
+ * When `false`, the component shows a "Sign in to accept" CTA
10
+ * instead of the accept button. When `true` or omitted, the
11
+ * accept button calls `redeem` directly.
12
+ *
13
+ * @default true
14
+ */
15
+ readonly isAuthenticated?: boolean;
16
+ /**
17
+ * Fired after the invitation is successfully redeemed.
18
+ *
19
+ * The returned {@link Invitation} contains the organization and
20
+ * role information needed for post-redemption navigation
21
+ * (e.g. redirecting to the org dashboard).
22
+ */
23
+ readonly onAccepted?: (invitation: Invitation) => void;
24
+ /**
25
+ * Fired when an unauthenticated user clicks "Sign in to accept".
26
+ *
27
+ * The host application controls what "sign in" means — this
28
+ * callback typically triggers a redirect to the login page with
29
+ * a return URL back to the invite page.
30
+ */
31
+ readonly onAuthRequired?: () => void;
32
+ /** Additional CSS class names for the root container. */
33
+ readonly className?: string;
34
+ }
35
+ /**
36
+ * Self-contained invite acceptance flow.
37
+ *
38
+ * Fetches the invitation preview by token (public endpoint, no auth
39
+ * required), displays the organization info and role being offered,
40
+ * and provides an accept button that redeems the invitation.
41
+ *
42
+ * Handles all states: loading, invalid (expired / revoked / fully
43
+ * redeemed), authentication required, redemption in flight,
44
+ * success, and error — with appropriate UX for each.
45
+ *
46
+ * The component is auth-agnostic: it delegates authentication
47
+ * decisions to the host application via `isAuthenticated` and
48
+ * `onAuthRequired` props. Platform builders who render this
49
+ * component only for authenticated users can ignore both props.
50
+ *
51
+ * All visual properties flow through `--stgm-*` design tokens.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * <InvitationRedemption
56
+ * token={tokenFromUrl}
57
+ * onAccepted={(inv) => router.push("/dashboard")}
58
+ * />
59
+ *
60
+ * <InvitationRedemption
61
+ * token={tokenFromUrl}
62
+ * isAuthenticated={!!currentUser}
63
+ * onAccepted={(inv) => router.push(`/org/${inv.metadata?.org}`)}
64
+ * onAuthRequired={() => router.push(`/login?return=/invite/${token}`)}
65
+ * />
66
+ * ```
67
+ */
68
+ export declare function InvitationRedemption({ token, isAuthenticated, onAccepted, onAuthRequired, className, }: InvitationRedemptionProps): import("react/jsx-runtime").JSX.Element;
69
+ //# sourceMappingURL=InvitationRedemption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationRedemption.d.ts","sourceRoot":"","sources":["../../src/invitation/InvitationRedemption.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qDAAqD,CAAC;AAStF,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACvD;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,eAAsB,EACtB,UAAU,EACV,cAAc,EACd,SAAS,GACV,EAAE,yBAAyB,2CAqK3B"}
@@ -0,0 +1,140 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useState } from "react";
4
+ import { cn } from "@stigmer/theme";
5
+ import { getUserMessage, iamRoleDisplayName } from "@stigmer/sdk";
6
+ import { timestampDate } from "@bufbuild/protobuf/wkt";
7
+ import { useInvitationPreview } from "./useInvitationPreview";
8
+ import { useRedeemInvitation } from "./useRedeemInvitation";
9
+ /**
10
+ * Self-contained invite acceptance flow.
11
+ *
12
+ * Fetches the invitation preview by token (public endpoint, no auth
13
+ * required), displays the organization info and role being offered,
14
+ * and provides an accept button that redeems the invitation.
15
+ *
16
+ * Handles all states: loading, invalid (expired / revoked / fully
17
+ * redeemed), authentication required, redemption in flight,
18
+ * success, and error — with appropriate UX for each.
19
+ *
20
+ * The component is auth-agnostic: it delegates authentication
21
+ * decisions to the host application via `isAuthenticated` and
22
+ * `onAuthRequired` props. Platform builders who render this
23
+ * component only for authenticated users can ignore both props.
24
+ *
25
+ * All visual properties flow through `--stgm-*` design tokens.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <InvitationRedemption
30
+ * token={tokenFromUrl}
31
+ * onAccepted={(inv) => router.push("/dashboard")}
32
+ * />
33
+ *
34
+ * <InvitationRedemption
35
+ * token={tokenFromUrl}
36
+ * isAuthenticated={!!currentUser}
37
+ * onAccepted={(inv) => router.push(`/org/${inv.metadata?.org}`)}
38
+ * onAuthRequired={() => router.push(`/login?return=/invite/${token}`)}
39
+ * />
40
+ * ```
41
+ */
42
+ export function InvitationRedemption({ token, isAuthenticated = true, onAccepted, onAuthRequired, className, }) {
43
+ const { preview, isLoading, error: fetchError, refetch } = useInvitationPreview(token);
44
+ const { redeem, isRedeeming, error: redeemError, clearError } = useRedeemInvitation();
45
+ const [accepted, setAccepted] = useState(null);
46
+ const handleAccept = useCallback(async () => {
47
+ clearError();
48
+ try {
49
+ const invitation = await redeem(token);
50
+ setAccepted(invitation);
51
+ onAccepted?.(invitation);
52
+ }
53
+ catch {
54
+ // error state is managed by useRedeemInvitation
55
+ }
56
+ }, [token, redeem, clearError, onAccepted]);
57
+ // Loading state
58
+ if (isLoading) {
59
+ return (_jsx("div", { className: cn("mx-auto max-w-sm", className), "aria-busy": "true", "aria-label": "Loading invitation", children: _jsx(LoadingSkeleton, {}) }));
60
+ }
61
+ // Fetch error
62
+ if (fetchError) {
63
+ return (_jsx("div", { className: cn("mx-auto max-w-sm", className), children: _jsx(ErrorCard, { message: getUserMessage(fetchError), onRetry: refetch }) }));
64
+ }
65
+ // No preview returned
66
+ if (!preview) {
67
+ return (_jsx("div", { className: cn("mx-auto max-w-sm", className), children: _jsx(ErrorCard, { message: "This invitation could not be found." }) }));
68
+ }
69
+ // Redemption success
70
+ if (accepted) {
71
+ const orgName = preview.organizationName || "the organization";
72
+ const roleName = iamRoleDisplayName(preview.role);
73
+ return (_jsx("div", { className: cn("mx-auto max-w-sm", className), children: _jsxs("div", { className: "rounded-lg border border-primary/30 bg-primary-subtle p-6 text-center", children: [_jsx(SuccessIcon, {}), _jsxs("h2", { className: "mt-3 text-base font-semibold text-foreground", children: ["You\u2019ve joined ", orgName] }), _jsxs("p", { className: "mt-1 text-sm text-muted-foreground", children: ["You now have ", _jsx("span", { className: "font-medium text-foreground", children: roleName }), " access."] })] }) }));
74
+ }
75
+ const orgName = preview.organizationName || "Unknown organization";
76
+ const orgLogo = preview.organizationLogoUrl;
77
+ const orgInitial = orgName.charAt(0).toUpperCase();
78
+ const roleName = iamRoleDisplayName(preview.role);
79
+ const expiresAt = preview.expiresAt ? timestampDate(preview.expiresAt) : null;
80
+ return (_jsx("div", { className: cn("mx-auto max-w-sm", className), children: _jsxs("div", { className: "rounded-lg border border-border bg-card p-6", children: [_jsxs("div", { className: "flex flex-col items-center text-center", children: [orgLogo ? (_jsx("img", { src: orgLogo, alt: `${orgName} logo`, className: "size-12 rounded-full object-cover" })) : (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-muted text-lg font-semibold text-muted-foreground", children: orgInitial })), _jsxs("h2", { className: "mt-3 text-base font-semibold text-foreground", children: ["Join ", orgName] }), preview.label && (_jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: preview.label }))] }), _jsxs("div", { className: "mt-4 flex items-center justify-center gap-3 text-xs text-muted-foreground", children: [_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(ShieldIcon, {}), roleName, " access"] }), expiresAt && (_jsxs(_Fragment, { children: [_jsx(Separator, {}), _jsx("span", { children: formatExpiry(expiresAt) })] }))] }), !preview.isValid && (_jsx(InvalidNotice, { reason: preview.invalidReason })), preview.isValid && (_jsx("div", { className: "mt-5", children: isAuthenticated ? (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", onClick: handleAccept, disabled: isRedeeming, className: cn("w-full inline-flex items-center justify-center gap-1.5 rounded-md px-4 py-2 text-sm font-medium", "bg-primary text-primary-foreground hover:bg-primary/90", "disabled:pointer-events-none disabled:opacity-50", "transition-colors"), children: [isRedeeming && _jsx(SpinnerIcon, {}), isRedeeming ? "Accepting\u2026" : "Accept Invitation"] }), redeemError && (_jsx("p", { className: "mt-2 text-center text-[0.65rem] text-destructive", role: "alert", children: getUserMessage(redeemError) }))] })) : (_jsx("button", { type: "button", onClick: onAuthRequired, className: cn("w-full inline-flex items-center justify-center gap-1.5 rounded-md px-4 py-2 text-sm font-medium", "bg-primary text-primary-foreground hover:bg-primary/90", "transition-colors"), children: "Sign in to accept" })) }))] }) }));
81
+ }
82
+ // ---------------------------------------------------------------------------
83
+ // InvalidNotice (internal)
84
+ // ---------------------------------------------------------------------------
85
+ function InvalidNotice({ reason }) {
86
+ return (_jsxs("div", { className: "mt-4 rounded-md bg-muted/50 px-3 py-2.5 text-center", children: [_jsx(WarningIcon, {}), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: reason || "This invitation is no longer valid." })] }));
87
+ }
88
+ // ---------------------------------------------------------------------------
89
+ // ErrorCard (internal)
90
+ // ---------------------------------------------------------------------------
91
+ function ErrorCard({ message, onRetry, }) {
92
+ return (_jsxs("div", { className: "rounded-lg border border-destructive/30 bg-destructive/5 p-6 text-center", children: [_jsx("p", { className: "text-sm text-destructive", children: message }), onRetry && (_jsx("button", { type: "button", onClick: onRetry, className: cn("mt-3 inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium", "text-muted-foreground hover:text-foreground hover:bg-accent/50", "transition-colors"), children: "Try again" }))] }));
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // LoadingSkeleton (internal)
96
+ // ---------------------------------------------------------------------------
97
+ function LoadingSkeleton() {
98
+ return (_jsxs("div", { className: "rounded-lg border border-border bg-card p-6 space-y-4", children: [_jsxs("div", { className: "flex flex-col items-center gap-3", children: [_jsx("div", { className: "size-12 rounded-full bg-muted/40 animate-pulse" }), _jsx("div", { className: "h-5 w-40 rounded bg-muted/40 animate-pulse" }), _jsx("div", { className: "h-4 w-56 rounded bg-muted/40 animate-pulse" })] }), _jsxs("div", { className: "flex justify-center gap-3", children: [_jsx("div", { className: "h-4 w-24 rounded bg-muted/40 animate-pulse" }), _jsx("div", { className: "h-4 w-24 rounded bg-muted/40 animate-pulse" })] }), _jsx("div", { className: "h-10 w-full rounded-md bg-muted/40 animate-pulse" })] }));
99
+ }
100
+ // ---------------------------------------------------------------------------
101
+ // Formatting helpers
102
+ // ---------------------------------------------------------------------------
103
+ function formatExpiry(date) {
104
+ const now = Date.now();
105
+ const diffMs = date.getTime() - now;
106
+ if (diffMs <= 0)
107
+ return "Expired";
108
+ const days = Math.ceil(diffMs / 86_400_000);
109
+ if (days === 1)
110
+ return "Expires tomorrow";
111
+ if (days <= 30)
112
+ return `Expires in ${days} days`;
113
+ return `Expires ${date.toLocaleDateString(undefined, {
114
+ month: "short",
115
+ day: "numeric",
116
+ year: "numeric",
117
+ })}`;
118
+ }
119
+ // ---------------------------------------------------------------------------
120
+ // Separator (internal)
121
+ // ---------------------------------------------------------------------------
122
+ function Separator() {
123
+ return (_jsx("span", { className: "text-border", "aria-hidden": "true", children: "\u00B7" }));
124
+ }
125
+ // ---------------------------------------------------------------------------
126
+ // Icons
127
+ // ---------------------------------------------------------------------------
128
+ function ShieldIcon() {
129
+ return (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className: "shrink-0", children: _jsx("path", { d: "M8 1.5l5.5 2v4.5c0 3.5-2.5 5.5-5.5 7-3-1.5-5.5-3.5-5.5-7V3.5L8 1.5z" }) }));
130
+ }
131
+ function WarningIcon() {
132
+ return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className: "mx-auto text-muted-foreground", children: [_jsx("circle", { cx: "8", cy: "8", r: "6" }), _jsx("path", { d: "M8 5v3.5M8 10.5v.5" })] }));
133
+ }
134
+ function SuccessIcon() {
135
+ return (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className: "mx-auto text-primary", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M8 12l2.5 2.5L16 9" })] }));
136
+ }
137
+ function SpinnerIcon() {
138
+ return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", className: "animate-spin", "aria-hidden": "true", children: _jsx("path", { d: "M8 2a6 6 0 1 0 6 6" }) }));
139
+ }
140
+ //# sourceMappingURL=InvitationRedemption.js.map