@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.
- package/agent/AgentEnvForm.d.ts +2 -0
- package/agent/AgentEnvForm.d.ts.map +1 -1
- package/agent/AgentEnvForm.js.map +1 -1
- package/agent/AgentPicker.d.ts +2 -0
- package/agent/AgentPicker.d.ts.map +1 -1
- package/agent/AgentPicker.js.map +1 -1
- package/agent/agentSetupReducer.d.ts +69 -7
- package/agent/agentSetupReducer.d.ts.map +1 -1
- package/agent/agentSetupReducer.js.map +1 -1
- package/agent/useAgentCount.d.ts +2 -0
- package/agent/useAgentCount.d.ts.map +1 -1
- package/agent/useAgentCount.js.map +1 -1
- package/attachment/AttachmentChipList.d.ts +15 -0
- package/attachment/AttachmentChipList.d.ts.map +1 -1
- package/attachment/AttachmentChipList.js +15 -0
- package/attachment/AttachmentChipList.js.map +1 -1
- package/attachment/useAttachments.d.ts +14 -0
- package/attachment/useAttachments.d.ts.map +1 -1
- package/attachment/useAttachments.js.map +1 -1
- package/composer/useComposer.d.ts +5 -0
- package/composer/useComposer.d.ts.map +1 -1
- package/composer/useComposer.js.map +1 -1
- package/execution/ExecutionPhaseBadge.d.ts +1 -1
- package/execution/ExecutionPhaseBadge.js +1 -1
- package/execution/McpToolDetail.d.ts +16 -8
- package/execution/McpToolDetail.d.ts.map +1 -1
- package/execution/McpToolDetail.js +0 -6
- package/execution/McpToolDetail.js.map +1 -1
- package/execution/TodoList.d.ts +8 -0
- package/execution/TodoList.d.ts.map +1 -1
- package/execution/TodoList.js +8 -0
- package/execution/TodoList.js.map +1 -1
- package/execution/ToolArgsView.d.ts +1 -0
- package/execution/ToolArgsView.d.ts.map +1 -1
- package/execution/ToolArgsView.js.map +1 -1
- package/execution/UsageWidget.d.ts +1 -1
- package/execution/UsageWidget.js +1 -1
- package/execution/file-path-resolver.d.ts +10 -0
- package/execution/file-path-resolver.d.ts.map +1 -1
- package/execution/file-path-resolver.js.map +1 -1
- package/execution/index.d.ts +1 -1
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js.map +1 -1
- package/execution/useArtifactContent.d.ts +33 -0
- package/execution/useArtifactContent.d.ts.map +1 -1
- package/execution/useArtifactContent.js +33 -0
- package/execution/useArtifactContent.js.map +1 -1
- package/execution/useSubmitApproval.d.ts +2 -0
- package/execution/useSubmitApproval.d.ts.map +1 -1
- package/execution/useSubmitApproval.js.map +1 -1
- package/github/GitHubRepoPicker.d.ts +13 -0
- package/github/GitHubRepoPicker.d.ts.map +1 -1
- package/github/GitHubRepoPicker.js +13 -0
- package/github/GitHubRepoPicker.js.map +1 -1
- package/github/useGitHubConnection.d.ts +29 -1
- package/github/useGitHubConnection.d.ts.map +1 -1
- package/github/useGitHubConnection.js +29 -1
- package/github/useGitHubConnection.js.map +1 -1
- package/github/useGitHubRepos.d.ts +31 -0
- package/github/useGitHubRepos.d.ts.map +1 -1
- package/github/useGitHubRepos.js +31 -0
- package/github/useGitHubRepos.js.map +1 -1
- package/github/useGitHubSearch.d.ts +25 -0
- package/github/useGitHubSearch.d.ts.map +1 -1
- package/github/useGitHubSearch.js +25 -0
- package/github/useGitHubSearch.js.map +1 -1
- package/iam-policy/GrantAccessForm.d.ts +39 -0
- package/iam-policy/GrantAccessForm.d.ts.map +1 -0
- package/iam-policy/GrantAccessForm.js +75 -0
- package/iam-policy/GrantAccessForm.js.map +1 -0
- package/iam-policy/OrgMembersPanel.d.ts +28 -0
- package/iam-policy/OrgMembersPanel.d.ts.map +1 -0
- package/iam-policy/OrgMembersPanel.js +192 -0
- package/iam-policy/OrgMembersPanel.js.map +1 -0
- package/iam-policy/RoleSelector.d.ts +37 -0
- package/iam-policy/RoleSelector.d.ts.map +1 -0
- package/iam-policy/RoleSelector.js +42 -0
- package/iam-policy/RoleSelector.js.map +1 -0
- package/iam-policy/index.d.ts +12 -0
- package/iam-policy/index.d.ts.map +1 -0
- package/iam-policy/index.js +12 -0
- package/iam-policy/index.js.map +1 -0
- package/iam-policy/useCreateIamPolicy.d.ts +35 -0
- package/iam-policy/useCreateIamPolicy.d.ts.map +1 -0
- package/iam-policy/useCreateIamPolicy.js +46 -0
- package/iam-policy/useCreateIamPolicy.js.map +1 -0
- package/iam-policy/useDeleteIamPolicy.d.ts +34 -0
- package/iam-policy/useDeleteIamPolicy.d.ts.map +1 -0
- package/iam-policy/useDeleteIamPolicy.js +45 -0
- package/iam-policy/useDeleteIamPolicy.js.map +1 -0
- package/iam-policy/useGrantableRoles.d.ts +28 -0
- package/iam-policy/useGrantableRoles.d.ts.map +1 -0
- package/iam-policy/useGrantableRoles.js +32 -0
- package/iam-policy/useGrantableRoles.js.map +1 -0
- package/iam-policy/usePrincipalsCount.d.ts +31 -0
- package/iam-policy/usePrincipalsCount.d.ts.map +1 -0
- package/iam-policy/usePrincipalsCount.js +72 -0
- package/iam-policy/usePrincipalsCount.js.map +1 -0
- package/iam-policy/useResourceAccess.d.ts +51 -0
- package/iam-policy/useResourceAccess.d.ts.map +1 -0
- package/iam-policy/useResourceAccess.js +85 -0
- package/iam-policy/useResourceAccess.js.map +1 -0
- package/iam-policy/useRevokeOrgAccess.d.ts +36 -0
- package/iam-policy/useRevokeOrgAccess.d.ts.map +1 -0
- package/iam-policy/useRevokeOrgAccess.js +48 -0
- package/iam-policy/useRevokeOrgAccess.js.map +1 -0
- package/iam-policy/useRoleSelector.d.ts +52 -0
- package/iam-policy/useRoleSelector.d.ts.map +1 -0
- package/iam-policy/useRoleSelector.js +50 -0
- package/iam-policy/useRoleSelector.js.map +1 -0
- package/iam-policy/useWhoAmI.d.ts +30 -0
- package/iam-policy/useWhoAmI.d.ts.map +1 -0
- package/iam-policy/useWhoAmI.js +56 -0
- package/iam-policy/useWhoAmI.js.map +1 -0
- package/identity-provider/CreateIdentityProviderForm.d.ts +39 -0
- package/identity-provider/CreateIdentityProviderForm.d.ts.map +1 -0
- package/identity-provider/CreateIdentityProviderForm.js +102 -0
- package/identity-provider/CreateIdentityProviderForm.js.map +1 -0
- package/identity-provider/IdentityProviderDetailPanel.d.ts +42 -0
- package/identity-provider/IdentityProviderDetailPanel.d.ts.map +1 -0
- package/identity-provider/IdentityProviderDetailPanel.js +156 -0
- package/identity-provider/IdentityProviderDetailPanel.js.map +1 -0
- package/identity-provider/IdentityProviderListPanel.d.ts +41 -0
- package/identity-provider/IdentityProviderListPanel.d.ts.map +1 -0
- package/identity-provider/IdentityProviderListPanel.js +110 -0
- package/identity-provider/IdentityProviderListPanel.js.map +1 -0
- package/identity-provider/IdentityProviderWizard.d.ts +40 -0
- package/identity-provider/IdentityProviderWizard.d.ts.map +1 -0
- package/identity-provider/IdentityProviderWizard.js +180 -0
- package/identity-provider/IdentityProviderWizard.js.map +1 -0
- package/identity-provider/ProviderPicker.d.ts +28 -0
- package/identity-provider/ProviderPicker.d.ts.map +1 -0
- package/identity-provider/ProviderPicker.js +64 -0
- package/identity-provider/ProviderPicker.js.map +1 -0
- package/identity-provider/SsoLoginPrompt.d.ts +51 -0
- package/identity-provider/SsoLoginPrompt.d.ts.map +1 -0
- package/identity-provider/SsoLoginPrompt.js +119 -0
- package/identity-provider/SsoLoginPrompt.js.map +1 -0
- package/identity-provider/index.d.ts +14 -0
- package/identity-provider/index.d.ts.map +1 -0
- package/identity-provider/index.js +14 -0
- package/identity-provider/index.js.map +1 -0
- package/identity-provider/presets.d.ts +65 -0
- package/identity-provider/presets.d.ts.map +1 -0
- package/identity-provider/presets.js +200 -0
- package/identity-provider/presets.js.map +1 -0
- package/identity-provider/useCreateIdentityProvider.d.ts +37 -0
- package/identity-provider/useCreateIdentityProvider.d.ts.map +1 -0
- package/identity-provider/useCreateIdentityProvider.js +48 -0
- package/identity-provider/useCreateIdentityProvider.js.map +1 -0
- package/identity-provider/useDeleteIdentityProvider.d.ts +34 -0
- package/identity-provider/useDeleteIdentityProvider.d.ts.map +1 -0
- package/identity-provider/useDeleteIdentityProvider.js +45 -0
- package/identity-provider/useDeleteIdentityProvider.js.map +1 -0
- package/identity-provider/useIdentityProvider.d.ts +37 -0
- package/identity-provider/useIdentityProvider.d.ts.map +1 -0
- package/identity-provider/useIdentityProvider.js +62 -0
- package/identity-provider/useIdentityProvider.js.map +1 -0
- package/identity-provider/useIdentityProviderList.d.ts +48 -0
- package/identity-provider/useIdentityProviderList.d.ts.map +1 -0
- package/identity-provider/useIdentityProviderList.js +75 -0
- package/identity-provider/useIdentityProviderList.js.map +1 -0
- package/identity-provider/useOidcDiscovery.d.ts +39 -0
- package/identity-provider/useOidcDiscovery.d.ts.map +1 -0
- package/identity-provider/useOidcDiscovery.js +76 -0
- package/identity-provider/useOidcDiscovery.js.map +1 -0
- package/identity-provider/useSsoProvider.d.ts +50 -0
- package/identity-provider/useSsoProvider.d.ts.map +1 -0
- package/identity-provider/useSsoProvider.js +83 -0
- package/identity-provider/useSsoProvider.js.map +1 -0
- package/identity-provider/useUpdateIdentityProvider.d.ts +38 -0
- package/identity-provider/useUpdateIdentityProvider.d.ts.map +1 -0
- package/identity-provider/useUpdateIdentityProvider.js +49 -0
- package/identity-provider/useUpdateIdentityProvider.js.map +1 -0
- package/index.d.ts +14 -5
- package/index.d.ts.map +1 -1
- package/index.js +10 -2
- package/index.js.map +1 -1
- package/internal/CloudFeatureNotice.d.ts +12 -0
- package/internal/CloudFeatureNotice.d.ts.map +1 -1
- package/internal/CloudFeatureNotice.js +12 -0
- package/internal/CloudFeatureNotice.js.map +1 -1
- package/invitation/InvitationCreatedAlert.d.ts +35 -0
- package/invitation/InvitationCreatedAlert.d.ts.map +1 -0
- package/invitation/InvitationCreatedAlert.js +60 -0
- package/invitation/InvitationCreatedAlert.js.map +1 -0
- package/invitation/InvitationManager.d.ts +44 -0
- package/invitation/InvitationManager.d.ts.map +1 -0
- package/invitation/InvitationManager.js +248 -0
- package/invitation/InvitationManager.js.map +1 -0
- package/invitation/InvitationRedemption.d.ts +69 -0
- package/invitation/InvitationRedemption.d.ts.map +1 -0
- package/invitation/InvitationRedemption.js +140 -0
- package/invitation/InvitationRedemption.js.map +1 -0
- package/invitation/index.d.ts +17 -0
- package/invitation/index.d.ts.map +1 -0
- package/invitation/index.js +9 -0
- package/invitation/index.js.map +1 -0
- package/invitation/useCreateInvitation.d.ts +52 -0
- package/invitation/useCreateInvitation.d.ts.map +1 -0
- package/invitation/useCreateInvitation.js +55 -0
- package/invitation/useCreateInvitation.js.map +1 -0
- package/invitation/useInvitationPreview.d.ts +51 -0
- package/invitation/useInvitationPreview.d.ts.map +1 -0
- package/invitation/useInvitationPreview.js +80 -0
- package/invitation/useInvitationPreview.js.map +1 -0
- package/invitation/useOrgInvitations.d.ts +36 -0
- package/invitation/useOrgInvitations.d.ts.map +1 -0
- package/invitation/useOrgInvitations.js +65 -0
- package/invitation/useOrgInvitations.js.map +1 -0
- package/invitation/useRedeemInvitation.d.ts +47 -0
- package/invitation/useRedeemInvitation.d.ts.map +1 -0
- package/invitation/useRedeemInvitation.js +53 -0
- package/invitation/useRedeemInvitation.js.map +1 -0
- package/invitation/useRevokeInvitation.d.ts +35 -0
- package/invitation/useRevokeInvitation.d.ts.map +1 -0
- package/invitation/useRevokeInvitation.js +47 -0
- package/invitation/useRevokeInvitation.js.map +1 -0
- package/library/detect-skill-package.d.ts +1 -0
- package/library/detect-skill-package.d.ts.map +1 -1
- package/library/detect-skill-package.js.map +1 -1
- package/library/detect-stigmer-resource.d.ts +1 -0
- package/library/detect-stigmer-resource.d.ts.map +1 -1
- package/library/detect-stigmer-resource.js.map +1 -1
- package/library/parse-resource-yaml.d.ts +4 -0
- package/library/parse-resource-yaml.d.ts.map +1 -1
- package/library/parse-resource-yaml.js.map +1 -1
- package/mcp-server/McpServerDetailView.d.ts +2 -2
- package/mcp-server/McpServerDetailView.d.ts.map +1 -1
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/mcp-server/index.d.ts +1 -1
- package/mcp-server/index.d.ts.map +1 -1
- package/mcp-server/index.js.map +1 -1
- package/mcp-server/mcpServerSetupReducer.d.ts +54 -0
- package/mcp-server/mcpServerSetupReducer.d.ts.map +1 -1
- package/mcp-server/mcpServerSetupReducer.js.map +1 -1
- package/models/ModelSelector.d.ts +9 -0
- package/models/ModelSelector.d.ts.map +1 -1
- package/models/ModelSelector.js +9 -0
- package/models/ModelSelector.js.map +1 -1
- package/models/registry.d.ts +11 -1
- package/models/registry.d.ts.map +1 -1
- package/models/registry.js.map +1 -1
- package/models/useModelRegistry.d.ts +20 -0
- package/models/useModelRegistry.d.ts.map +1 -1
- package/models/useModelRegistry.js +20 -0
- package/models/useModelRegistry.js.map +1 -1
- package/organization/OrgProfilePanel.d.ts +31 -0
- package/organization/OrgProfilePanel.d.ts.map +1 -0
- package/organization/OrgProfilePanel.js +147 -0
- package/organization/OrgProfilePanel.js.map +1 -0
- package/organization/index.d.ts +6 -0
- package/organization/index.d.ts.map +1 -1
- package/organization/index.js +3 -0
- package/organization/index.js.map +1 -1
- package/organization/useOrganization.d.ts +31 -0
- package/organization/useOrganization.d.ts.map +1 -0
- package/organization/useOrganization.js +56 -0
- package/organization/useOrganization.js.map +1 -0
- package/organization/useUpdateOrganization.d.ts +40 -0
- package/organization/useUpdateOrganization.d.ts.map +1 -0
- package/organization/useUpdateOrganization.js +51 -0
- package/organization/useUpdateOrganization.js.map +1 -0
- package/package.json +4 -4
- package/provider.d.ts +1 -0
- package/provider.d.ts.map +1 -1
- package/provider.js.map +1 -1
- package/search/useResourceList.d.ts +4 -2
- package/search/useResourceList.d.ts.map +1 -1
- package/search/useResourceList.js +2 -1
- package/search/useResourceList.js.map +1 -1
- package/search/useResourceSearch.d.ts +10 -2
- package/search/useResourceSearch.d.ts.map +1 -1
- package/search/useResourceSearch.js +2 -1
- package/search/useResourceSearch.js.map +1 -1
- package/session/group-sessions.d.ts +23 -0
- package/session/group-sessions.d.ts.map +1 -1
- package/session/group-sessions.js +23 -0
- package/session/group-sessions.js.map +1 -1
- package/session/index.d.ts +1 -1
- package/session/index.d.ts.map +1 -1
- package/session/index.js.map +1 -1
- package/session/useCreateSession.d.ts +11 -2
- package/session/useCreateSession.d.ts.map +1 -1
- package/session/useCreateSession.js.map +1 -1
- package/session/useSession.d.ts +24 -0
- package/session/useSession.d.ts.map +1 -1
- package/session/useSession.js +24 -0
- package/session/useSession.js.map +1 -1
- package/session/useSessionArtifacts.d.ts +1 -0
- package/session/useSessionArtifacts.d.ts.map +1 -1
- package/session/useSessionArtifacts.js.map +1 -1
- package/session/useSessionConversation.d.ts +7 -0
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionExecutions.d.ts +23 -0
- package/session/useSessionExecutions.d.ts.map +1 -1
- package/session/useSessionExecutions.js +23 -0
- package/session/useSessionExecutions.js.map +1 -1
- package/session/useSessionList.d.ts +19 -0
- package/session/useSessionList.d.ts.map +1 -1
- package/session/useSessionList.js +19 -0
- package/session/useSessionList.js.map +1 -1
- package/session/useSessionWriteBacks.d.ts +1 -0
- package/session/useSessionWriteBacks.d.ts.map +1 -1
- package/session/useSessionWriteBacks.js.map +1 -1
- package/session/useUpdateSession.d.ts +22 -0
- package/session/useUpdateSession.d.ts.map +1 -1
- package/session/useUpdateSession.js +22 -0
- package/session/useUpdateSession.js.map +1 -1
- package/skill/SkillPicker.d.ts +15 -0
- package/skill/SkillPicker.d.ts.map +1 -1
- package/skill/SkillPicker.js +15 -0
- package/skill/SkillPicker.js.map +1 -1
- package/src/agent/AgentEnvForm.tsx +2 -0
- package/src/agent/AgentPicker.tsx +2 -0
- package/src/agent/agentSetupReducer.ts +109 -20
- package/src/agent/useAgentCount.ts +2 -0
- package/src/attachment/AttachmentChipList.tsx +15 -0
- package/src/attachment/useAttachments.ts +14 -0
- package/src/composer/useComposer.ts +5 -0
- package/src/execution/ExecutionPhaseBadge.tsx +1 -1
- package/src/execution/McpToolDetail.tsx +18 -6
- package/src/execution/TodoList.tsx +8 -0
- package/src/execution/ToolArgsView.tsx +1 -0
- package/src/execution/UsageWidget.tsx +1 -1
- package/src/execution/file-path-resolver.ts +28 -4
- package/src/execution/index.ts +5 -1
- package/src/execution/useArtifactContent.ts +33 -0
- package/src/execution/useSubmitApproval.ts +2 -0
- package/src/github/GitHubRepoPicker.tsx +13 -0
- package/src/github/useGitHubConnection.ts +29 -1
- package/src/github/useGitHubRepos.ts +31 -0
- package/src/github/useGitHubSearch.ts +25 -0
- package/src/iam-policy/GrantAccessForm.tsx +198 -0
- package/src/iam-policy/OrgMembersPanel.tsx +572 -0
- package/src/iam-policy/RoleSelector.tsx +105 -0
- package/src/iam-policy/index.ts +51 -0
- package/src/iam-policy/useCreateIamPolicy.ts +66 -0
- package/src/iam-policy/useDeleteIamPolicy.ts +65 -0
- package/src/iam-policy/useGrantableRoles.ts +45 -0
- package/src/iam-policy/usePrincipalsCount.ts +96 -0
- package/src/iam-policy/useResourceAccess.ts +128 -0
- package/src/iam-policy/useRevokeOrgAccess.ts +74 -0
- package/src/iam-policy/useRoleSelector.ts +97 -0
- package/src/iam-policy/useWhoAmI.ts +78 -0
- package/src/identity-provider/CreateIdentityProviderForm.tsx +308 -0
- package/src/identity-provider/IdentityProviderDetailPanel.tsx +583 -0
- package/src/identity-provider/IdentityProviderListPanel.tsx +370 -0
- package/src/identity-provider/IdentityProviderWizard.tsx +684 -0
- package/src/identity-provider/ProviderPicker.tsx +152 -0
- package/src/identity-provider/SsoLoginPrompt.tsx +404 -0
- package/src/identity-provider/index.ts +67 -0
- package/src/identity-provider/presets.ts +262 -0
- package/src/identity-provider/useCreateIdentityProvider.ts +68 -0
- package/src/identity-provider/useDeleteIdentityProvider.ts +65 -0
- package/src/identity-provider/useIdentityProvider.ts +86 -0
- package/src/identity-provider/useIdentityProviderList.ts +100 -0
- package/src/identity-provider/useOidcDiscovery.ts +124 -0
- package/src/identity-provider/useSsoProvider.ts +99 -0
- package/src/identity-provider/useUpdateIdentityProvider.ts +69 -0
- package/src/index.ts +121 -1
- package/src/internal/CloudFeatureNotice.tsx +12 -0
- package/src/invitation/InvitationCreatedAlert.tsx +185 -0
- package/src/invitation/InvitationManager.tsx +842 -0
- package/src/invitation/InvitationRedemption.tsx +434 -0
- package/src/invitation/index.ts +16 -0
- package/src/invitation/useCreateInvitation.ts +83 -0
- package/src/invitation/useInvitationPreview.ts +103 -0
- package/src/invitation/useOrgInvitations.ts +88 -0
- package/src/invitation/useRedeemInvitation.ts +82 -0
- package/src/invitation/useRevokeInvitation.ts +66 -0
- package/src/library/detect-skill-package.ts +4 -1
- package/src/library/detect-stigmer-resource.ts +4 -1
- package/src/library/parse-resource-yaml.ts +12 -2
- package/src/mcp-server/McpServerDetailView.tsx +2 -1
- package/src/mcp-server/index.ts +4 -1
- package/src/mcp-server/mcpServerSetupReducer.ts +86 -8
- package/src/models/ModelSelector.tsx +9 -0
- package/src/models/registry.ts +11 -1
- package/src/models/useModelRegistry.ts +20 -0
- package/src/organization/OrgProfilePanel.tsx +451 -0
- package/src/organization/index.ts +6 -0
- package/src/organization/useOrganization.ts +79 -0
- package/src/organization/useUpdateOrganization.ts +71 -0
- package/src/provider.tsx +1 -0
- package/src/search/useResourceList.ts +6 -3
- package/src/search/useResourceSearch.ts +12 -3
- package/src/session/group-sessions.ts +23 -0
- package/src/session/index.ts +1 -0
- package/src/session/useCreateSession.ts +19 -3
- package/src/session/useSession.ts +24 -0
- package/src/session/useSessionArtifacts.ts +1 -0
- package/src/session/useSessionConversation.ts +7 -0
- package/src/session/useSessionExecutions.ts +23 -0
- package/src/session/useSessionList.ts +19 -0
- package/src/session/useSessionWriteBacks.ts +1 -0
- package/src/session/useUpdateSession.ts +22 -0
- package/src/skill/SkillPicker.tsx +15 -0
- package/src/usage/OrgUsagePanel.tsx +465 -0
- package/src/usage/date-range.ts +86 -0
- package/src/usage/index.ts +13 -0
- package/src/usage/useOrgUsageReport.ts +110 -0
- package/src/workspace/FolderBrowser.tsx +9 -0
- package/src/workspace/WorkspaceEditor.tsx +17 -0
- package/src/workspace/useFolderListing.ts +24 -0
- package/src/workspace/useWorkspaceEntries.ts +38 -0
- package/styles.css +1 -1
- package/usage/OrgUsagePanel.d.ts +24 -0
- package/usage/OrgUsagePanel.d.ts.map +1 -0
- package/usage/OrgUsagePanel.js +134 -0
- package/usage/OrgUsagePanel.js.map +1 -0
- package/usage/date-range.d.ts +36 -0
- package/usage/date-range.d.ts.map +1 -0
- package/usage/date-range.js +69 -0
- package/usage/date-range.js.map +1 -0
- package/usage/index.d.ts +7 -0
- package/usage/index.d.ts.map +1 -0
- package/usage/index.js +4 -0
- package/usage/index.js.map +1 -0
- package/usage/useOrgUsageReport.d.ts +48 -0
- package/usage/useOrgUsageReport.d.ts.map +1 -0
- package/usage/useOrgUsageReport.js +72 -0
- package/usage/useOrgUsageReport.js.map +1 -0
- package/workspace/FolderBrowser.d.ts +9 -0
- package/workspace/FolderBrowser.d.ts.map +1 -1
- package/workspace/FolderBrowser.js +9 -0
- package/workspace/FolderBrowser.js.map +1 -1
- package/workspace/WorkspaceEditor.d.ts +17 -0
- package/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/workspace/WorkspaceEditor.js +17 -0
- package/workspace/WorkspaceEditor.js.map +1 -1
- package/workspace/useFolderListing.d.ts +24 -0
- package/workspace/useFolderListing.d.ts.map +1 -1
- package/workspace/useFolderListing.js +24 -0
- package/workspace/useFolderListing.js.map +1 -1
- package/workspace/useWorkspaceEntries.d.ts +38 -0
- package/workspace/useWorkspaceEntries.d.ts.map +1 -1
- package/workspace/useWorkspaceEntries.js +25 -0
- package/workspace/useWorkspaceEntries.js.map +1 -1
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
type FormEvent,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { cn } from "@stigmer/theme";
|
|
11
|
+
import { getUserMessage } from "@stigmer/sdk";
|
|
12
|
+
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
13
|
+
import { useOrganization } from "./useOrganization";
|
|
14
|
+
import { useUpdateOrganization } from "./useUpdateOrganization";
|
|
15
|
+
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Constants
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
const DESCRIPTION_MAX_LEN = 500;
|
|
21
|
+
const LOGO_URL_MAX_LEN = 2048;
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Public API
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
/** Props for {@link OrgProfilePanel}. */
|
|
28
|
+
export interface OrgProfilePanelProps {
|
|
29
|
+
/** The ID of the organization to display and edit. */
|
|
30
|
+
readonly orgId: string;
|
|
31
|
+
/** Fired with the updated resource after a successful save. */
|
|
32
|
+
readonly onUpdated?: (org: Organization) => void;
|
|
33
|
+
/** Additional CSS class names for the root container. */
|
|
34
|
+
readonly className?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Self-contained profile editor for an {@link Organization} resource.
|
|
39
|
+
*
|
|
40
|
+
* Fetches the organization by ID, displays editable fields (name,
|
|
41
|
+
* description, logo URL) and read-only identifiers (slug, ID).
|
|
42
|
+
* On save, calls `organization.update()` and fires `onUpdated`.
|
|
43
|
+
*
|
|
44
|
+
* All visual properties flow through `--stgm-*` design tokens. The
|
|
45
|
+
* component has zero dependencies on Console routing, auth context,
|
|
46
|
+
* or layout — platform builders can embed it directly:
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <OrgProfilePanel
|
|
51
|
+
* orgId="org-id-123"
|
|
52
|
+
* onUpdated={(org) => console.log("Saved:", org.metadata?.name)}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function OrgProfilePanel({
|
|
57
|
+
orgId,
|
|
58
|
+
onUpdated,
|
|
59
|
+
className,
|
|
60
|
+
}: OrgProfilePanelProps) {
|
|
61
|
+
const {
|
|
62
|
+
organization,
|
|
63
|
+
isLoading: isFetching,
|
|
64
|
+
error: fetchError,
|
|
65
|
+
refetch,
|
|
66
|
+
} = useOrganization(orgId || null);
|
|
67
|
+
|
|
68
|
+
const {
|
|
69
|
+
update,
|
|
70
|
+
isUpdating,
|
|
71
|
+
error: updateError,
|
|
72
|
+
clearError,
|
|
73
|
+
} = useUpdateOrganization();
|
|
74
|
+
|
|
75
|
+
// Form state — synchronized from server data when it loads/changes.
|
|
76
|
+
const [name, setName] = useState("");
|
|
77
|
+
const [description, setDescription] = useState("");
|
|
78
|
+
const [logoUrl, setLogoUrl] = useState("");
|
|
79
|
+
|
|
80
|
+
// Track the server snapshot so we can detect changes and reset.
|
|
81
|
+
const serverName = organization?.metadata?.name ?? "";
|
|
82
|
+
const serverDescription = organization?.spec?.description ?? "";
|
|
83
|
+
const serverLogoUrl = organization?.spec?.logoUrl ?? "";
|
|
84
|
+
const serverSlug = organization?.metadata?.slug ?? "";
|
|
85
|
+
const serverOrgId = organization?.metadata?.id ?? "";
|
|
86
|
+
const isPersonal = organization?.spec?.isPersonal ?? false;
|
|
87
|
+
|
|
88
|
+
// Sync form fields when server data changes.
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!organization) return;
|
|
91
|
+
setName(organization.metadata?.name ?? "");
|
|
92
|
+
setDescription(organization.spec?.description ?? "");
|
|
93
|
+
setLogoUrl(organization.spec?.logoUrl ?? "");
|
|
94
|
+
}, [organization]);
|
|
95
|
+
|
|
96
|
+
const hasChanges = useMemo(
|
|
97
|
+
() =>
|
|
98
|
+
name.trim() !== serverName ||
|
|
99
|
+
description.trim() !== serverDescription ||
|
|
100
|
+
logoUrl.trim() !== serverLogoUrl,
|
|
101
|
+
[name, description, logoUrl, serverName, serverDescription, serverLogoUrl],
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const canSubmit = name.trim().length > 0 && !isUpdating && hasChanges;
|
|
105
|
+
|
|
106
|
+
const handleDiscard = useCallback(() => {
|
|
107
|
+
setName(serverName);
|
|
108
|
+
setDescription(serverDescription);
|
|
109
|
+
setLogoUrl(serverLogoUrl);
|
|
110
|
+
clearError();
|
|
111
|
+
}, [serverName, serverDescription, serverLogoUrl, clearError]);
|
|
112
|
+
|
|
113
|
+
const handleSubmit = useCallback(
|
|
114
|
+
async (e: FormEvent) => {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
if (!canSubmit || !organization) return;
|
|
117
|
+
|
|
118
|
+
clearError();
|
|
119
|
+
try {
|
|
120
|
+
const updated = await update({
|
|
121
|
+
name: name.trim(),
|
|
122
|
+
slug: serverSlug,
|
|
123
|
+
org: serverSlug,
|
|
124
|
+
description: description.trim() || undefined,
|
|
125
|
+
logoUrl: logoUrl.trim() || undefined,
|
|
126
|
+
});
|
|
127
|
+
refetch();
|
|
128
|
+
onUpdated?.(updated);
|
|
129
|
+
} catch {
|
|
130
|
+
// error state is managed by useUpdateOrganization
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
[
|
|
134
|
+
canSubmit,
|
|
135
|
+
organization,
|
|
136
|
+
name,
|
|
137
|
+
description,
|
|
138
|
+
logoUrl,
|
|
139
|
+
serverSlug,
|
|
140
|
+
update,
|
|
141
|
+
clearError,
|
|
142
|
+
refetch,
|
|
143
|
+
onUpdated,
|
|
144
|
+
],
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// -----------------------------------------------------------------------
|
|
148
|
+
// Loading state
|
|
149
|
+
// -----------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
if (isFetching && !organization) {
|
|
152
|
+
return (
|
|
153
|
+
<div
|
|
154
|
+
className={cn("space-y-4", className)}
|
|
155
|
+
aria-busy="true"
|
|
156
|
+
aria-label="Loading organization profile"
|
|
157
|
+
>
|
|
158
|
+
{Array.from({ length: 4 }, (_, i) => (
|
|
159
|
+
<div
|
|
160
|
+
key={i}
|
|
161
|
+
className="bg-muted-subtle h-10 animate-pulse rounded"
|
|
162
|
+
style={{ width: `${90 - i * 12}%` }}
|
|
163
|
+
/>
|
|
164
|
+
))}
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// -----------------------------------------------------------------------
|
|
170
|
+
// Fetch error
|
|
171
|
+
// -----------------------------------------------------------------------
|
|
172
|
+
|
|
173
|
+
if (fetchError) {
|
|
174
|
+
return (
|
|
175
|
+
<div className={cn("space-y-3", className)} role="alert">
|
|
176
|
+
<p className="text-destructive text-sm">
|
|
177
|
+
{getUserMessage(fetchError)}
|
|
178
|
+
</p>
|
|
179
|
+
<button
|
|
180
|
+
type="button"
|
|
181
|
+
onClick={refetch}
|
|
182
|
+
className={cn(
|
|
183
|
+
"rounded-md px-3 py-1.5 text-xs font-medium",
|
|
184
|
+
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
185
|
+
)}
|
|
186
|
+
>
|
|
187
|
+
Retry
|
|
188
|
+
</button>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (!organization) return null;
|
|
194
|
+
|
|
195
|
+
// -----------------------------------------------------------------------
|
|
196
|
+
// Render
|
|
197
|
+
// -----------------------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<form
|
|
201
|
+
onSubmit={handleSubmit}
|
|
202
|
+
className={cn("space-y-6", className)}
|
|
203
|
+
>
|
|
204
|
+
{/* -- Read-only identifiers -- */}
|
|
205
|
+
<div className="space-y-3">
|
|
206
|
+
<ReadOnlyField label="Slug" value={serverSlug} mono />
|
|
207
|
+
<ReadOnlyField label="Organization ID" value={serverOrgId} />
|
|
208
|
+
{isPersonal && (
|
|
209
|
+
<div>
|
|
210
|
+
<span className="bg-primary-subtle text-primary rounded-full px-2 py-0.5 text-[0.6rem] font-medium uppercase tracking-wider">
|
|
211
|
+
Personal
|
|
212
|
+
</span>
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<hr className="border-border" />
|
|
218
|
+
|
|
219
|
+
{/* -- Editable fields -- */}
|
|
220
|
+
<div className="space-y-4">
|
|
221
|
+
{/* Name */}
|
|
222
|
+
<div className="space-y-1">
|
|
223
|
+
<label
|
|
224
|
+
htmlFor="stgm-org-profile-name"
|
|
225
|
+
className="text-xs font-medium text-foreground"
|
|
226
|
+
>
|
|
227
|
+
Name
|
|
228
|
+
</label>
|
|
229
|
+
<input
|
|
230
|
+
id="stgm-org-profile-name"
|
|
231
|
+
type="text"
|
|
232
|
+
value={name}
|
|
233
|
+
onChange={(e) => setName(e.target.value)}
|
|
234
|
+
disabled={isUpdating}
|
|
235
|
+
required
|
|
236
|
+
className={cn(
|
|
237
|
+
"w-full rounded-md border border-input bg-background px-2.5 py-1.5 text-xs text-foreground",
|
|
238
|
+
"placeholder:text-muted-foreground",
|
|
239
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
240
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
241
|
+
)}
|
|
242
|
+
/>
|
|
243
|
+
<p className="text-[0.65rem] text-muted-foreground">
|
|
244
|
+
The display name shown in the sidebar and across the platform.
|
|
245
|
+
</p>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
{/* Description */}
|
|
249
|
+
<div className="space-y-1">
|
|
250
|
+
<label
|
|
251
|
+
htmlFor="stgm-org-profile-desc"
|
|
252
|
+
className="text-xs font-medium text-foreground"
|
|
253
|
+
>
|
|
254
|
+
Description
|
|
255
|
+
</label>
|
|
256
|
+
<textarea
|
|
257
|
+
id="stgm-org-profile-desc"
|
|
258
|
+
value={description}
|
|
259
|
+
onChange={(e) => setDescription(e.target.value)}
|
|
260
|
+
maxLength={DESCRIPTION_MAX_LEN}
|
|
261
|
+
rows={3}
|
|
262
|
+
disabled={isUpdating}
|
|
263
|
+
placeholder="What is this organization for?"
|
|
264
|
+
className={cn(
|
|
265
|
+
"w-full resize-y rounded-md border border-input bg-background px-2.5 py-1.5 text-xs text-foreground",
|
|
266
|
+
"placeholder:text-muted-foreground",
|
|
267
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
268
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
269
|
+
)}
|
|
270
|
+
/>
|
|
271
|
+
<p className="text-[0.65rem] text-muted-foreground">
|
|
272
|
+
{description.length}/{DESCRIPTION_MAX_LEN} characters
|
|
273
|
+
</p>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
{/* Logo URL */}
|
|
277
|
+
<div className="space-y-1">
|
|
278
|
+
<label
|
|
279
|
+
htmlFor="stgm-org-profile-logo"
|
|
280
|
+
className="text-xs font-medium text-foreground"
|
|
281
|
+
>
|
|
282
|
+
Logo URL
|
|
283
|
+
</label>
|
|
284
|
+
<input
|
|
285
|
+
id="stgm-org-profile-logo"
|
|
286
|
+
type="url"
|
|
287
|
+
value={logoUrl}
|
|
288
|
+
onChange={(e) => setLogoUrl(e.target.value)}
|
|
289
|
+
maxLength={LOGO_URL_MAX_LEN}
|
|
290
|
+
disabled={isUpdating}
|
|
291
|
+
placeholder="https://example.com/logo.png"
|
|
292
|
+
className={cn(
|
|
293
|
+
"w-full rounded-md border border-input bg-background px-2.5 py-1.5 text-xs text-foreground",
|
|
294
|
+
"placeholder:text-muted-foreground",
|
|
295
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
296
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
297
|
+
)}
|
|
298
|
+
/>
|
|
299
|
+
<p className="text-[0.65rem] text-muted-foreground">
|
|
300
|
+
A public URL to your organization's logo image.
|
|
301
|
+
</p>
|
|
302
|
+
<LogoPreview url={logoUrl.trim()} />
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
{/* -- Error feedback -- */}
|
|
307
|
+
{updateError && (
|
|
308
|
+
<p className="text-destructive text-[0.65rem]" role="alert">
|
|
309
|
+
{getUserMessage(updateError)}
|
|
310
|
+
</p>
|
|
311
|
+
)}
|
|
312
|
+
|
|
313
|
+
{/* -- Actions -- */}
|
|
314
|
+
<div className="flex items-center gap-2">
|
|
315
|
+
<button
|
|
316
|
+
type="submit"
|
|
317
|
+
disabled={!canSubmit}
|
|
318
|
+
className={cn(
|
|
319
|
+
"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium",
|
|
320
|
+
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
321
|
+
"disabled:pointer-events-none disabled:opacity-40",
|
|
322
|
+
)}
|
|
323
|
+
>
|
|
324
|
+
{isUpdating && <SpinnerIcon />}
|
|
325
|
+
Save changes
|
|
326
|
+
</button>
|
|
327
|
+
|
|
328
|
+
{hasChanges && !isUpdating && (
|
|
329
|
+
<button
|
|
330
|
+
type="button"
|
|
331
|
+
onClick={handleDiscard}
|
|
332
|
+
className={cn(
|
|
333
|
+
"rounded-md px-3 py-1.5 text-xs",
|
|
334
|
+
"text-muted-foreground hover:text-foreground hover:bg-accent/50",
|
|
335
|
+
)}
|
|
336
|
+
>
|
|
337
|
+
Discard
|
|
338
|
+
</button>
|
|
339
|
+
)}
|
|
340
|
+
</div>
|
|
341
|
+
</form>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// ---------------------------------------------------------------------------
|
|
346
|
+
// ReadOnlyField — copiable label/value pair
|
|
347
|
+
// ---------------------------------------------------------------------------
|
|
348
|
+
|
|
349
|
+
function ReadOnlyField({
|
|
350
|
+
label,
|
|
351
|
+
value,
|
|
352
|
+
mono,
|
|
353
|
+
}: {
|
|
354
|
+
label: string;
|
|
355
|
+
value: string;
|
|
356
|
+
mono?: boolean;
|
|
357
|
+
}) {
|
|
358
|
+
const [copied, setCopied] = useState(false);
|
|
359
|
+
|
|
360
|
+
const handleCopy = useCallback(() => {
|
|
361
|
+
navigator.clipboard.writeText(value).then(() => {
|
|
362
|
+
setCopied(true);
|
|
363
|
+
setTimeout(() => setCopied(false), 1500);
|
|
364
|
+
});
|
|
365
|
+
}, [value]);
|
|
366
|
+
|
|
367
|
+
if (!value) return null;
|
|
368
|
+
|
|
369
|
+
return (
|
|
370
|
+
<div className="space-y-0.5">
|
|
371
|
+
<p className="text-[0.65rem] font-medium text-muted-foreground uppercase tracking-wider">
|
|
372
|
+
{label}
|
|
373
|
+
</p>
|
|
374
|
+
<div className="flex items-center gap-2">
|
|
375
|
+
<span
|
|
376
|
+
className={cn(
|
|
377
|
+
"text-xs text-foreground select-all",
|
|
378
|
+
mono && "font-mono",
|
|
379
|
+
)}
|
|
380
|
+
>
|
|
381
|
+
{value}
|
|
382
|
+
</span>
|
|
383
|
+
<button
|
|
384
|
+
type="button"
|
|
385
|
+
onClick={handleCopy}
|
|
386
|
+
className={cn(
|
|
387
|
+
"rounded px-1.5 py-0.5 text-[0.6rem]",
|
|
388
|
+
"text-muted-foreground hover:text-foreground hover:bg-accent/50",
|
|
389
|
+
"transition-colors",
|
|
390
|
+
)}
|
|
391
|
+
aria-label={`Copy ${label}`}
|
|
392
|
+
>
|
|
393
|
+
{copied ? "Copied" : "Copy"}
|
|
394
|
+
</button>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// LogoPreview — shows a small preview when the URL looks like an image
|
|
402
|
+
// ---------------------------------------------------------------------------
|
|
403
|
+
|
|
404
|
+
function LogoPreview({ url }: { url: string }) {
|
|
405
|
+
const [status, setStatus] = useState<"idle" | "loaded" | "error">("idle");
|
|
406
|
+
|
|
407
|
+
useEffect(() => {
|
|
408
|
+
setStatus("idle");
|
|
409
|
+
}, [url]);
|
|
410
|
+
|
|
411
|
+
if (!url || status === "error") return null;
|
|
412
|
+
|
|
413
|
+
return (
|
|
414
|
+
<div className="mt-2">
|
|
415
|
+
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
416
|
+
<img
|
|
417
|
+
src={url}
|
|
418
|
+
alt="Organization logo preview"
|
|
419
|
+
onLoad={() => setStatus("loaded")}
|
|
420
|
+
onError={() => setStatus("error")}
|
|
421
|
+
className={cn(
|
|
422
|
+
"h-10 w-10 rounded-md border border-border object-contain bg-background",
|
|
423
|
+
status === "idle" && "opacity-0",
|
|
424
|
+
status === "loaded" && "opacity-100",
|
|
425
|
+
)}
|
|
426
|
+
/>
|
|
427
|
+
</div>
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
// SpinnerIcon
|
|
433
|
+
// ---------------------------------------------------------------------------
|
|
434
|
+
|
|
435
|
+
function SpinnerIcon() {
|
|
436
|
+
return (
|
|
437
|
+
<svg
|
|
438
|
+
width="12"
|
|
439
|
+
height="12"
|
|
440
|
+
viewBox="0 0 16 16"
|
|
441
|
+
fill="none"
|
|
442
|
+
stroke="currentColor"
|
|
443
|
+
strokeWidth="2"
|
|
444
|
+
strokeLinecap="round"
|
|
445
|
+
className="animate-spin"
|
|
446
|
+
aria-hidden="true"
|
|
447
|
+
>
|
|
448
|
+
<path d="M8 2a6 6 0 1 0 6 6" />
|
|
449
|
+
</svg>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export { useOrganization } from "./useOrganization";
|
|
2
|
+
export type { UseOrganizationReturn } from "./useOrganization";
|
|
1
3
|
export { useCreateOrganization } from "./useCreateOrganization";
|
|
2
4
|
export type { UseCreateOrganizationReturn } from "./useCreateOrganization";
|
|
5
|
+
export { useUpdateOrganization } from "./useUpdateOrganization";
|
|
6
|
+
export type { UseUpdateOrganizationReturn } from "./useUpdateOrganization";
|
|
3
7
|
export { CreateOrganizationForm } from "./CreateOrganizationForm";
|
|
4
8
|
export type { CreateOrganizationFormProps } from "./CreateOrganizationForm";
|
|
9
|
+
export { OrgProfilePanel } from "./OrgProfilePanel";
|
|
10
|
+
export type { OrgProfilePanelProps } from "./OrgProfilePanel";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
5
|
+
import { useStigmer } from "../hooks";
|
|
6
|
+
import { toError } from "../internal/toError";
|
|
7
|
+
|
|
8
|
+
/** Return value of {@link useOrganization}. */
|
|
9
|
+
export interface UseOrganizationReturn {
|
|
10
|
+
/** The fetched Organization, or `null` while loading or on error. */
|
|
11
|
+
readonly organization: Organization | null;
|
|
12
|
+
/** `true` while the initial fetch or a refetch is in flight. */
|
|
13
|
+
readonly isLoading: boolean;
|
|
14
|
+
/** Error from the last failed request, or `null` when healthy. */
|
|
15
|
+
readonly error: Error | null;
|
|
16
|
+
/** Discard cached data and re-fetch the organization from the server. */
|
|
17
|
+
readonly refetch: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Data hook that fetches a single Organization by ID.
|
|
22
|
+
*
|
|
23
|
+
* Pass `null` to skip fetching (stable no-op). When the `id` changes,
|
|
24
|
+
* the previous in-flight request is discarded and a fresh fetch begins.
|
|
25
|
+
* Call `refetch()` to re-query after mutating the organization through
|
|
26
|
+
* a separate hook or API call.
|
|
27
|
+
*
|
|
28
|
+
* Returns the full proto {@link Organization} resource so consumers
|
|
29
|
+
* have access to metadata (name, slug), spec (description, logo),
|
|
30
|
+
* and status without additional calls.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const { organization, isLoading, error } = useOrganization("org-id-123");
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function useOrganization(
|
|
38
|
+
id: string | null,
|
|
39
|
+
): UseOrganizationReturn {
|
|
40
|
+
const stigmer = useStigmer();
|
|
41
|
+
const [organization, setOrganization] = useState<Organization | null>(null);
|
|
42
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
43
|
+
const [error, setError] = useState<Error | null>(null);
|
|
44
|
+
const [fetchKey, setFetchKey] = useState(0);
|
|
45
|
+
|
|
46
|
+
const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!id) {
|
|
50
|
+
setOrganization(null);
|
|
51
|
+
setIsLoading(false);
|
|
52
|
+
setError(null);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const cancelled = { current: false };
|
|
57
|
+
setIsLoading(true);
|
|
58
|
+
setError(null);
|
|
59
|
+
|
|
60
|
+
stigmer.organization.get(id).then(
|
|
61
|
+
(result) => {
|
|
62
|
+
if (cancelled.current) return;
|
|
63
|
+
setOrganization(result);
|
|
64
|
+
setIsLoading(false);
|
|
65
|
+
},
|
|
66
|
+
(err) => {
|
|
67
|
+
if (cancelled.current) return;
|
|
68
|
+
setError(toError(err));
|
|
69
|
+
setIsLoading(false);
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return () => {
|
|
74
|
+
cancelled.current = true;
|
|
75
|
+
};
|
|
76
|
+
}, [id, stigmer, fetchKey]);
|
|
77
|
+
|
|
78
|
+
return { organization, isLoading, error, refetch };
|
|
79
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import type { OrganizationInput } from "@stigmer/sdk";
|
|
5
|
+
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
6
|
+
import { useStigmer } from "../hooks";
|
|
7
|
+
import { toError } from "../internal/toError";
|
|
8
|
+
|
|
9
|
+
/** Return value of {@link useUpdateOrganization}. */
|
|
10
|
+
export interface UseUpdateOrganizationReturn {
|
|
11
|
+
/** Submit an {@link OrganizationInput} to update an existing organization. Resolves with the updated resource. */
|
|
12
|
+
readonly update: (input: OrganizationInput) => Promise<Organization>;
|
|
13
|
+
/** `true` while the update request is in flight. */
|
|
14
|
+
readonly isUpdating: boolean;
|
|
15
|
+
/** Error from the last failed update, or `null` when healthy. */
|
|
16
|
+
readonly error: Error | null;
|
|
17
|
+
/** Reset `error` to `null`. */
|
|
18
|
+
readonly clearError: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Mutation hook that wraps `organization.update()` with loading and
|
|
23
|
+
* error state.
|
|
24
|
+
*
|
|
25
|
+
* Updates an existing Organization resource. The input must include
|
|
26
|
+
* `name`, `org`, and `slug` to identify the target resource, along
|
|
27
|
+
* with the spec fields to update (`description`, `logoUrl`).
|
|
28
|
+
*
|
|
29
|
+
* Returns the full {@link Organization} proto including
|
|
30
|
+
* server-updated metadata (version, timestamps) so callers can
|
|
31
|
+
* immediately reference the latest state.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const { update, isUpdating, error } = useUpdateOrganization();
|
|
36
|
+
*
|
|
37
|
+
* const updated = await update({
|
|
38
|
+
* name: "Acme Corp",
|
|
39
|
+
* slug: "acme-corp",
|
|
40
|
+
* org: "acme-corp",
|
|
41
|
+
* description: "Updated description",
|
|
42
|
+
* });
|
|
43
|
+
* refetch(); // refresh profile view
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function useUpdateOrganization(): UseUpdateOrganizationReturn {
|
|
47
|
+
const stigmer = useStigmer();
|
|
48
|
+
const [isUpdating, setIsUpdating] = useState(false);
|
|
49
|
+
const [error, setError] = useState<Error | null>(null);
|
|
50
|
+
|
|
51
|
+
const clearError = useCallback(() => setError(null), []);
|
|
52
|
+
|
|
53
|
+
const update = useCallback(
|
|
54
|
+
async (input: OrganizationInput): Promise<Organization> => {
|
|
55
|
+
setIsUpdating(true);
|
|
56
|
+
setError(null);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
return await stigmer.organization.update(input);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
setError(toError(err));
|
|
62
|
+
throw err;
|
|
63
|
+
} finally {
|
|
64
|
+
setIsUpdating(false);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[stigmer],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return { update, isUpdating, error, clearError };
|
|
71
|
+
}
|
package/src/provider.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { DeploymentModeContext } from "./deployment-mode";
|
|
|
11
11
|
export interface StigmerProviderProps {
|
|
12
12
|
/** A configured {@link Stigmer} client instance. */
|
|
13
13
|
readonly client: Stigmer;
|
|
14
|
+
/** React children rendered inside the provider scope. */
|
|
14
15
|
readonly children: ReactNode;
|
|
15
16
|
/**
|
|
16
17
|
* Deployment mode of the connected Stigmer backend.
|
|
@@ -8,7 +8,8 @@ import type { SearchResult } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
|
|
|
8
8
|
* Scope controls resource listing boundaries.
|
|
9
9
|
*
|
|
10
10
|
* - `"org"` — resources owned by the active organization (public and private).
|
|
11
|
-
* - `"all"` —
|
|
11
|
+
* - `"all"` — resources owned by the active organization plus public resources
|
|
12
|
+
* from other organizations.
|
|
12
13
|
*/
|
|
13
14
|
export type ResourceListScope = "org" | "all";
|
|
14
15
|
|
|
@@ -23,7 +24,8 @@ export interface UseResourceListOptions {
|
|
|
23
24
|
* Controls resource visibility scope.
|
|
24
25
|
*
|
|
25
26
|
* - `"org"` — all resources owned by the given organization, regardless of visibility.
|
|
26
|
-
* - `"all"` — all resources
|
|
27
|
+
* - `"all"` — all resources owned by the given organization plus public resources
|
|
28
|
+
* from other organizations.
|
|
27
29
|
*
|
|
28
30
|
* @default "org"
|
|
29
31
|
*/
|
|
@@ -88,9 +90,10 @@ export function useResourceList(
|
|
|
88
90
|
setError(null);
|
|
89
91
|
|
|
90
92
|
const params: ListParams = {
|
|
91
|
-
org
|
|
93
|
+
org,
|
|
92
94
|
query: query || undefined,
|
|
93
95
|
excludePublic: false,
|
|
96
|
+
crossOrgPublic: scope === "all",
|
|
94
97
|
page: { num: page, size: pageSize },
|
|
95
98
|
};
|
|
96
99
|
|