@kortix/ui 0.16.3 → 0.16.5
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 +1 -4
- package/dist/customize/sections/view/review-center-connected.js +64 -71
- package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
- package/dist/customize/sections/view/secret-delivery.js +20 -29
- package/dist/customize/sections/view/secrets-view.js +9 -24
- package/dist/customize/settings/rail-copy-context.d.ts +2 -0
- package/dist/customize/settings/rail-copy-context.js +2 -0
- package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
- package/dist/files/renderers/show-content-renderer.js +3 -1
- package/dist/i18n/en.d.ts +130 -22
- package/dist/i18n/en.js +142 -34
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
- package/dist/internal/auth/auth-card-shell.d.ts +24 -3
- package/dist/internal/auth/auth-card-shell.js +15 -8
- package/dist/internal/auth/auth-primitives.d.ts +15 -2
- package/dist/internal/auth/auth-primitives.js +22 -5
- package/dist/internal/chrome/chrome-connect.d.ts +3 -5
- package/dist/internal/chrome/chrome-connect.js +7 -10
- package/dist/internal/chrome/extension.d.ts +1 -8
- package/dist/internal/chrome/extension.js +1 -8
- package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
- package/dist/internal/chrome/use-chrome-offered.js +13 -15
- package/dist/internal/components/agent-mark.d.ts +2 -1
- package/dist/internal/components/agent-mark.js +14 -3
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/layout/project-nav-row.d.ts +3 -1
- package/dist/internal/layout/project-nav-row.js +2 -2
- package/dist/internal/layout/project-page-header.js +5 -4
- package/dist/internal/stores/user-preferences-store.d.ts +17 -0
- package/dist/internal/stores/user-preferences-store.js +5 -0
- package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
- package/dist/markdown/setup-links/secret-intake-form.js +60 -16
- package/dist/markdown/setup-links/setup-link-button.js +6 -1
- package/dist/primitives/color-picker.d.ts +19 -0
- package/dist/primitives/color-picker.js +27 -0
- package/dist/primitives/faded-scroll-area.js +4 -0
- package/dist/primitives/glyph-picker.d.ts +11 -0
- package/dist/primitives/glyph-picker.js +10 -6
- package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
- package/dist/primitives/gradient-wallpaper-gl.js +446 -0
- package/dist/primitives/gradient-wallpaper.d.ts +20 -0
- package/dist/primitives/gradient-wallpaper.js +242 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/session/agents/agent-hover-card.d.ts +26 -0
- package/dist/session/agents/agent-hover-card.js +70 -0
- package/dist/session/agents/agent-strip.js +33 -7
- package/dist/session/agents/agent-surface.d.ts +26 -1
- package/dist/session/agents/agent-surface.js +57 -6
- package/dist/session/agents/held-messages.js +2 -2
- package/dist/session/agents/subagent-dialog-content.js +2 -2
- package/dist/session/composer/ComposerCard.js +4 -4
- package/dist/session/composer/composer-toolbar.d.ts +8 -1
- package/dist/session/composer/composer-toolbar.js +2 -2
- package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
- package/dist/session/composer/dictation/dictation-control.js +28 -0
- package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
- package/dist/session/composer/dictation/dictation-state.js +71 -0
- package/dist/session/composer/dictation/recorder.d.ts +30 -0
- package/dist/session/composer/dictation/recorder.js +129 -0
- package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
- package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
- package/dist/session/composer/queued-prompt-list.js +5 -1
- package/dist/session/panel/easy/apps-card.js +3 -10
- package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
- package/dist/session/panel/easy/background-tasks-card.js +119 -0
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.js +4 -6
- package/dist/session/panel/easy/context-card.js +8 -9
- package/dist/session/panel/easy/context-meter.d.ts +2 -0
- package/dist/session/panel/easy/context-meter.js +18 -4
- package/dist/session/panel/easy/detail-view.js +7 -4
- package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
- package/dist/session/panel/easy/easy-panel-logic.js +4 -17
- package/dist/session/panel/easy/easy-panel.js +5 -4
- package/dist/session/panel/easy/outputs-card.d.ts +1 -13
- package/dist/session/panel/easy/outputs-card.js +14 -40
- package/dist/session/panel/easy/panel-card.d.ts +13 -40
- package/dist/session/panel/easy/panel-card.js +17 -55
- package/dist/session/panel/easy/plan-card.js +4 -7
- package/dist/session/panel/model-switch-event.d.ts +2 -2
- package/dist/session/panel/model-switch-event.js +13 -9
- package/dist/session/panel/session-panel-provider.d.ts +2 -1
- package/dist/session/panel/session-panel-provider.js +3 -3
- package/dist/session/panel/shared/collect-tool-parts.js +2 -2
- package/dist/session/panel/shared/derive-panels.js +14 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
- package/dist/session/panel/shared/use-panel-handoffs.js +26 -17
- package/dist/session/thread/chat-minimap.js +7 -1
- package/dist/session/thread/session-body.js +1 -1
- package/dist/session/thread/session-chat.js +59 -15
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +7 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +9 -0
- package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
- package/dist/session/tool/shared/infrastructure-rows.js +19 -19
- package/dist/session/tool/show-group-renderer.d.ts +5 -5
- package/dist/session/tool/show-group-renderer.js +7 -4
- package/dist/session/tool/tool-part-renderer.js +25 -9
- package/dist/session/tool/tool-renderers.d.ts +1 -1
- package/dist/session/tool/tool-renderers.js +1 -1
- package/dist/session/tool/tools/bash-tool.js +3 -2
- package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
- package/dist/session/tool/tools/codemode-tool.js +54 -2
- package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +19 -8
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
- package/dist/session/tool/tools/task-tool.js +17 -5
- package/dist/session/turn/peer-message-row.d.ts +3 -0
- package/dist/session/turn/peer-message-row.js +8 -2
- package/dist/session/turn/subagent-notice-row.js +5 -3
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +130 -22
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/wallpaper-gradients.d.ts +106 -0
- package/dist/theme/wallpaper-gradients.js +347 -0
- package/dist/theme/wallpapers.d.ts +23 -3
- package/dist/theme/wallpapers.js +53 -29
- package/dist/workspace/admin/project-admin-dashboard.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -1
- package/dist/workspace/new/use-create-workspace.d.ts +5 -3
- package/dist/workspace/new/use-create-workspace.js +1 -1
- package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
- package/dist/workspace/projects/modal/project-icon-field.js +3 -3
- package/dist/workspace/review/review-center.d.ts +9 -1
- package/dist/workspace/review/review-center.js +107 -14
- package/dist/workspace/review/review-detail.d.ts +19 -0
- package/dist/workspace/review/review-detail.js +18 -3
- package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
- package/dist/workspace/review/review-swipe-deck.js +304 -0
- package/dist/workspace/review/review-swipe.d.ts +17 -0
- package/dist/workspace/review/review-swipe.js +10 -0
- package/dist/workspace/session-spaces/space-picker.js +3 -3
- package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
- package/dist/workspace/setup/setup-banner-snooze.js +44 -0
- package/dist/workspace/setup/setup-banner.js +19 -36
- package/dist/workspace/setup/setup-steps.d.ts +0 -5
- package/dist/workspace/setup/setup-steps.js +0 -7
- package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
- package/dist/workspace/setup/workspace-setup-modal.js +202 -0
- package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
- package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +24 -5
- package/dist/workspace/sidebar/project-session-list.js +2 -1
- package/dist/workspace/sidebar/project-sidebar.js +6 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
- package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
- package/package.json +14 -10
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/modules.md +3 -1
- package/dist/primitives/toast-clearance.d.ts +0 -36
- package/dist/primitives/toast-clearance.js +0 -94
- package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
- package/dist/workspace/setup/workspace-setup-page.js +0 -91
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Keeps bottom-right toasts clear of a composer docked at the bottom of the
|
|
5
|
-
* window. The app's `<Toaster>` reads its bottom offset from
|
|
6
|
-
* `--toast-offset-bottom` (`apps/web/src/app/[locale]/layout.tsx`); a docked
|
|
7
|
-
* composer sets that variable to the distance from its top edge to the window
|
|
8
|
-
* bottom while it reaches into the toast lane. Before this, a toast covered the
|
|
9
|
-
* session composer's Send/Stop button (dev audit, 2026-11-14).
|
|
10
|
-
*
|
|
11
|
-
* Toasts always stay in the window's bottom-right corner. They never follow
|
|
12
|
-
* the composer sideways: right-aligning them with the composer pinned them
|
|
13
|
-
* inside the chat column, away from the corner.
|
|
14
|
-
*/
|
|
15
|
-
export const TOAST_OFFSET_VAR = '--toast-offset-bottom';
|
|
16
|
-
/** Sonner's default edge offset on desktop. */
|
|
17
|
-
const EDGE_PX = 24;
|
|
18
|
-
/** Sonner's toast width. */
|
|
19
|
-
const TOAST_WIDTH_PX = 356;
|
|
20
|
-
/** The element whose resize moves a docked composer (the chat column). */
|
|
21
|
-
export const TOAST_ANCHOR_ATTR = 'data-toast-anchor';
|
|
22
|
-
/** Sonner stacks toasts full width at and below this viewport width. */
|
|
23
|
-
const MOBILE_BREAKPOINT_PX = 600;
|
|
24
|
-
/** Space between the composer's top edge and the lowest toast. */
|
|
25
|
-
const GAP_PX = 12;
|
|
26
|
-
/** A composer whose bottom edge is this close to the window bottom is docked there. */
|
|
27
|
-
const DOCKED_BOTTOM_PX = 160;
|
|
28
|
-
/**
|
|
29
|
-
* The bottom offset that puts a corner toast just above `rect`, or 0 when the
|
|
30
|
-
* element is hidden, not docked at the window bottom, or entirely left of the
|
|
31
|
-
* toast lane (the window's right 380px). A tall composer (long draft,
|
|
32
|
-
* attachments) still counts: only its bottom edge says whether it is docked.
|
|
33
|
-
*/
|
|
34
|
-
export function toastClearance(rect, viewport) {
|
|
35
|
-
if (rect.width === 0 || rect.height === 0)
|
|
36
|
-
return 0;
|
|
37
|
-
if (viewport.height - rect.bottom > DOCKED_BOTTOM_PX)
|
|
38
|
-
return 0;
|
|
39
|
-
const laneLeft = viewport.width <= MOBILE_BREAKPOINT_PX ? 0 : viewport.width - EDGE_PX - TOAST_WIDTH_PX;
|
|
40
|
-
const laneRight = viewport.width <= MOBILE_BREAKPOINT_PX ? viewport.width : viewport.width - EDGE_PX;
|
|
41
|
-
if (rect.right <= laneLeft || rect.left >= laneRight)
|
|
42
|
-
return 0;
|
|
43
|
-
return Math.max(0, Math.ceil(viewport.height - rect.top + GAP_PX));
|
|
44
|
-
}
|
|
45
|
-
// replica-local: one entry per mounted docked composer in this window.
|
|
46
|
-
const clearances = new Map();
|
|
47
|
-
function apply() {
|
|
48
|
-
if (typeof document === 'undefined')
|
|
49
|
-
return;
|
|
50
|
-
// The composer that lifts the toast highest decides the offset.
|
|
51
|
-
let bottom = 0;
|
|
52
|
-
for (const c of clearances.values())
|
|
53
|
-
if (c > bottom)
|
|
54
|
-
bottom = c;
|
|
55
|
-
const root = document.documentElement.style;
|
|
56
|
-
if (bottom > 0)
|
|
57
|
-
root.setProperty(TOAST_OFFSET_VAR, `${bottom}px`);
|
|
58
|
-
else
|
|
59
|
-
root.removeProperty(TOAST_OFFSET_VAR);
|
|
60
|
-
}
|
|
61
|
-
/** Registers `ref`'s element as a docked composer while `active`. */
|
|
62
|
-
export function useToastClearance(ref, active) {
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
const el = ref.current;
|
|
65
|
-
if (!active || !el || typeof window === 'undefined')
|
|
66
|
-
return;
|
|
67
|
-
const id = Symbol('toast-clearance');
|
|
68
|
-
const measure = () => {
|
|
69
|
-
const rect = el.getBoundingClientRect();
|
|
70
|
-
const bottom = toastClearance(rect, { width: window.innerWidth, height: window.innerHeight });
|
|
71
|
-
if (clearances.get(id) === bottom)
|
|
72
|
-
return;
|
|
73
|
-
clearances.set(id, bottom);
|
|
74
|
-
apply();
|
|
75
|
-
};
|
|
76
|
-
measure();
|
|
77
|
-
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
|
|
78
|
-
observer?.observe(el);
|
|
79
|
-
// The composer is width-capped and centered, so a side panel opening
|
|
80
|
-
// MOVES it without resizing it. The column it sits in (marked with
|
|
81
|
-
// `data-toast-anchor`) does resize, so watch that too, or the lane check
|
|
82
|
-
// keeps the pre-panel position.
|
|
83
|
-
const anchor = el.closest(`[${TOAST_ANCHOR_ATTR}]`);
|
|
84
|
-
if (anchor)
|
|
85
|
-
observer?.observe(anchor);
|
|
86
|
-
window.addEventListener('resize', measure);
|
|
87
|
-
return () => {
|
|
88
|
-
observer?.disconnect();
|
|
89
|
-
window.removeEventListener('resize', measure);
|
|
90
|
-
clearances.delete(id);
|
|
91
|
-
apply();
|
|
92
|
-
};
|
|
93
|
-
}, [ref, active]);
|
|
94
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `/workspaces/<id>/setup`: every step of a workspace's setup that only a
|
|
3
|
-
* person can do, on one page. `kortix onboard` opens it in the browser instead
|
|
4
|
-
* of printing a link per step, and `kortix onboard --wait` continues when the
|
|
5
|
-
* page shows every step done. A missing model never reaches this page: the
|
|
6
|
-
* workspace shell shows "Connect a model" first (`ProjectShell`).
|
|
7
|
-
*/
|
|
8
|
-
export declare function WorkspaceSetupPage({ projectId }: {
|
|
9
|
-
projectId: string;
|
|
10
|
-
}): import("react").JSX.Element;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { CheckCircleIcon, KeyIcon } from '@phosphor-icons/react';
|
|
4
|
-
import { getSlackMode } from '@kortix/sdk';
|
|
5
|
-
import { useProjectAccountId } from '@kortix/sdk/react';
|
|
6
|
-
import { useQuery } from '@tanstack/react-query';
|
|
7
|
-
import { useState } from 'react';
|
|
8
|
-
import { connectorHref } from '../../customize/connectors/connector-routes.js';
|
|
9
|
-
import { SetCredentialModal } from '../../customize/sections/connectors-view.js';
|
|
10
|
-
import { ProjectSecretDialog } from '../../customize/sections/view/secrets-view.js';
|
|
11
|
-
import { CapabilityPageShell } from '../../customize/shared/capability-page-shell.js';
|
|
12
|
-
import { useTranslations } from '../../i18n/index.js';
|
|
13
|
-
import { ConnectorLogo } from '../../internal/connector-logo/connector-logo.js';
|
|
14
|
-
import { installedConnectorLogoSource } from '../../internal/connector-logo/connector-logo-source.js';
|
|
15
|
-
import { useAddAccount } from '../../internal/hooks/connectors/use-add-account.js';
|
|
16
|
-
import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
|
|
17
|
-
import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
|
|
18
|
-
import { useProjectCan } from '../../internal/lib/use-project-can.js';
|
|
19
|
-
import { Alert, AlertDescription, AlertTitle } from '../../primitives/alert.js';
|
|
20
|
-
import { Button } from '../../primitives/button.js';
|
|
21
|
-
import { EmptyState } from '../../primitives/empty-state.js';
|
|
22
|
-
import { EmptyArt } from '../../primitives/empty-art.js';
|
|
23
|
-
import { ErrorState } from '../../primitives/error-state.js';
|
|
24
|
-
import { Skeleton } from '../../primitives/skeleton.js';
|
|
25
|
-
import { UiLink as Link, useUiSearchParams } from '../../providers/ui-provider.js';
|
|
26
|
-
import { useSetupSteps } from './use-setup-steps.js';
|
|
27
|
-
/** While a step is open, read it again this often: the person may finish it in another tab. */
|
|
28
|
-
const OPEN_STEP_POLL_MS = 5_000;
|
|
29
|
-
/**
|
|
30
|
-
* `/workspaces/<id>/setup`: every step of a workspace's setup that only a
|
|
31
|
-
* person can do, on one page. `kortix onboard` opens it in the browser instead
|
|
32
|
-
* of printing a link per step, and `kortix onboard --wait` continues when the
|
|
33
|
-
* page shows every step done. A missing model never reaches this page: the
|
|
34
|
-
* workspace shell shows "Connect a model" first (`ProjectShell`).
|
|
35
|
-
*/
|
|
36
|
-
export function WorkspaceSetupPage({ projectId }) {
|
|
37
|
-
const t = useTranslations('workspaceSetup');
|
|
38
|
-
const params = useUiSearchParams();
|
|
39
|
-
const accountId = useProjectAccountId(projectId);
|
|
40
|
-
const canConnect = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_CONNECTOR_WRITE, { accountId }).allowed === true;
|
|
41
|
-
const canSetSecrets = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_SECRET_WRITE).allowed === true;
|
|
42
|
-
const { steps, usesSlack, loading, failed, refresh } = useSetupSteps(projectId, {
|
|
43
|
-
slackRequested: params.get('slack') === '1',
|
|
44
|
-
pollMs: OPEN_STEP_POLL_MS,
|
|
45
|
-
});
|
|
46
|
-
// The same cache entry as the Channels page (`useSlackMode`).
|
|
47
|
-
const slackModeQuery = useQuery({
|
|
48
|
-
queryKey: ['channels', 'slack-mode', projectId],
|
|
49
|
-
queryFn: () => getSlackMode(projectId),
|
|
50
|
-
enabled: usesSlack,
|
|
51
|
-
staleTime: 60_000,
|
|
52
|
-
});
|
|
53
|
-
const done = steps.filter((step) => step.done).length;
|
|
54
|
-
const workspaceLink = (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: `/workspaces/${projectId}`, children: t('openWorkspace') }) }));
|
|
55
|
-
return (_jsx(CapabilityPageShell, { title: t('title'), description: loading || failed || steps.length === 0 ? t('descriptionIdle') : t('description', { done, total: steps.length }), children: loading ? (_jsx("ul", { className: "space-y-2", "aria-busy": "true", children: [0, 1, 2].map((index) => (_jsx("li", { children: _jsx(Skeleton, { className: "h-14 rounded-md" }) }, index))) })) : failed ? (_jsx(ErrorState, { size: "sm", title: t('loadFailed'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: refresh, children: t('tryAgain') }) })) : steps.length === 0 ? (_jsx(EmptyState, { media: _jsx(EmptyArt, { icon: CheckCircleIcon }), title: t('emptyTitle'), description: t('emptyDescription'), action: workspaceLink })) : (_jsxs("div", { className: "space-y-4", children: [done === steps.length ? (_jsxs(Alert, { variant: "success", children: [_jsx(AlertTitle, { children: t('completeTitle') }), _jsx(AlertDescription, { children: t('completeDescription') })] })) : null, _jsx("ul", { className: "space-y-2", children: steps.map((step) => (_jsx(StepRow, { projectId: projectId, step: step, canConnect: canConnect, canSetSecrets: canSetSecrets, slackInstallUrl: slackModeQuery.data?.oauth_available ? slackModeQuery.data.install_url : null, onChanged: refresh }, step.id))) }), done === steps.length ? _jsx("div", { children: workspaceLink }) : null] })) }));
|
|
56
|
-
}
|
|
57
|
-
function StepRow({ projectId, step, canConnect, canSetSecrets, slackInstallUrl, onChanged, }) {
|
|
58
|
-
const t = useTranslations('workspaceSetup');
|
|
59
|
-
const kind = step.kind === 'connector' ? t('kindConnector') : step.kind === 'secret' ? t('kindSecret') : t('kindSlack');
|
|
60
|
-
return (_jsxs("li", { className: "bg-background flex items-center gap-3 rounded-md border px-4 py-2.5", children: [step.kind === 'connector' ? (_jsx(ConnectorLogo, { source: installedConnectorLogoSource(step.connector), size: "lg" })) : step.kind === 'slack' ? (_jsx(ConnectorLogo, { source: { nativeApp: 'slack' }, size: "lg" })) : (_jsx("span", { className: "bg-muted flex size-9 shrink-0 items-center justify-center rounded-md", children: _jsx(KeyIcon, { className: "text-muted-foreground size-4" }) })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-foreground truncate text-sm font-medium", children: step.name }), _jsx("p", { className: "text-muted-foreground truncate text-xs", children: kind })] }), step.done ? (_jsxs("span", { className: "text-muted-foreground flex shrink-0 items-center gap-1.5 text-xs", children: [_jsx(SolidCheckIcon, { className: "text-kortix-green size-4 shrink-0" }), t('done')] })) : step.kind === 'connector' ? (canConnect ? _jsx(ConnectorAction, { projectId: projectId, connector: step.connector, name: step.name, broken: step.broken, onChanged: onChanged }) : null) : step.kind === 'secret' ? (canSetSecrets ? _jsx(SecretAction, { projectId: projectId, step: step, onChanged: onChanged }) : null) : (_jsx(SlackAction, { projectId: projectId, installUrl: slackInstallUrl }))] }));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Connect: the shared account every agent of the workspace uses, signed in at
|
|
64
|
-
* once, the same as the connector page's Add account with "Everyone". A
|
|
65
|
-
* connector whose account broke opens its own page, where the account is.
|
|
66
|
-
*/
|
|
67
|
-
function ConnectorAction({ projectId, connector, name, broken, onChanged, }) {
|
|
68
|
-
const t = useTranslations('workspaceSetup');
|
|
69
|
-
const [credential, setCredential] = useState(null);
|
|
70
|
-
const add = useAddAccount({ projectId, connector, displayName: name, onAdded: onChanged, onCredential: setCredential });
|
|
71
|
-
if (broken) {
|
|
72
|
-
return (_jsx(Button, { asChild: true, size: "sm", variant: "secondary", children: _jsx(Link, { href: connectorHref(projectId, connector.slug), children: t('reconnect', { name }) }) }));
|
|
73
|
-
}
|
|
74
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", disabled: add.pending, "aria-busy": add.pending, onClick: () => add.submit({ label: add.proposedLabel(), audience: 'project', picked: { memberIds: [], groupIds: [] } }), children: t('connect', { name }) }), credential ? (_jsx(SetCredentialModal, { projectId: projectId, connector: connector, connectionId: credential.connectionId, owner: credential.owner, open: true, onOpenChange: (open) => {
|
|
75
|
-
if (!open)
|
|
76
|
-
setCredential(null);
|
|
77
|
-
}, onSaved: () => {
|
|
78
|
-
setCredential(null);
|
|
79
|
-
onChanged();
|
|
80
|
-
} }, credential.connectionId)) : null] }));
|
|
81
|
-
}
|
|
82
|
-
function SecretAction({ projectId, step, onChanged, }) {
|
|
83
|
-
const t = useTranslations('workspaceSetup');
|
|
84
|
-
const [open, setOpen] = useState(false);
|
|
85
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", onClick: () => setOpen(true), children: t('setSecret', { name: step.name }) }), _jsx(ProjectSecretDialog, { projectId: projectId, row: step.row, open: open, onOpenChange: setOpen, onSaved: onChanged })] }));
|
|
86
|
-
}
|
|
87
|
-
/** One-click "Add to Slack" in a new tab when the host has the Slack app; else the Channels page, which takes a bot token. */
|
|
88
|
-
function SlackAction({ projectId, installUrl }) {
|
|
89
|
-
const t = useTranslations('workspaceSetup');
|
|
90
|
-
return installUrl ? (_jsx(Button, { asChild: true, size: "sm", children: _jsx("a", { href: installUrl, target: "_blank", rel: "noopener noreferrer", children: t('addSlack') }) })) : (_jsx(Button, { asChild: true, size: "sm", variant: "secondary", children: _jsx(Link, { href: `/workspaces/${projectId}/admin/connectors?scope=channels`, children: t('connectSlack') }) }));
|
|
91
|
-
}
|