@kortix/ui 0.15.2 → 0.15.4
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/dist/_vendor/kortix-shared.js +243 -30
- package/dist/_vendor/shared/channel-descriptors.d.ts +1 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/markdown-math.d.ts +6 -0
- package/dist/_vendor/shared/workspace-actions.d.ts +155 -0
- package/dist/_vendor/shared/workspace-settings.d.ts +62 -0
- package/dist/access/access/access-dialog-share.js +6 -6
- package/dist/access/access/access-dialog.d.ts +44 -1
- package/dist/access/access/access-dialog.js +8 -8
- package/dist/access/access/agent-principals.d.ts +3 -3
- package/dist/access/access/agent-principals.js +5 -4
- package/dist/access/access/invite-people-dialog.d.ts +37 -0
- package/dist/access/access/invite-people-dialog.js +140 -0
- package/dist/access/access/principal-picker.js +3 -2
- package/dist/access/access/project-select.js +2 -2
- package/dist/access/access/role-select.d.ts +9 -8
- package/dist/access/access/role-select.js +22 -25
- package/dist/access/access/workspace-role-dialog.d.ts +27 -0
- package/dist/access/access/workspace-role-dialog.js +48 -0
- package/dist/access/iam/add-github-account-dialog.d.ts +1 -1
- package/dist/access/iam/add-github-account-dialog.js +1 -1
- package/dist/access/iam/api-key-expiry.d.ts +18 -0
- package/dist/access/iam/api-key-expiry.js +47 -0
- package/dist/access/iam/api-key-rows.d.ts +6 -0
- package/dist/access/iam/api-key-rows.js +3 -0
- package/dist/access/iam/workspace-key-acts-as.d.ts +41 -0
- package/dist/access/iam/workspace-key-acts-as.js +48 -0
- package/dist/access/sharing-intent.js +1 -1
- package/dist/access/sharing-picker.js +1 -1
- package/dist/animated-copy-icon.d.ts +2 -2
- package/dist/animated-copy-icon.js +7 -4
- package/dist/apps/app-shared.js +2 -2
- package/dist/artifacts/artifact-session.js +1 -1
- package/dist/customize/agents/agent-drives-section.d.ts +1 -3
- package/dist/customize/agents/agent-drives-section.js +5 -6
- package/dist/customize/agents/agent-page-chrome.js +1 -1
- package/dist/customize/agents/agent-page.js +6 -7
- package/dist/customize/agents/agent-tabs.d.ts +1 -1
- package/dist/customize/agents/agent-tabs.js +1 -2
- package/dist/customize/agents/agents-page.js +2 -3
- package/dist/customize/connectors/connector-identity.d.ts +1 -1
- package/dist/customize/connectors/connector-identity.js +1 -1
- package/dist/customize/connectors/connector-moves-banner.js +2 -2
- package/dist/customize/connectors/connectors-page.d.ts +10 -2
- package/dist/customize/connectors/connectors-page.js +38 -5
- package/dist/customize/connectors/detail/app-page.js +1 -1
- package/dist/customize/connectors/detail/connector-page.d.ts +1 -1
- package/dist/customize/connectors/detail/connector-page.js +1 -1
- package/dist/customize/connectors/detail/connector-policy-sets.js +2 -2
- package/dist/customize/connectors/detail/connector-tools.js +7 -7
- package/dist/customize/connectors/detail/connector-triggers.js +2 -3
- package/dist/customize/connectors/detail/email-inboxes.js +2 -2
- package/dist/customize/models/models-page.d.ts +1 -1
- package/dist/customize/models/models-page.js +1 -1
- package/dist/customize/project-settings/project-admin-sections.d.ts +53 -17
- package/dist/customize/project-settings/project-admin-sections.js +80 -31
- package/dist/customize/project-settings/project-settings-page.d.ts +2 -2
- package/dist/customize/project-settings/project-settings-page.js +6 -4
- package/dist/customize/project-settings/project-settings-sections.d.ts +2 -3
- package/dist/customize/project-settings/project-settings-sections.js +9 -4
- package/dist/customize/providers/provider-accordion.d.ts +3 -1
- package/dist/customize/providers/provider-accordion.js +2 -2
- package/dist/customize/secrets/secrets-page.d.ts +1 -1
- package/dist/customize/secrets/secrets-page.js +1 -1
- package/dist/customize/sections/component/email-connect-form.js +2 -2
- package/dist/customize/sections/component/slack-byo-wizard.js +3 -3
- package/dist/customize/sections/connectors-view.js +17 -17
- package/dist/customize/sections/gateway-view.d.ts +7 -5
- package/dist/customize/sections/gateway-view.js +28 -17
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/llm-provider/custom-provider-form.js +2 -2
- package/dist/customize/sections/llm-provider/llm-provider-modal.d.ts +1 -1
- package/dist/customize/sections/llm-provider/llm-provider-modal.js +4 -4
- package/dist/customize/sections/llm-provider/models-tab-row.js +5 -3
- package/dist/customize/sections/llm-provider/types.d.ts +2 -0
- package/dist/customize/sections/view/agent-editor-access-fields.js +1 -3
- package/dist/customize/sections/view/agent-editor-catalog.d.ts +5 -6
- package/dist/customize/sections/view/agent-editor-catalog.js +33 -14
- package/dist/customize/sections/view/agent-editor.js +1 -1
- package/dist/customize/sections/view/channels-view.js +13 -13
- package/dist/customize/sections/view/gateway/gateway-budgets.js +12 -10
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.js +3 -3
- package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-routing.js +1 -1
- package/dist/customize/sections/view/git-view.js +3 -3
- package/dist/customize/sections/view/grant-mode-field.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +1 -1
- package/dist/customize/sections/view/review-view.d.ts +0 -15
- package/dist/customize/sections/view/review-view.js +1 -23
- package/dist/customize/sections/view/secret-delivery.js +2 -2
- package/dist/customize/sections/view/secrets-view.js +16 -16
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +12 -1
- package/dist/customize/sections/view/subscription-usage-tab.js +71 -72
- package/dist/customize/settings/rail-copy-context.js +1 -1
- package/dist/customize/settings/rail.d.ts +1 -1
- package/dist/customize/settings/rail.js +11 -18
- package/dist/customize/settings/settings-tab-header.d.ts +1 -1
- package/dist/customize/settings/settings-tab-header.js +1 -1
- package/dist/customize/settings/settings-tabs.d.ts +5 -12
- package/dist/customize/settings/settings-tabs.js +31 -44
- package/dist/customize/settings/tabs/experimental-tab.js +4 -4
- package/dist/customize/settings/tabs/general-tab.d.ts +29 -11
- package/dist/customize/settings/tabs/general-tab.js +55 -25
- package/dist/customize/settings/tabs/project-edit-patch.d.ts +0 -13
- package/dist/customize/settings/tabs/project-edit-patch.js +0 -28
- package/dist/customize/settings/tabs/sandbox-tab.js +2 -2
- package/dist/customize/settings/tabs/tokens-tab.d.ts +32 -2
- package/dist/customize/settings/tabs/tokens-tab.js +157 -32
- package/dist/customize/settings/tabs/workspace-keys.d.ts +6 -0
- package/dist/customize/settings/tabs/workspace-keys.js +240 -0
- package/dist/customize/shared/capability-library.js +3 -1
- package/dist/customize/shared/catalog/catalog-space-tabs.js +2 -2
- package/dist/customize/shared/customize-tab-bar.d.ts +6 -2
- package/dist/customize/shared/customize-tab-bar.js +36 -35
- package/dist/customize/shared/standalone-settings-nav.js +2 -2
- package/dist/customize/triggers/schedule/schedule-copy.d.ts +1 -1
- package/dist/customize/triggers/schedule/trigger-composer.js +5 -6
- package/dist/customize/triggers/schedule/trigger-list.js +2 -2
- package/dist/customize/triggers/schedule/trigger-session-access-copy.d.ts +6 -6
- package/dist/customize/triggers/schedule/trigger-session-access-copy.js +3 -3
- package/dist/customize/triggers/schedule/when-event.js +4 -4
- package/dist/customize/triggers/schedule/when-webhook-address.js +2 -2
- package/dist/customize/triggers/schedule/when-webhook.js +2 -2
- package/dist/customize/triggers/schedule-view.js +4 -5
- package/dist/customize/triggers/triggers-page.d.ts +1 -1
- package/dist/customize/triggers/triggers-page.js +1 -1
- package/dist/files/drives/drive-storage.d.ts +2 -2
- package/dist/files/drives/drive-storage.js +13 -6
- package/dist/files/project/components/change-request-detail-dialog.js +6 -6
- package/dist/files/project/components/change-requests-panel.js +2 -2
- package/dist/files/project/components/diff-preview-banner.d.ts +1 -1
- package/dist/files/project/components/diff-preview-banner.js +1 -1
- package/dist/files/project/components/drive-explorer.js +64 -43
- package/dist/files/project/components/drive-grid-view.js +1 -1
- package/dist/files/project/components/drive-list-view.js +1 -1
- package/dist/files/project/components/drive-upload-tray.d.ts +2 -1
- package/dist/files/project/components/drive-upload-tray.js +9 -4
- package/dist/files/project/context.d.ts +1 -1
- package/dist/files/project/context.js +1 -1
- package/dist/files/project/drop-tree.d.ts +16 -0
- package/dist/files/project/drop-tree.js +39 -0
- package/dist/files/project/upload-batch.d.ts +15 -0
- package/dist/files/project/upload-batch.js +12 -0
- package/dist/files/renderers/image-renderer.js +1 -1
- package/dist/files/runtime/hooks/use-binary-blob.js +12 -2
- package/dist/files/runtime/hooks/use-file-content.js +18 -2
- package/dist/files/viewer/file-content-renderer.js +2 -2
- package/dist/files/viewer/preview-fit.d.ts +1 -1
- package/dist/files/viewer/preview-fit.js +1 -1
- package/dist/i18n/en.d.ts +317 -31
- package/dist/i18n/en.js +882 -596
- package/dist/i18n/ui-catalog/account-hub-translation-keys.generated.js +9 -9
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +12 -6
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +5 -5
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +67 -60
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/icons/solid-right-arrow.d.ts +8 -0
- package/dist/icons/solid-right-arrow.js +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-entry.js +9 -8
- package/dist/internal/account-hub/account-hub-location.d.ts +20 -3
- package/dist/internal/account-hub/account-hub-location.js +16 -7
- package/dist/internal/account-hub/hub-sheet.d.ts +1 -1
- package/dist/internal/account-hub/hub-sheet.js +1 -1
- package/dist/internal/account-hub/sections.d.ts +2 -2
- package/dist/internal/account-hub/sections.js +10 -10
- package/dist/internal/account-hub/use-account-hub-access.d.ts +2 -0
- package/dist/internal/account-hub/use-account-hub-access.js +13 -5
- package/dist/internal/account-hub/workspace-settings-route.d.ts +27 -0
- package/dist/internal/account-hub/workspace-settings-route.js +51 -0
- package/dist/internal/billing/use-cost-explorer.d.ts +19 -1
- package/dist/internal/billing/use-cost-explorer.js +27 -1
- package/dist/internal/components/nav-rail.d.ts +3 -1
- package/dist/internal/components/nav-rail.js +2 -0
- package/dist/internal/components/repository-disconnected.js +2 -2
- package/dist/internal/desktop/desktop-back-button.d.ts +1 -1
- package/dist/internal/files/file-read-retry.d.ts +13 -0
- package/dist/internal/files/file-read-retry.js +53 -1
- package/dist/internal/goals/goal-meta.d.ts +2 -1
- package/dist/internal/goals/goal-meta.js +4 -2
- package/dist/internal/hooks/account/use-accounts-list.d.ts +2 -12
- package/dist/internal/hooks/account/use-accounts-list.js +1 -14
- package/dist/internal/hooks/account/use-my-invites.d.ts +1 -1
- package/dist/internal/hooks/account/use-my-invites.js +1 -1
- package/dist/internal/hooks/use-review-session-summary.d.ts +7 -0
- package/dist/internal/hooks/use-review-session-summary.js +12 -1
- package/dist/internal/layout/project-capability-nav.d.ts +6 -17
- package/dist/internal/layout/project-capability-nav.js +7 -79
- package/dist/internal/layout/project-settings-nav.d.ts +2 -2
- package/dist/internal/layout/project-settings-nav.js +3 -3
- package/dist/internal/lib/billing/billing-gate-state.d.ts +10 -0
- package/dist/internal/lib/billing/billing-gate-state.js +20 -3
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.js +2 -3
- package/dist/internal/lib/browser-noise/rules/extensions.js +18 -0
- package/dist/internal/lib/browser-noise/rules/injected-scripts.d.ts +5 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +141 -5
- package/dist/internal/lib/capability-tab-routes.d.ts +16 -40
- package/dist/internal/lib/capability-tab-routes.js +25 -54
- package/dist/internal/lib/desktop.d.ts +1 -1
- package/dist/internal/lib/desktop.js +1 -1
- package/dist/internal/lib/github-installations.d.ts +1 -1
- package/dist/internal/lib/github-installations.js +1 -1
- package/dist/internal/lib/mermaid-utils.js +2 -24
- package/dist/internal/lib/model-pricing.js +1 -1
- package/dist/internal/lib/navigation/session-href.d.ts +1 -1
- package/dist/internal/lib/navigation/session-href.js +1 -1
- package/dist/internal/lib/onboarding/landing-destination.d.ts +12 -4
- package/dist/internal/lib/onboarding/landing-destination.js +17 -5
- package/dist/internal/lib/onboarding/last-project-cookie.d.ts +1 -1
- package/dist/internal/lib/onboarding/last-project-cookie.js +1 -1
- package/dist/internal/lib/project-actions.d.ts +1 -4
- package/dist/internal/lib/project-actions.js +2 -5
- package/dist/internal/lib/provider-branding.js +11 -3
- package/dist/internal/lib/use-project-can.d.ts +1 -3
- package/dist/internal/lib/use-project-can.js +0 -5
- package/dist/internal/lib/web-notifications.js +5 -5
- package/dist/internal/notifications/notification-inbox.d.ts +8 -2
- package/dist/internal/notifications/notification-inbox.js +8 -5
- package/dist/internal/notifications/use-inbox-summary.d.ts +8 -4
- package/dist/internal/notifications/use-inbox-summary.js +12 -6
- package/dist/internal/reminders/use-refetch-after-fire.d.ts +0 -2
- package/dist/internal/reminders/use-refetch-after-fire.js +1 -10
- package/dist/internal/stores/account-panel-store.d.ts +17 -1
- package/dist/internal/stores/account-panel-store.js +19 -2
- package/dist/internal/stores/project-switch-store.d.ts +2 -2
- package/dist/internal/stores/project-switch-store.js +4 -4
- package/dist/internal/stores/settings-panel-store.d.ts +6 -0
- package/dist/internal/stores/settings-panel-store.js +4 -1
- package/dist/internal/stores/workspace-settings-rail-store.d.ts +67 -0
- package/dist/internal/stores/workspace-settings-rail-store.js +11 -0
- package/dist/lib/routes.js +19 -18
- package/dist/lib/z-stack.d.ts +7 -0
- package/dist/lib/z-stack.js +13 -0
- package/dist/markdown/copy-button.d.ts +2 -2
- package/dist/markdown/copy-button.js +22 -20
- package/dist/markdown/setup-links/setup-link-button.js +1 -1
- package/dist/primitives/emoji-tint.d.ts +1 -1
- package/dist/primitives/emoji-tint.js +1 -1
- package/dist/primitives/error-state.js +8 -1
- package/dist/primitives/inline-meta.d.ts +12 -1
- package/dist/primitives/inline-meta.js +38 -5
- package/dist/primitives/mermaid-render.js +3 -20
- package/dist/primitives/page-search-bar.js +6 -6
- package/dist/primitives/section.d.ts +3 -3
- package/dist/primitives/section.js +9 -9
- package/dist/primitives/status.d.ts +5 -5
- package/dist/primitives/status.js +33 -33
- package/dist/primitives/tabs.d.ts +14 -26
- package/dist/primitives/tabs.js +103 -105
- package/dist/primitives/tag.d.ts +1 -1
- package/dist/primitives/toast.d.ts +6 -6
- package/dist/primitives/toast.js +55 -48
- package/dist/providers/session-ids.d.ts +1 -1
- package/dist/providers/ui-provider.d.ts +2 -0
- package/dist/session/agents/agent-strip.js +6 -6
- package/dist/session/agents/subagent-dialog-content.js +3 -4
- package/dist/session/agents/workflow-run-controls.d.ts +0 -2
- package/dist/session/agents/workflow-run-controls.js +1 -12
- package/dist/session/composer/ComposerCard.d.ts +1 -1
- package/dist/session/composer/ComposerCard.js +2 -2
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +1 -8
- package/dist/session/composer/composer-chat-input.d.ts +14 -1
- package/dist/session/composer/composer-chat-input.js +4 -2
- package/dist/session/composer/composer-toolbar.d.ts +22 -17
- package/dist/session/composer/composer-toolbar.js +12 -3
- package/dist/session/composer/composer.d.ts +8 -0
- package/dist/session/composer/composer.js +5 -13
- package/dist/session/composer/reasoning-effort-selector.d.ts +21 -0
- package/dist/session/composer/reasoning-effort-selector.js +46 -1
- package/dist/session/composer/send-stop-control.d.ts +15 -1
- package/dist/session/composer/send-stop-control.js +30 -5
- package/dist/session/header/session-embed-menu-item.d.ts +12 -0
- package/dist/session/header/session-embed-menu-item.js +30 -0
- package/dist/{workspace/sidebar/modal/session-embed-section.d.ts → session/header/session-embed-snippet.d.ts} +2 -11
- package/dist/session/header/session-embed-snippet.js +21 -0
- package/dist/session/header/session-goal-indicator.js +2 -3
- package/dist/session/header/session-reminders-indicator.js +3 -3
- package/dist/session/header/session-site-header.js +10 -3
- package/dist/session/index.d.ts +1 -1
- package/dist/session/models/ask-owner-for-credits-button.d.ts +7 -1
- package/dist/session/models/ask-owner-for-credits-button.js +3 -2
- package/dist/session/models/model-availability.d.ts +11 -0
- package/dist/session/models/model-availability.js +12 -0
- package/dist/session/models/model-connection-gate.d.ts +11 -26
- package/dist/session/models/model-connection-gate.js +22 -35
- package/dist/session/models/model-grouping.d.ts +30 -0
- package/dist/session/models/model-grouping.js +46 -0
- package/dist/session/models/model-picker-panel.d.ts +62 -0
- package/dist/session/models/model-picker-panel.js +181 -0
- package/dist/session/models/model-selector.d.ts +28 -4
- package/dist/session/models/model-selector.js +59 -15
- package/dist/session/models/model-tags.d.ts +4 -8
- package/dist/session/models/model-tags.js +20 -13
- package/dist/session/models/subscription-offer.d.ts +35 -0
- package/dist/session/models/subscription-offer.js +91 -0
- package/dist/session/models/use-model-connection-gate.d.ts +3 -3
- package/dist/session/models/use-model-connection-gate.js +8 -6
- package/dist/session/overrides/session-overrides-toolbar.js +8 -5
- package/dist/session/panel/open-session-quick-view.js +1 -1
- package/dist/session/panel/session-detail-panel.js +5 -1
- package/dist/session/panel/session-panel-provider.js +2 -2
- package/dist/session/panel/session-reminders-panel.js +2 -2
- package/dist/session/panel/shared/use-panel-derivations.d.ts +1 -0
- package/dist/session/panel/shared/use-panel-derivations.js +1 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
- package/dist/session/panel/shared/use-panel-handoffs.js +22 -3
- package/dist/session/panel/use-session-panel-state.js +1 -1
- package/dist/session/prompts/ask-deck.d.ts +5 -3
- package/dist/session/prompts/ask-deck.js +30 -10
- package/dist/session/prompts/session-access-prompt.d.ts +61 -0
- package/dist/session/prompts/session-access-prompt.js +88 -0
- package/dist/session/prompts/session-permission-prompt.js +1 -1
- package/dist/session/scope/session-scope-control.js +2 -2
- package/dist/session/status/session-notice-banner.js +3 -3
- package/dist/session/status/session-route-prefetch.d.ts +2 -2
- package/dist/session/thread/optimistic-turn.js +1 -1
- package/dist/session/thread/session-chat.js +51 -19
- package/dist/session/thread/session-context-message-explorer.js +2 -2
- package/dist/session/thread/session-history.js +3 -3
- package/dist/session/tool/render-static.d.ts +11 -0
- package/dist/session/tool/render-static.js +16 -0
- package/dist/session/tool/shared/session-helpers.js +2 -2
- package/dist/session/tool/tool-part-renderer.d.ts +6 -1
- package/dist/session/tool/tool-part-renderer.js +9 -5
- package/dist/session/tool/tools/kortix-action-tool.js +4 -25
- package/dist/session/tool/tools/task-tool.js +9 -2
- package/dist/session/tool/tools/workflow-run-card.js +5 -1
- package/dist/session/tool/tools/workflow-tool.js +3 -14
- package/dist/session/turn/user-message.js +1 -1
- package/dist/session/voice/composer-call.d.ts +31 -0
- package/dist/session/voice/composer-call.js +46 -0
- package/dist/session/voice/voice-call-card.js +2 -0
- package/dist/session/voice/voice-call-store.d.ts +8 -0
- package/dist/session/voice/voice-call-store.js +5 -0
- package/dist/session/voice/voice-call.d.ts +2 -2
- package/dist/session/voice/voice-call.js +6 -6
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +10103 -0
- package/dist/test-utils/intl.js +27 -0
- package/dist/test-utils/strip-tags.d.ts +24 -0
- package/dist/test-utils/strip-tags.js +32 -0
- package/dist/workspace/admin/project-admin-dashboard.d.ts +51 -33
- package/dist/workspace/admin/project-admin-dashboard.js +269 -81
- package/dist/workspace/admin/settings-search-landing.d.ts +11 -0
- package/dist/workspace/admin/settings-search-landing.js +103 -0
- package/dist/workspace/admin/settings-search.d.ts +69 -0
- package/dist/workspace/admin/settings-search.js +393 -0
- package/dist/workspace/home/existing-repo-setup-prompt.d.ts +22 -0
- package/dist/workspace/home/existing-repo-setup-prompt.js +57 -0
- package/dist/workspace/home/no-agent-home.d.ts +25 -0
- package/dist/workspace/home/no-agent-home.js +44 -0
- package/dist/workspace/home/welcome-body.js +2 -1
- package/dist/workspace/inbox/workspace-inbox.d.ts +21 -0
- package/dist/workspace/inbox/workspace-inbox.js +52 -0
- package/dist/workspace/instant-session-shell.js +11 -1
- package/dist/workspace/layout/project-files-view.js +1 -1
- package/dist/workspace/layout/project-home.js +84 -11
- package/dist/workspace/layout/use-project-home-call.d.ts +24 -0
- package/dist/workspace/layout/use-project-home-call.js +56 -0
- package/dist/workspace/memory/memory-body.js +2 -2
- package/dist/workspace/new/account-param.d.ts +1 -1
- package/dist/workspace/new/account-param.js +4 -4
- package/dist/workspace/new/advanced-fields.js +3 -3
- package/dist/workspace/new/clone-param.d.ts +1 -1
- package/dist/workspace/new/clone-param.js +1 -1
- package/dist/workspace/new/create-workspace-key.js +1 -1
- package/dist/workspace/new/github-source.d.ts +6 -6
- package/dist/workspace/new/github-source.js +6 -6
- package/dist/workspace/new/new-workspace-form.d.ts +11 -141
- package/dist/workspace/new/new-workspace-form.js +9 -195
- package/dist/workspace/new/provision-new-workspace.d.ts +14 -0
- package/dist/workspace/new/provision-new-workspace.js +14 -0
- package/dist/workspace/new/repository-options.d.ts +2 -2
- package/dist/workspace/new/repository-options.js +2 -2
- package/dist/workspace/new/source-param.d.ts +2 -2
- package/dist/workspace/new/source-param.js +2 -2
- package/dist/workspace/new/use-create-workspace.d.ts +43 -102
- package/dist/workspace/new/use-create-workspace.js +77 -136
- package/dist/workspace/new/use-project-quota.d.ts +1 -1
- package/dist/workspace/new/use-project-quota.js +1 -1
- package/dist/workspace/new/workspace-handoff.d.ts +2 -2
- package/dist/workspace/new/workspace-handoff.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +14 -1
- package/dist/workspace/new/workspace-name.js +21 -1
- package/dist/workspace/project-selector/project-selector-model.d.ts +115 -57
- package/dist/workspace/project-selector/project-selector-model.js +157 -111
- package/dist/workspace/projects/modal/project-icon-field.d.ts +5 -5
- package/dist/workspace/projects/modal/project-icon-field.js +4 -4
- package/dist/workspace/projects/policies-panel.js +3 -3
- package/dist/workspace/sessions/board-grouping.js +1 -1
- package/dist/workspace/sessions/project-sessions-view.js +2 -2
- package/dist/workspace/sessions/session-detail.js +2 -2
- package/dist/workspace/sessions/sessions-board.d.ts +1 -1
- package/dist/workspace/sessions/sessions-board.js +1 -1
- package/dist/workspace/settings/split-notice-banner.d.ts +13 -0
- package/dist/workspace/settings/split-notice-banner.js +59 -0
- package/dist/workspace/settings/use-leave-workspace.d.ts +16 -0
- package/dist/workspace/settings/use-leave-workspace.js +60 -0
- package/dist/workspace/sidebar/footer/project-balance-warning.js +9 -6
- package/dist/workspace/sidebar/footer/project-files-nav.js +2 -2
- package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
- package/dist/workspace/sidebar/footer/sidebar-alert.d.ts +1 -1
- package/dist/workspace/sidebar/invitations-menu-group.d.ts +2 -2
- package/dist/workspace/sidebar/invitations-menu-group.js +4 -4
- package/dist/workspace/sidebar/modal/share-session-access.js +1 -1
- package/dist/workspace/sidebar/modal/share-session-modal.js +4 -5
- package/dist/workspace/sidebar/project-nav-items.js +14 -25
- package/dist/workspace/sidebar/project-sidebar.js +17 -2
- package/dist/workspace/sidebar/project-spaces-nav.js +6 -15
- package/dist/workspace/sidebar/sidebar-drill.d.ts +37 -0
- package/dist/workspace/sidebar/sidebar-drill.js +110 -0
- package/dist/workspace/sidebar/use-workspace-directory.d.ts +24 -0
- package/dist/workspace/sidebar/use-workspace-directory.js +24 -0
- package/dist/workspace/sidebar/use-workspace-list.d.ts +37 -0
- package/dist/workspace/sidebar/use-workspace-list.js +71 -0
- package/dist/workspace/sidebar/workspace-grouping.d.ts +6 -67
- package/dist/workspace/sidebar/workspace-grouping.js +4 -107
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +30 -12
- package/dist/workspace/sidebar/workspace-menu-model.js +13 -107
- package/dist/workspace/sidebar/workspace-menu-section.d.ts +7 -1
- package/dist/workspace/sidebar/workspace-menu-section.js +65 -100
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +34 -0
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +282 -0
- package/dist/workspace/space/space-filter-tabs.js +2 -2
- package/dist/workspace/space/space-page.d.ts +1 -1
- package/dist/workspace/space/space-page.js +1 -1
- package/package.json +55 -51
- package/skills/kortix-ui/SKILL.md +66 -66
- package/skills/kortix-ui/references/custom-dashboard.md +15 -15
- package/skills/kortix-ui/references/modules.md +15 -15
- package/dist/customize/agents/agent-pin-button.d.ts +0 -10
- package/dist/customize/agents/agent-pin-button.js +0 -20
- package/dist/customize/settings/tabs/transfer-workspace-dialog.d.ts +0 -4
- package/dist/customize/settings/tabs/transfer-workspace-dialog.js +0 -82
- package/dist/internal/account-hub/account-settings-shell.d.ts +0 -7
- package/dist/internal/account-hub/account-settings-shell.js +0 -87
- package/dist/internal/account-hub/account-settings-sidebar.d.ts +0 -2
- package/dist/internal/account-hub/account-settings-sidebar.js +0 -169
- package/dist/internal/lib/use-project-feature-flags.d.ts +0 -28
- package/dist/internal/lib/use-project-feature-flags.js +0 -76
- package/dist/internal/stores/pinned-agents-store.d.ts +0 -26
- package/dist/internal/stores/pinned-agents-store.js +0 -20
- package/dist/primitives/info-banner.d.ts +0 -14
- package/dist/primitives/info-banner.js +0 -72
- package/dist/workspace/new/account-picker.d.ts +0 -71
- package/dist/workspace/new/account-picker.js +0 -92
- package/dist/workspace/new/use-creatable-accounts.d.ts +0 -8
- package/dist/workspace/new/use-creatable-accounts.js +0 -33
- package/dist/workspace/sidebar/modal/session-embed-section.js +0 -71
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UiTranslator } from '../../i18n/index.js';
|
|
2
2
|
import { type AccountRole, type ConnectionShare, type ProjectRole } from '@kortix/sdk';
|
|
3
|
-
import { type ReactNode } from 'react';
|
|
3
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
4
4
|
import { type ShareableObject } from './access-dialog-share.js';
|
|
5
5
|
import { type RoleValue } from './role-select.js';
|
|
6
6
|
export type AccessDialogScope = {
|
|
@@ -205,3 +205,46 @@ export declare function BlastRadiusPreview({ declares, }: {
|
|
|
205
205
|
connectors: string[] | 'all';
|
|
206
206
|
};
|
|
207
207
|
}): import("react").JSX.Element;
|
|
208
|
+
/** The expiry field: the Kortix `Calendar` in a popover, not the browser's
|
|
209
|
+
* native date input. Empty reads "Never"; past days can't be picked. */
|
|
210
|
+
export declare function ExpiryPicker({ id, value, onChange, disabled, }: {
|
|
211
|
+
id: string;
|
|
212
|
+
value: string;
|
|
213
|
+
onChange: (next: string) => void;
|
|
214
|
+
disabled?: boolean;
|
|
215
|
+
}): import("react").JSX.Element;
|
|
216
|
+
/**
|
|
217
|
+
* The two shells `PrincipalAccessDialog` renders its one body in. The modal
|
|
218
|
+
* blocks a close while a save is in flight; the sheet is the body of the
|
|
219
|
+
* account hub's `useAccountHubSheet`, which owns open and close.
|
|
220
|
+
*/
|
|
221
|
+
export interface AccessChrome {
|
|
222
|
+
Root: ComponentType<{
|
|
223
|
+
open: boolean;
|
|
224
|
+
onOpenChange: (open: boolean) => void;
|
|
225
|
+
children?: ReactNode;
|
|
226
|
+
}>;
|
|
227
|
+
Content: ComponentType<{
|
|
228
|
+
children?: ReactNode;
|
|
229
|
+
}>;
|
|
230
|
+
Header: ComponentType<{
|
|
231
|
+
children?: ReactNode;
|
|
232
|
+
}>;
|
|
233
|
+
Title: ComponentType<{
|
|
234
|
+
children?: ReactNode;
|
|
235
|
+
}>;
|
|
236
|
+
Description: ComponentType<{
|
|
237
|
+
children?: ReactNode;
|
|
238
|
+
}>;
|
|
239
|
+
Body: ComponentType<{
|
|
240
|
+
children?: ReactNode;
|
|
241
|
+
}>;
|
|
242
|
+
Footer: ComponentType<{
|
|
243
|
+
children?: ReactNode;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
export declare const MODAL_CHROME: AccessChrome;
|
|
247
|
+
/** Inside the account hub's sheet: the host draws the title row and the
|
|
248
|
+
* scrolling body, so this draws only the fields and a footer that sticks to
|
|
249
|
+
* the bottom of that scroll. */
|
|
250
|
+
export declare const SHEET_CHROME: AccessChrome;
|
|
@@ -30,14 +30,14 @@ import { Checkbox } from '../../primitives/checkbox.js';
|
|
|
30
30
|
import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
|
|
31
31
|
import { EntityAvatar } from '../../primitives/entity-avatar.js';
|
|
32
32
|
import { Field, FieldDescription, FieldLabel } from '../../primitives/field.js';
|
|
33
|
-
import {
|
|
33
|
+
import { Alert as BannerAlert, AlertTitle as BannerAlertTitle, AlertDescription as BannerAlertDescription, AlertActions as BannerAlertActions, AlertMedia as BannerAlertMedia } from '../../primitives/alert.js';
|
|
34
34
|
import { Calendar } from '../../primitives/calendar.js';
|
|
35
35
|
import { Popover, PopoverContent, PopoverTrigger } from '../../primitives/popover.js';
|
|
36
36
|
import { triggerVariants } from '../../primitives/trigger-variants.js';
|
|
37
37
|
import Loading from '../../primitives/loading.js';
|
|
38
38
|
import { Modal, ModalBody, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
|
|
39
39
|
import { Skeleton } from '../../primitives/skeleton.js';
|
|
40
|
-
import { Tabs,
|
|
40
|
+
import { Tabs, TabsList, TabsTrigger } from '../../primitives/tabs.js';
|
|
41
41
|
import { errorToast, successToast, warningToast } from '../../primitives/toast.js';
|
|
42
42
|
import { UserAvatar } from '../../primitives/user-avatar.js';
|
|
43
43
|
import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
|
|
@@ -881,14 +881,14 @@ function PrincipalAccessDialog({ open, onOpenChange, accountId, scope, mode, acc
|
|
|
881
881
|
// Ownership transfer is its own flow — never a grant.
|
|
882
882
|
builtinRoles: roleScope === 'account' && mode.kind === 'grant'
|
|
883
883
|
? ['member', 'admin']
|
|
884
|
-
: undefined }), scope.kind === 'project' && principals.groupIds.length > 0 ? (_jsx(FieldDescription, { children: tI18nComplete.raw('text237f1a28cf06') })) : null] })) : null, scope.kind === 'project' && everyoneSelected ? (
|
|
884
|
+
: undefined }), scope.kind === 'project' && principals.groupIds.length > 0 ? (_jsx(FieldDescription, { children: tI18nComplete.raw('text237f1a28cf06') })) : null] })) : null, scope.kind === 'project' && everyoneSelected ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertMedia, { children: _jsx(UsersThreeIcon, {}) }), _jsx(BannerAlertDescription, { children: tSharing('everyoneRoleNote', { project: scope.projectName }) })] })) : null, scope.kind === 'project' && showAgentCeilingNote ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertMedia, { children: _jsx(RobotIcon, {}) }), _jsx(BannerAlertTitle, { children: tAgents('ceilingNoteTitle') }), _jsx(BannerAlertDescription, { children: _jsx("span", { "data-testid": "agent-ceiling-note", children: tAgents('ceilingNote') }) })] })) : null, showAgents ? (_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { children: tI18nComplete.raw('text279b44d2ab4b') }), resourceGrantsQuery.isError ? (_jsxs(BannerAlert, { variant: "destructive", children: [_jsx(BannerAlertDescription, { children: resourceGrantsQuery.error.message }), _jsx(BannerAlertActions, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: () => void resourceGrantsQuery.refetch(), children: tCommon('retry') }) })] })) : resourceGrantsQuery.isLoading ? (_jsx(Skeleton, { className: "h-6 w-full rounded-md" })) : null, _jsx(Tabs, { value: agents.mode, onValueChange: (next) => setAgents(next === 'all' ? ALL_AGENTS : { mode: 'subset', ids: agents.ids }), children: _jsxs(TabsList, { size: "xs", children: [_jsx(TabsTrigger, { value: "all", children: tI18nComplete.raw('text54c32d3e2cfa') }), _jsx(TabsTrigger, { value: "subset", children: tI18nComplete.raw('textb080141d6840') })] }) }), agents.mode === 'all' ? (_jsx(FieldDescription, { children: projectAgents.length === 0
|
|
885
885
|
? tI18nComplete.raw('text7bf9d07dcb99')
|
|
886
886
|
: tI18nComplete('textc5bb9fda9711', { value0: projectAgents.length }) })) : null, agents.mode === 'subset' ? (resourceGrantsQuery.isLoading ? (_jsx(Skeleton, { className: "h-24 w-full rounded-md" })) : projectAgents.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: tI18nComplete.raw('text7bf9d07dcb99') })) : (_jsx("div", { className: "border-border max-h-40 overflow-y-auto rounded-md border p-1", children: projectAgents.map((agent) => (_jsx(Checkbox, { label: agent.name, checked: selectedAgentIdSet.has(agent.id), disabled: pending, onCheckedChange: () => setAgents((prev) => ({
|
|
887
887
|
mode: 'subset',
|
|
888
888
|
ids: prev.ids.includes(agent.id)
|
|
889
889
|
? prev.ids.filter((x) => x !== agent.id)
|
|
890
890
|
: [...prev.ids, agent.id],
|
|
891
|
-
})) }, agent.id))) }))) : null, selectedAgentDeclares ? (_jsx(BlastRadiusPreview, { declares: selectedAgentDeclares })) : null] })) : null, showAccountAdminBanner ? (_jsx(
|
|
891
|
+
})) }, agent.id))) }))) : null, selectedAgentDeclares ? (_jsx(BlastRadiusPreview, { declares: selectedAgentDeclares })) : null] })) : null, showAccountAdminBanner ? (_jsx(BannerAlert, { variant: "default", children: _jsx(BannerAlertDescription, { children: tI18nComplete.raw('text65abb6edc2c0') }) })) : showProjectAccessSection ? (_jsx(ProjectAccessRows, { accountId: accountId, rows: projectGrants, onChange: setProjectGrants, expanded: projectAccessOpen, onExpand: () => {
|
|
892
892
|
setProjectAccessOpen(true);
|
|
893
893
|
if (projectGrants.length === 0) {
|
|
894
894
|
setProjectGrants([{ project_id: '', role: 'member' }]);
|
|
@@ -901,7 +901,7 @@ function PrincipalAccessDialog({ open, onOpenChange, accountId, scope, mode, acc
|
|
|
901
901
|
? scope.projectName
|
|
902
902
|
: scope.kind === 'group'
|
|
903
903
|
? scope.groupName
|
|
904
|
-
: (accountName ?? 'this
|
|
904
|
+
: (accountName ?? 'this workspace'),
|
|
905
905
|
inherited: inheritedFrom,
|
|
906
906
|
}, tI18nComplete) })) : null] }));
|
|
907
907
|
}
|
|
@@ -946,7 +946,7 @@ function parseDateValue(value) {
|
|
|
946
946
|
}
|
|
947
947
|
/** The expiry field: the Kortix `Calendar` in a popover, not the browser's
|
|
948
948
|
* native date input. Empty reads "Never"; past days can't be picked. */
|
|
949
|
-
function ExpiryPicker({ id, value, onChange, disabled, }) {
|
|
949
|
+
export function ExpiryPicker({ id, value, onChange, disabled, }) {
|
|
950
950
|
const tI18nComplete = useI18nTranslations('hardcodedUi.i18nComplete');
|
|
951
951
|
const [open, setOpen] = useState(false);
|
|
952
952
|
const selected = parseDateValue(value);
|
|
@@ -960,7 +960,7 @@ function ExpiryPicker({ id, value, onChange, disabled, }) {
|
|
|
960
960
|
setOpen(false);
|
|
961
961
|
}, children: tI18nComplete.raw('text83b12c2216ef') }) })) : null] })] }));
|
|
962
962
|
}
|
|
963
|
-
const MODAL_CHROME = {
|
|
963
|
+
export const MODAL_CHROME = {
|
|
964
964
|
Root: Modal,
|
|
965
965
|
Content: ({ children }) => (_jsx(ModalContent, { className: "sm:max-w-md", children: children })),
|
|
966
966
|
Header: ModalHeader,
|
|
@@ -973,7 +973,7 @@ const Passthrough = ({ children }) => _jsx(_Fragment, { children: children });
|
|
|
973
973
|
/** Inside the account hub's sheet: the host draws the title row and the
|
|
974
974
|
* scrolling body, so this draws only the fields and a footer that sticks to
|
|
975
975
|
* the bottom of that scroll. */
|
|
976
|
-
const SHEET_CHROME = {
|
|
976
|
+
export const SHEET_CHROME = {
|
|
977
977
|
Root: Passthrough,
|
|
978
978
|
// Fills the sheet body's height so `mt-auto` can push the footer to the
|
|
979
979
|
// bottom edge even when the form is short.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AgentIdentity, type IamRole, type RoleAssignment } from '@kortix/sdk';
|
|
2
|
-
/** Never an agent's, whatever its role or its `kortix_permissions` say
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
/** Never an agent's, whatever its role or its `kortix_permissions` say: the
|
|
3
|
+
* HUMAN_ONLY set the API enforces (minting credentials, moving money). None of
|
|
4
|
+
* them is in the grantable catalog, so only an explicit list can name one. */
|
|
5
5
|
export declare const HUMAN_ONLY_PERMISSIONS: readonly string[];
|
|
6
6
|
/** Every project permission `kortix_permissions` may name. */
|
|
7
7
|
export declare const GRANTABLE_PROJECT_PERMISSIONS: readonly string[];
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
// the IAM half. Enforcement is server-side (`apps/api/src/iam/authorize.ts`);
|
|
15
15
|
// nothing here decides access.
|
|
16
16
|
import { getRolePermissions, listAgentIdentities, listProjectAgentIdentities, listAssignments, listRoles, } from '@kortix/sdk';
|
|
17
|
+
import { HUMAN_ONLY } from '../../_vendor/kortix-shared.js';
|
|
17
18
|
import { useQueries, useQuery } from '@tanstack/react-query';
|
|
18
19
|
import { useMemo } from 'react';
|
|
19
20
|
import { KORTIX_PERMISSIONS_CATALOG } from '../../customize/sections/view/agent-editor-catalog.js';
|
|
20
|
-
/** Never an agent's, whatever its role or its `kortix_permissions` say
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
export const HUMAN_ONLY_PERMISSIONS = [
|
|
21
|
+
/** Never an agent's, whatever its role or its `kortix_permissions` say: the
|
|
22
|
+
* HUMAN_ONLY set the API enforces (minting credentials, moving money). None of
|
|
23
|
+
* them is in the grantable catalog, so only an explicit list can name one. */
|
|
24
|
+
export const HUMAN_ONLY_PERMISSIONS = [...HUMAN_ONLY];
|
|
24
25
|
/** Every project permission `kortix_permissions` may name. */
|
|
25
26
|
export const GRANTABLE_PROJECT_PERMISSIONS = KORTIX_PERMISSIONS_CATALOG.flatMap((group) => group.actions);
|
|
26
27
|
/** Always granted to an agent inside its own project (spec §2.1). */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
|
|
3
|
+
* chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
|
|
4
|
+
* a transfer, never an invite), and an optional expiry. It sends
|
|
5
|
+
* `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
|
|
6
|
+
* The server writes the storage the role needs, so the dialog never asks for
|
|
7
|
+
* a project grant. A `split_pending` workspace (a legacy account that still
|
|
8
|
+
* holds several workspaces) keeps the per-workspace grant dialog
|
|
9
|
+
* (`AccessDialog`).
|
|
10
|
+
*
|
|
11
|
+
* The same body renders in the account hub's split sheet (Members › Invite)
|
|
12
|
+
* and in a Modal.
|
|
13
|
+
*/
|
|
14
|
+
import { type WorkspaceRole } from '@kortix/sdk';
|
|
15
|
+
/** The roles an invite can carry, lowest first. */
|
|
16
|
+
export type InviteRole = Exclude<WorkspaceRole, 'owner'>;
|
|
17
|
+
export declare const INVITE_ROLES: readonly InviteRole[];
|
|
18
|
+
/**
|
|
19
|
+
* Split typed text into emails: commas, semicolons, spaces and new lines
|
|
20
|
+
* separate them. Returns the valid emails (lowercased, de-duplicated against
|
|
21
|
+
* `existing`) and what is left over (a partial or invalid entry stays typed).
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseInviteEmails(text: string, existing: readonly string[]): {
|
|
24
|
+
emails: string[];
|
|
25
|
+
rest: string;
|
|
26
|
+
};
|
|
27
|
+
export interface InvitePeopleDialogProps {
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
workspaceName: string;
|
|
30
|
+
open: boolean;
|
|
31
|
+
onOpenChange: (open: boolean) => void;
|
|
32
|
+
/** `member.update`: only then may an invite make an Admin. */
|
|
33
|
+
canGrantAdmin: boolean;
|
|
34
|
+
/** After the invites were sent (members, invites and probes changed). */
|
|
35
|
+
onDone?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }: InvitePeopleDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
|
|
5
|
+
* chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
|
|
6
|
+
* a transfer, never an invite), and an optional expiry. It sends
|
|
7
|
+
* `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
|
|
8
|
+
* The server writes the storage the role needs, so the dialog never asks for
|
|
9
|
+
* a project grant. A `split_pending` workspace (a legacy account that still
|
|
10
|
+
* holds several workspaces) keeps the per-workspace grant dialog
|
|
11
|
+
* (`AccessDialog`).
|
|
12
|
+
*
|
|
13
|
+
* The same body renders in the account hub's split sheet (Members › Invite)
|
|
14
|
+
* and in a Modal.
|
|
15
|
+
*/
|
|
16
|
+
import { inviteWorkspaceMember } from '@kortix/sdk';
|
|
17
|
+
import { XIcon } from '@phosphor-icons/react';
|
|
18
|
+
import { useMutation } from '@tanstack/react-query';
|
|
19
|
+
import { useState } from 'react';
|
|
20
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
21
|
+
import { useInAccountHubSheetBody } from '../../internal/account-hub/hub-sheet.js';
|
|
22
|
+
import { Badge } from '../../primitives/badge.js';
|
|
23
|
+
import { Button } from '../../primitives/button.js';
|
|
24
|
+
import { Field, FieldDescription, FieldLabel } from '../../primitives/field.js';
|
|
25
|
+
import Loading from '../../primitives/loading.js';
|
|
26
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
|
|
27
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
28
|
+
import { ExpiryPicker, MODAL_CHROME, SHEET_CHROME } from './access-dialog.js';
|
|
29
|
+
import { endOfLocalDayIso } from './access-shared.js';
|
|
30
|
+
import { isInviteEmail } from './principal-picker.js';
|
|
31
|
+
export const INVITE_ROLES = ['member', 'manager', 'admin'];
|
|
32
|
+
/**
|
|
33
|
+
* Split typed text into emails: commas, semicolons, spaces and new lines
|
|
34
|
+
* separate them. Returns the valid emails (lowercased, de-duplicated against
|
|
35
|
+
* `existing`) and what is left over (a partial or invalid entry stays typed).
|
|
36
|
+
*/
|
|
37
|
+
export function parseInviteEmails(text, existing) {
|
|
38
|
+
const parts = text.split(/[\s,;]+/);
|
|
39
|
+
const emails = [];
|
|
40
|
+
const rest = [];
|
|
41
|
+
const seen = new Set(existing);
|
|
42
|
+
for (const part of parts) {
|
|
43
|
+
const value = part.trim().toLowerCase();
|
|
44
|
+
if (!value)
|
|
45
|
+
continue;
|
|
46
|
+
if (isInviteEmail(value)) {
|
|
47
|
+
if (!seen.has(value)) {
|
|
48
|
+
seen.add(value);
|
|
49
|
+
emails.push(value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
rest.push(part.trim());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { emails, rest: rest.join(' ') };
|
|
57
|
+
}
|
|
58
|
+
export function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }) {
|
|
59
|
+
const t = useTranslations('workspaces.invite');
|
|
60
|
+
const tRoles = useTranslations('workspaces.roles');
|
|
61
|
+
const chrome = useInAccountHubSheetBody() ? SHEET_CHROME : MODAL_CHROME;
|
|
62
|
+
const [emails, setEmails] = useState([]);
|
|
63
|
+
const [draft, setDraft] = useState('');
|
|
64
|
+
const [role, setRole] = useState('member');
|
|
65
|
+
const [expires, setExpires] = useState('');
|
|
66
|
+
const [failures, setFailures] = useState([]);
|
|
67
|
+
const commit = (text) => {
|
|
68
|
+
const parsed = parseInviteEmails(text, emails);
|
|
69
|
+
if (parsed.emails.length > 0)
|
|
70
|
+
setEmails((current) => [...current, ...parsed.emails]);
|
|
71
|
+
setDraft(parsed.rest);
|
|
72
|
+
return parsed;
|
|
73
|
+
};
|
|
74
|
+
const send = useMutation({
|
|
75
|
+
mutationFn: async (list) => {
|
|
76
|
+
const expiresIso = endOfLocalDayIso(expires);
|
|
77
|
+
const results = await Promise.allSettled(list.map((email) => inviteWorkspaceMember(workspaceId, { email, role, ...(expiresIso ? { expires_at: expiresIso } : {}) })));
|
|
78
|
+
return results.map((result, index) => ({
|
|
79
|
+
email: list[index],
|
|
80
|
+
ok: result.status === 'fulfilled',
|
|
81
|
+
message: result.status === 'rejected' ? result.reason?.message || t('sendFailed') : '',
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
onSuccess: (results) => {
|
|
85
|
+
const sent = results.filter((result) => result.ok);
|
|
86
|
+
const failed = results.filter((result) => !result.ok);
|
|
87
|
+
if (sent.length > 0) {
|
|
88
|
+
successToast(t('sentToast', { count: sent.length }));
|
|
89
|
+
onDone?.();
|
|
90
|
+
}
|
|
91
|
+
setFailures(failed.map(({ email, message }) => ({ email, message })));
|
|
92
|
+
// The emails that failed stay as chips, so a fix is one more click.
|
|
93
|
+
setEmails(failed.map((result) => result.email));
|
|
94
|
+
if (failed.length === 0) {
|
|
95
|
+
setEmails([]);
|
|
96
|
+
setExpires('');
|
|
97
|
+
setRole('member');
|
|
98
|
+
onOpenChange(false);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onError: (error) => errorToast(error.message || t('sendFailed')),
|
|
102
|
+
});
|
|
103
|
+
const pending = send.isPending;
|
|
104
|
+
const submit = () => {
|
|
105
|
+
const parsed = commit(draft);
|
|
106
|
+
const list = [...emails, ...parsed.emails];
|
|
107
|
+
if (list.length === 0 || parsed.rest)
|
|
108
|
+
return;
|
|
109
|
+
send.mutate(list);
|
|
110
|
+
};
|
|
111
|
+
const onKeyDown = (event) => {
|
|
112
|
+
if (event.key === 'Enter' || event.key === ',' || event.key === ' ' || event.key === 'Tab') {
|
|
113
|
+
if (!draft.trim()) {
|
|
114
|
+
if (event.key === 'Enter') {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
submit();
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
commit(draft);
|
|
122
|
+
}
|
|
123
|
+
else if (event.key === 'Backspace' && !draft && emails.length > 0) {
|
|
124
|
+
setEmails((current) => current.slice(0, -1));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const invalidDraft = draft.trim().length > 0 && !isInviteEmail(draft);
|
|
128
|
+
const canSubmit = !pending && (emails.length > 0 || isInviteEmail(draft));
|
|
129
|
+
const roles = INVITE_ROLES.filter((value) => value !== 'admin' || canGrantAdmin);
|
|
130
|
+
return (_jsx(chrome.Root, { open: open, onOpenChange: (next) => (pending ? undefined : onOpenChange(next)), children: _jsxs(chrome.Content, { children: [_jsxs(chrome.Header, { children: [_jsx(chrome.Title, { children: t('title', { name: workspaceName }) }), _jsx(chrome.Description, { children: t('description') })] }), _jsxs("form", { className: "contents", onSubmit: (event) => {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
submit();
|
|
133
|
+
}, children: [_jsxs(chrome.Body, { children: [_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-emails", children: t('emailsLabel') }), _jsxs("div", { className: "bg-popover focus-within:ring-ring flex min-h-9 flex-wrap items-center gap-1 rounded-md border px-2 py-1 focus-within:ring-1", "data-testid": "invite-emails", children: [emails.map((email) => (_jsxs(Badge, { variant: "secondary", size: "sm", className: "gap-1", children: [email, _jsx("button", { type: "button", "aria-label": t('removeEmail', { email }), className: "text-muted-foreground hover:text-foreground", onClick: () => setEmails((current) => current.filter((value) => value !== email)), disabled: pending, children: _jsx(XIcon, { className: "size-3" }) })] }, email))), _jsx("input", { id: "invite-emails", type: "text", inputMode: "email", autoComplete: "off", autoFocus: true, value: draft, onChange: (event) => setDraft(event.target.value), onKeyDown: onKeyDown, onBlur: () => draft.trim() && commit(draft), onPaste: (event) => {
|
|
134
|
+
const text = event.clipboardData.getData('text');
|
|
135
|
+
if (/[\s,;]/.test(text)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
commit(`${draft} ${text}`);
|
|
138
|
+
}
|
|
139
|
+
}, placeholder: emails.length === 0 ? t('emailsPlaceholder') : undefined, "aria-invalid": invalidDraft || undefined, disabled: pending, className: "text-foreground placeholder:text-muted-foreground min-w-32 flex-1 bg-transparent py-1 text-sm outline-none" })] }), _jsx(FieldDescription, { children: invalidDraft ? t('invalidEmail') : t('emailsHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setRole(value), disabled: pending, children: [_jsx(SelectTrigger, { id: "invite-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] }), _jsx(FieldDescription, { children: t('ownerHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [_jsx(FieldLabel, { htmlFor: "invite-expires", children: t('expiresLabel') }), _jsx("span", { className: "text-muted-foreground text-xs", children: t('optional') })] }), _jsx(ExpiryPicker, { id: "invite-expires", value: expires, onChange: setExpires, disabled: pending }), _jsx(FieldDescription, { children: t('expiresHint') })] }), failures.length > 0 ? (_jsx("ul", { role: "alert", className: "space-y-1", "data-testid": "invite-failures", children: failures.map((failure) => (_jsxs("li", { className: "text-destructive text-xs", children: [_jsx("span", { className: "font-medium", children: failure.email }), ": ", failure.message] }, failure.email))) })) : null] }), _jsxs(chrome.Footer, { children: [_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", disabled: pending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: !canSubmit, className: "gap-1.5", "data-testid": "invite-send", children: [pending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('send', { count: Math.max(1, emails.length + (isInviteEmail(draft) ? 1 : 0)) })] })] })] })] }) }));
|
|
140
|
+
}
|
|
@@ -107,9 +107,10 @@ export function everyoneMatchesQuery(label, query) {
|
|
|
107
107
|
const q = query.trim().toLowerCase();
|
|
108
108
|
return q === '' || label.toLowerCase().includes(q);
|
|
109
109
|
}
|
|
110
|
-
export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel
|
|
110
|
+
export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel, allExcludedLabel, autoFocus = true, disabled = false, searchPlaceholder, className, }) {
|
|
111
111
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
112
112
|
const tAgents = useTranslations('agentPrincipals');
|
|
113
|
+
const tSharing = useTranslations('accessSharing');
|
|
113
114
|
const [query, setQuery] = useState('');
|
|
114
115
|
// Single mode collapses to a "selected + Change" row once something is
|
|
115
116
|
// chosen; `editing` re-opens the list without clearing the value.
|
|
@@ -255,7 +256,7 @@ export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member',
|
|
|
255
256
|
return (_jsxs("div", { className: cn('border-border overflow-hidden rounded-md border', className), children: [_jsxs(InputGroupSearch, { className: "border-b", children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: placeholder, variant: "popover", disabled: disabled,
|
|
256
257
|
// Every caller opens this as the first interactive element of a
|
|
257
258
|
// fresh dialog — typing starts the instant it is open.
|
|
258
|
-
autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel })) : filteredGroups.length === 0 &&
|
|
259
|
+
autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel ?? tSharing('pickerEmpty') })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel ?? tSharing('pickerAllAdded') })) : filteredGroups.length === 0 &&
|
|
259
260
|
filteredMembers.length === 0 &&
|
|
260
261
|
filteredAgents.length === 0 &&
|
|
261
262
|
!inviteCandidate &&
|
|
@@ -17,11 +17,11 @@ import { useMemo } from 'react';
|
|
|
17
17
|
const DEFAULT_EMPTY_TEXT = {
|
|
18
18
|
none: 'No projects in this account yet.',
|
|
19
19
|
allExcluded: 'Already attached to every project you can manage.',
|
|
20
|
-
noneEligible: 'You need Manager access on a
|
|
20
|
+
noneEligible: 'You need Manager access on a workspace to attach a group to it.',
|
|
21
21
|
};
|
|
22
22
|
/** Sentinel for the optional "every project" row — never a real project id. */
|
|
23
23
|
export const PROJECT_SELECT_ALL = '__all__';
|
|
24
|
-
export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a
|
|
24
|
+
export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a workspace', emptyText, enabled = true, requireAction, id, className, }) {
|
|
25
25
|
const projectsQuery = useQuery({
|
|
26
26
|
queryKey: qk.projects.list(accountId),
|
|
27
27
|
queryFn: () => listProjectsForAccount(accountId),
|
|
@@ -23,17 +23,18 @@ interface RoleDescriptor {
|
|
|
23
23
|
summary: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Single source of truth for how a built-in role is described in the UI.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Single source of truth for how a built-in role is described in the UI. One
|
|
27
|
+
* workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
|
|
28
|
+
* storage still has two scopes (owner/admin/member on the account, manager on
|
|
29
|
+
* the workspace's project), but a person reads one role per workspace, so the
|
|
30
|
+
* labels never say "account" or "project".
|
|
29
31
|
*/
|
|
30
32
|
export declare const ACCOUNT_ROLE_DESCRIPTORS: Record<AccountRole, RoleDescriptor>;
|
|
31
33
|
/**
|
|
32
|
-
* The two
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* keys and the URL vocabulary); only what a person reads changed.
|
|
34
|
+
* The two rungs a workspace's project row stores (Marko, 2026-09-03): a
|
|
35
|
+
* member USES agents — the ones they are granted — and a manager CONFIGURES
|
|
36
|
+
* the workspace, which is Customize. The keys stay `member` / `manager` (they
|
|
37
|
+
* are the API's role keys and the URL vocabulary).
|
|
37
38
|
*/
|
|
38
39
|
export declare const PROJECT_ROLE_DESCRIPTORS: Record<OfferedProjectRole, RoleDescriptor>;
|
|
39
40
|
export declare function builtinRoleDescriptor(scope: RoleScope, role: AccountRole | ProjectRole, tI18nComplete?: UiTranslator): RoleDescriptor | undefined;
|
|
@@ -43,44 +43,41 @@ export function builtinRolesForScope(scope) {
|
|
|
43
43
|
return scope === 'account' ? [...ACCOUNT_ROLES_ASCENDING] : [...PROJECT_ROLES_ASCENDING];
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Single source of truth for how a built-in role is described in the UI.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* Single source of truth for how a built-in role is described in the UI. One
|
|
47
|
+
* workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
|
|
48
|
+
* storage still has two scopes (owner/admin/member on the account, manager on
|
|
49
|
+
* the workspace's project), but a person reads one role per workspace, so the
|
|
50
|
+
* labels never say "account" or "project".
|
|
49
51
|
*/
|
|
50
52
|
export const ACCOUNT_ROLE_DESCRIPTORS = {
|
|
51
53
|
owner: {
|
|
52
|
-
label: '
|
|
53
|
-
blurb: 'Full control
|
|
54
|
-
summary: 'Full control of the
|
|
54
|
+
label: 'Owner',
|
|
55
|
+
blurb: 'Full control: billing, people, and deleting the workspace.',
|
|
56
|
+
summary: 'Full control of the workspace: billing, people, transferring ownership and deleting it.',
|
|
55
57
|
},
|
|
56
58
|
admin: {
|
|
57
|
-
label: '
|
|
58
|
-
blurb: 'Everything except deleting the
|
|
59
|
-
summary: 'Everything an owner can do except deleting the
|
|
59
|
+
label: 'Admin',
|
|
60
|
+
blurb: 'Billing and people. Everything except deleting the workspace or transferring ownership.',
|
|
61
|
+
summary: 'Everything an owner can do except deleting the workspace or transferring ownership.',
|
|
60
62
|
},
|
|
61
63
|
member: {
|
|
62
|
-
label: '
|
|
63
|
-
blurb: '
|
|
64
|
-
summary: 'The floor role
|
|
64
|
+
label: 'Member',
|
|
65
|
+
blurb: 'Works in sessions with the agents they are granted.',
|
|
66
|
+
summary: 'The floor role. Works in sessions with the agents they are granted, directly or through a group. No Customize.',
|
|
65
67
|
},
|
|
66
68
|
};
|
|
67
69
|
/**
|
|
68
|
-
* The two
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* keys and the URL vocabulary); only what a person reads changed.
|
|
70
|
+
* The two rungs a workspace's project row stores (Marko, 2026-09-03): a
|
|
71
|
+
* member USES agents — the ones they are granted — and a manager CONFIGURES
|
|
72
|
+
* the workspace, which is Customize. The keys stay `member` / `manager` (they
|
|
73
|
+
* are the API's role keys and the URL vocabulary).
|
|
73
74
|
*/
|
|
74
75
|
export const PROJECT_ROLE_DESCRIPTORS = {
|
|
75
|
-
member:
|
|
76
|
-
label: 'Project member',
|
|
77
|
-
blurb: 'Starts and works in sessions with the agents they are granted. No Customize.',
|
|
78
|
-
summary: 'Starts and works in sessions with the agents they are granted — nothing else. No access to Customize. The project floor role.',
|
|
79
|
-
},
|
|
76
|
+
member: ACCOUNT_ROLE_DESCRIPTORS.member,
|
|
80
77
|
manager: {
|
|
81
|
-
label: '
|
|
82
|
-
blurb: 'Customize and everything in it
|
|
83
|
-
summary: 'Customize and everything in it
|
|
78
|
+
label: 'Manager',
|
|
79
|
+
blurb: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
|
|
80
|
+
summary: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
|
|
84
81
|
},
|
|
85
82
|
};
|
|
86
83
|
export function builtinRoleDescriptor(scope, role, tI18nComplete) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change a person's one role in a workspace (design.md C3):
|
|
3
|
+
* `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
|
|
4
|
+
* Admin > Manager > Member; the server writes the storage each rung needs, and
|
|
5
|
+
* only an owner can make an owner.
|
|
6
|
+
*/
|
|
7
|
+
import { type WorkspaceRole } from '@kortix/sdk';
|
|
8
|
+
/** The ladder, highest first. */
|
|
9
|
+
export declare const WORKSPACE_ROLE_LADDER: readonly WorkspaceRole[];
|
|
10
|
+
/** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
|
|
11
|
+
export declare function assignableWorkspaceRoles(input: {
|
|
12
|
+
viewerIsOwner: boolean;
|
|
13
|
+
canGrantAdmin: boolean;
|
|
14
|
+
}): WorkspaceRole[];
|
|
15
|
+
export interface WorkspaceRoleDialogProps {
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
target: {
|
|
18
|
+
userId: string;
|
|
19
|
+
label: string;
|
|
20
|
+
role: WorkspaceRole;
|
|
21
|
+
} | null;
|
|
22
|
+
onOpenChange: (open: boolean) => void;
|
|
23
|
+
viewerIsOwner: boolean;
|
|
24
|
+
canGrantAdmin: boolean;
|
|
25
|
+
onDone?: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }: WorkspaceRoleDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Change a person's one role in a workspace (design.md C3):
|
|
5
|
+
* `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
|
|
6
|
+
* Admin > Manager > Member; the server writes the storage each rung needs, and
|
|
7
|
+
* only an owner can make an owner.
|
|
8
|
+
*/
|
|
9
|
+
import { updateWorkspaceMemberRole } from '@kortix/sdk';
|
|
10
|
+
import { useMutation } from '@tanstack/react-query';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
13
|
+
import { Button } from '../../primitives/button.js';
|
|
14
|
+
import { Field, FieldLabel } from '../../primitives/field.js';
|
|
15
|
+
import Loading from '../../primitives/loading.js';
|
|
16
|
+
import { Modal, ModalBody, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
|
|
17
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
|
|
18
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
19
|
+
/** The ladder, highest first. */
|
|
20
|
+
export const WORKSPACE_ROLE_LADDER = ['owner', 'admin', 'manager', 'member'];
|
|
21
|
+
/** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
|
|
22
|
+
export function assignableWorkspaceRoles(input) {
|
|
23
|
+
return WORKSPACE_ROLE_LADDER.filter((role) => (role !== 'owner' || input.viewerIsOwner) && (role !== 'admin' || input.canGrantAdmin));
|
|
24
|
+
}
|
|
25
|
+
export function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }) {
|
|
26
|
+
const t = useTranslations('workspaces.roleDialog');
|
|
27
|
+
const tRoles = useTranslations('workspaces.roles');
|
|
28
|
+
const [picked, setPicked] = useState(null);
|
|
29
|
+
const role = picked ?? target?.role ?? 'member';
|
|
30
|
+
const roles = assignableWorkspaceRoles({ viewerIsOwner, canGrantAdmin });
|
|
31
|
+
const save = useMutation({
|
|
32
|
+
mutationFn: () => updateWorkspaceMemberRole(workspaceId, target.userId, role),
|
|
33
|
+
onSuccess: () => {
|
|
34
|
+
successToast(t('savedToast', { name: target?.label ?? '', role: tRoles(`${role}.label`) }));
|
|
35
|
+
setPicked(null);
|
|
36
|
+
onOpenChange(false);
|
|
37
|
+
onDone?.();
|
|
38
|
+
},
|
|
39
|
+
onError: (error) => errorToast(error.message || t('saveFailed')),
|
|
40
|
+
});
|
|
41
|
+
return (_jsx(Modal, { open: target !== null, onOpenChange: (open) => {
|
|
42
|
+
if (save.isPending)
|
|
43
|
+
return;
|
|
44
|
+
if (!open)
|
|
45
|
+
setPicked(null);
|
|
46
|
+
onOpenChange(open);
|
|
47
|
+
}, children: _jsxs(ModalContent, { className: "sm:max-w-md", children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: t('title', { name: target?.label ?? '' }) }), _jsx(ModalDescription, { children: t('description') })] }), _jsx(ModalBody, { children: _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "workspace-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setPicked(value), disabled: save.isPending, children: [_jsx(SelectTrigger, { id: "workspace-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] })] }) }), _jsxs(ModalFooter, { children: [_jsx(Button, { variant: "outline-ghost", size: "sm", disabled: save.isPending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { size: "sm", className: "gap-1.5", disabled: save.isPending || role === target?.role, onClick: () => save.mutate(), children: [save.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('save')] })] })] }) }));
|
|
48
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* "Add a GitHub account" — the ONE dialog for linking a GitHub personal
|
|
3
|
-
* account or organization to a Kortix account. The account Git tab and `/new`
|
|
3
|
+
* account or organization to a Kortix account. The account Git tab and `/workspaces/new`
|
|
4
4
|
* both open it, so the two surfaces can never drift into two different
|
|
5
5
|
* stories about how a connection is made.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { rememberGitHubSetupReturn } from '../../internal/lib/github-installatio
|
|
|
8
8
|
import { GithubLogoIcon as Github } from '@phosphor-icons/react';
|
|
9
9
|
/**
|
|
10
10
|
* "Add a GitHub account" — the ONE dialog for linking a GitHub personal
|
|
11
|
-
* account or organization to a Kortix account. The account Git tab and `/new`
|
|
11
|
+
* account or organization to a Kortix account. The account Git tab and `/workspaces/new`
|
|
12
12
|
* both open it, so the two surfaces can never drift into two different
|
|
13
13
|
* stories about how a connection is made.
|
|
14
14
|
*
|
|
@@ -51,3 +51,21 @@ export declare function defaultExpiryOption(policy: PatPolicy | null | undefined
|
|
|
51
51
|
* testable.
|
|
52
52
|
*/
|
|
53
53
|
export declare function expiresAtIso(value: ExpiryOptionValue, now?: number): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* What a person may pick for a new API key (a workspace key or a personal
|
|
56
|
+
* key). Unlike a service account, a key always expires unless the workspace
|
|
57
|
+
* policy allows no expiry (`allow_no_expiry`, and not `require_expiry`):
|
|
58
|
+
*
|
|
59
|
+
* - every preset up to the policy maximum (365 days when none is set);
|
|
60
|
+
* - a maximum shorter than every preset becomes the only offer;
|
|
61
|
+
* - "Never" only when the policy allows it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function keyExpiryOptions(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOption[];
|
|
64
|
+
/** The pre-selected expiry of a new key: 90 days, or the longest the policy allows. */
|
|
65
|
+
export declare function defaultKeyExpiryOption(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOptionValue;
|
|
66
|
+
/**
|
|
67
|
+
* The `expiresAt` a key mint sends: an ISO instant, or `null` for "Never".
|
|
68
|
+
* `null` is explicit because the API gives a key without `expires_at` the
|
|
69
|
+
* default lifetime (90 days), not "no expiry".
|
|
70
|
+
*/
|
|
71
|
+
export declare function keyExpiresAt(value: ExpiryOptionValue, now?: number): string | null;
|