@kortix/ui 0.16.2 → 0.16.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.
Files changed (67) hide show
  1. package/dist/_vendor/kortix-shared.js +1 -4
  2. package/dist/customize/settings/rail-copy-context.d.ts +2 -0
  3. package/dist/customize/settings/rail-copy-context.js +2 -0
  4. package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
  5. package/dist/files/renderers/show-content-renderer.js +3 -1
  6. package/dist/i18n/en.d.ts +14 -9
  7. package/dist/i18n/en.js +15 -10
  8. package/dist/internal/chrome/chrome-connect.d.ts +3 -5
  9. package/dist/internal/chrome/chrome-connect.js +7 -10
  10. package/dist/internal/chrome/extension.d.ts +1 -8
  11. package/dist/internal/chrome/extension.js +1 -8
  12. package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
  13. package/dist/internal/chrome/use-chrome-offered.js +13 -15
  14. package/dist/internal/layout/project-page-header.js +5 -4
  15. package/dist/internal/stores/user-preferences-store.d.ts +17 -0
  16. package/dist/internal/stores/user-preferences-store.js +5 -0
  17. package/dist/primitives/color-picker.d.ts +19 -0
  18. package/dist/primitives/color-picker.js +27 -0
  19. package/dist/primitives/faded-scroll-area.js +4 -0
  20. package/dist/primitives/glyph-picker.d.ts +11 -0
  21. package/dist/primitives/glyph-picker.js +10 -6
  22. package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
  23. package/dist/primitives/gradient-wallpaper-gl.js +446 -0
  24. package/dist/primitives/gradient-wallpaper.d.ts +20 -0
  25. package/dist/primitives/gradient-wallpaper.js +242 -0
  26. package/dist/primitives/resizable.d.ts +1 -1
  27. package/dist/session/composer/ComposerCard.js +0 -3
  28. package/dist/session/panel/easy/detail-view.js +3 -2
  29. package/dist/session/panel/shared/collect-tool-parts.js +2 -2
  30. package/dist/session/panel/shared/use-panel-handoffs.js +23 -2
  31. package/dist/session/thread/session-body.js +1 -1
  32. package/dist/session/tool/shared/infrastructure-contexts.d.ts +5 -0
  33. package/dist/session/tool/shared/infrastructure-contexts.js +7 -0
  34. package/dist/session/tool/show-group-renderer.d.ts +5 -5
  35. package/dist/session/tool/show-group-renderer.js +7 -4
  36. package/dist/session/tool/tool-part-renderer.js +3 -1
  37. package/dist/session/tool/tool-renderers.d.ts +1 -1
  38. package/dist/session/tool/tool-renderers.js +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/test-utils/intl.d.ts +14 -9
  41. package/dist/theme/index.d.ts +2 -1
  42. package/dist/theme/index.js +2 -1
  43. package/dist/theme/wallpaper-gradients.d.ts +106 -0
  44. package/dist/theme/wallpaper-gradients.js +347 -0
  45. package/dist/theme/wallpapers.d.ts +23 -3
  46. package/dist/theme/wallpapers.js +53 -29
  47. package/dist/workspace/admin/project-admin-dashboard.js +1 -1
  48. package/dist/workspace/layout/project-home.js +1 -1
  49. package/dist/workspace/new/use-create-workspace.d.ts +5 -3
  50. package/dist/workspace/new/use-create-workspace.js +1 -1
  51. package/dist/workspace/session-spaces/space-picker.js +3 -3
  52. package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
  53. package/dist/workspace/setup/setup-banner-snooze.js +44 -0
  54. package/dist/workspace/setup/setup-banner.js +19 -36
  55. package/dist/workspace/setup/setup-steps.d.ts +0 -5
  56. package/dist/workspace/setup/setup-steps.js +0 -7
  57. package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
  58. package/dist/workspace/setup/workspace-setup-modal.js +202 -0
  59. package/dist/workspace/sidebar/project-session-list.js +2 -1
  60. package/dist/workspace/sidebar/project-sidebar.js +6 -5
  61. package/package.json +14 -10
  62. package/skills/kortix-ui/SKILL.md +1 -1
  63. package/skills/kortix-ui/references/modules.md +3 -1
  64. package/dist/primitives/toast-clearance.d.ts +0 -36
  65. package/dist/primitives/toast-clearance.js +0 -94
  66. package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
  67. package/dist/workspace/setup/workspace-setup-page.js +0 -91
@@ -89,7 +89,7 @@ Theme with `@kortix/ui/theme`, never by forking a component: `themeToCss(theme)`
89
89
  | `@kortix/ui` (navigation) | `FilterBar`, `FilterBarItem`, `Tabs`, `TabsContent`, `TabsList`, `TabsTrigger`, `tabsTriggerHeightVariants`, `tabsTriggerPaddingVariants`, `tabsTriggerTextVariants`, `TabsListType`, `TabsSize`, `TabsTriggerSize`, `TabsTriggerVariant`, `TabsUnderlineSize` |
90
90
  | `@kortix/ui` (conversation) | `Bubble`, `BubbleContent`, `BubbleGroup`, `BubbleReactions`, `bubbleVariants`, `Message`, `MessageAvatar`, `MessageContent`, `MessageFooter`, `MessageGroup`, `MessageHeader`, `Marker`, `MarkerContent`, `MarkerIcon`, `markerVariants` |
91
91
  | `@kortix/ui` (hooks, helpers) | `UiLink`, `UiImage`, `useUiViewer`, `UiViewer`, `UiHostComponents`, `UiPreviewUrlResolver`, `UiPreviewRequest`, `useDebounce`, `useIsMobile`, `useMediaQuery`, `useSlashFocus`, `lazyClient`, `spring`, `floatingZ`, `dialogContentZ`, `dialogOverlayZ`, `useDialogDepth`, `hasOpenFloatingLayer`, `hasOpenNestedDialog`, `DEFAULT_ICON_WEIGHT`, `ICON_WEIGHTS`, `SHIPPED_ICON_WEIGHTS`, `faviconUrlForHostname`, `setUiTelemetry`, `setUiHostEnv`, `setUiRoutes`, `uiRoutes`, `newSessionHref`, `isNewSessionRequested`, `defaultUiRoutes`, `decodeSpaceSegment`, `UiRoutes` |
92
- | `@kortix/ui/theme` | `KortixTheme`, `themeToCss`, `themeToCssVars`, `ThemeScope`, `ThemeScopeProps`, `THEME_COLOR_VARS`, `ThemeColor`, `ThemeColors`, `ThemeCssVars`, `ThemeTextStep`, `ThemeShadowStep`, `ThemeDurationStep`, `ThemeEasing`, `WALLPAPERS`, `DEFAULT_WALLPAPER_ID`, `getWallpaperById`, `Wallpaper` |
92
+ | `@kortix/ui/theme` | `KortixTheme`, `themeToCss`, `themeToCssVars`, `ThemeScope`, `ThemeScopeProps`, `THEME_COLOR_VARS`, `ThemeColor`, `ThemeColors`, `ThemeCssVars`, `ThemeTextStep`, `ThemeShadowStep`, `ThemeDurationStep`, `ThemeEasing`, `WALLPAPERS`, `DEFAULT_WALLPAPER_ID`, `getWallpaperById`, `Wallpaper`, `getSelectableWallpaper`, `PickerWallpaper`, `PickerWallpaperId`, `GRADIENT_PRESETS`, `GRADIENT_PATTERNS`, `GRADIENT_FINISHES`, `GRADIENT_MIN_COLORS`, `GRADIENT_MAX_COLORS`, `GradientConfig`, `GradientPattern`, `GradientFinish`, `GradientWallpaperId`, `gradientColors`, `CUSTOM_PALETTES`, `CUSTOM_COLOR_PRESETS`, `DEFAULT_CUSTOM_WALLPAPER`, `CustomWallpaperConfig`, `customGradientConfig`, `normalizeCustomWallpaper`, `nextCustomColor`, `randomCustomColors`, `randomCustomWallpaper`, `PresetOverride`, `PresetOverrides`, `normalizePresetOverrides`, `presetWithOverride`, `DEFAULT_WALLPAPER_OPACITY`, `OPACITY_LIMITS` |
93
93
  | `@kortix/ui/session` (whole thread) | `SessionThread`, `SessionThreadProps` |
94
94
  | `@kortix/ui/session` (blocks) | `UserMessage`, `ThrottledMarkdown`, `UnifiedMarkdown`, `UnifiedMarkdownProps`, `ToolPartRenderer`, `SessionChatInput`, `SessionChatInputProps`, `AgentSelector`, `ModelSelector`, `ModelSelectorProps`, `SessionPermissionPrompt`, `QuestionPrompt`, `QuestionPromptHandle`, `TurnErrorDisplay`, `SessionBusyIndicator`, `SessionStartingLoader` |
95
95
  | `@kortix/ui/session` (tool rows, pickers) | `ToolRegistry`, `ToolProps`, `ToolComponent`, `BasicTool`, `BasicToolProps`, `GenericTool`; for a form outside a session: `ModelSelector`, `AgentSelector` |
@@ -37,6 +37,8 @@ Names: `Close`, `Copy`, `SidebarGlyph`, `SolidRightArrow`
37
37
  ## `@kortix/ui/theme`
38
38
 
39
39
  Source: `src/theme/index.ts`. White-label theming: tokens to CSS, a themed subtree, the session wallpapers.
40
+ The colored wallpapers are data (`src/theme/wallpaper-gradients.ts`): a `GradientConfig` is a pattern, a finish
41
+ and a palette; `normalizeCustomWallpaper` and `normalizePresetOverrides` clean a saved setting.
40
42
 
41
43
  Props: `ThemeScope`: `theme`, `className`, any `div` prop. `themeToCss(theme, selector?)`. Every key: `theming.md`.
42
44
 
@@ -52,7 +54,7 @@ export function Preview({ children }: { children: ReactNode }) {
52
54
  }
53
55
  ```
54
56
 
55
- Names: `THEME_COLOR_VARS`, `themeToCss`, `themeToCssVars`, `KortixTheme`, `ThemeColor`, `ThemeColors`, `ThemeCssVars`, `ThemeDurationStep`, `ThemeEasing`, `ThemeShadowStep`, `ThemeTextStep`, `ThemeScope`, `ThemeScopeProps`, `DEFAULT_WALLPAPER_ID`, `WALLPAPERS`, `getWallpaperById`, `Wallpaper`
57
+ Names: `THEME_COLOR_VARS`, `themeToCss`, `themeToCssVars`, `KortixTheme`, `ThemeColor`, `ThemeColors`, `ThemeCssVars`, `ThemeDurationStep`, `ThemeEasing`, `ThemeShadowStep`, `ThemeTextStep`, `ThemeScope`, `ThemeScopeProps`, `DEFAULT_WALLPAPER_ID`, `WALLPAPERS`, `getWallpaperById`, `Wallpaper`, `getSelectableWallpaper`, `PickerWallpaper`, `PickerWallpaperId`, `GRADIENT_PRESETS`, `GRADIENT_PATTERNS`, `GRADIENT_FINISHES`, `GRADIENT_MIN_COLORS`, `GRADIENT_MAX_COLORS`, `GradientConfig`, `GradientPattern`, `GradientFinish`, `GradientWallpaperId`, `gradientColors`, `CUSTOM_PALETTES`, `CUSTOM_COLOR_PRESETS`, `DEFAULT_CUSTOM_WALLPAPER`, `CustomWallpaperConfig`, `customGradientConfig`, `normalizeCustomWallpaper`, `nextCustomColor`, `randomCustomColors`, `randomCustomWallpaper`, `PresetOverride`, `PresetOverrides`, `normalizePresetOverrides`, `presetWithOverride`, `DEFAULT_WALLPAPER_OPACITY`, `OPACITY_LIMITS`
56
58
 
57
59
  ## `@kortix/ui/i18n`
58
60
 
@@ -1,36 +0,0 @@
1
- import { type RefObject } from 'react';
2
- /**
3
- * Keeps bottom-right toasts clear of a composer docked at the bottom of the
4
- * window. The app's `<Toaster>` reads its bottom offset from
5
- * `--toast-offset-bottom` (`apps/web/src/app/[locale]/layout.tsx`); a docked
6
- * composer sets that variable to the distance from its top edge to the window
7
- * bottom while it reaches into the toast lane. Before this, a toast covered the
8
- * session composer's Send/Stop button (dev audit, 2026-11-14).
9
- *
10
- * Toasts always stay in the window's bottom-right corner. They never follow
11
- * the composer sideways: right-aligning them with the composer pinned them
12
- * inside the chat column, away from the corner.
13
- */
14
- export declare const TOAST_OFFSET_VAR = "--toast-offset-bottom";
15
- /** The element whose resize moves a docked composer (the chat column). */
16
- export declare const TOAST_ANCHOR_ATTR = "data-toast-anchor";
17
- export interface ClearanceRect {
18
- top: number;
19
- bottom: number;
20
- left: number;
21
- right: number;
22
- width: number;
23
- height: number;
24
- }
25
- /**
26
- * The bottom offset that puts a corner toast just above `rect`, or 0 when the
27
- * element is hidden, not docked at the window bottom, or entirely left of the
28
- * toast lane (the window's right 380px). A tall composer (long draft,
29
- * attachments) still counts: only its bottom edge says whether it is docked.
30
- */
31
- export declare function toastClearance(rect: ClearanceRect, viewport: {
32
- width: number;
33
- height: number;
34
- }): number;
35
- /** Registers `ref`'s element as a docked composer while `active`. */
36
- export declare function useToastClearance(ref: RefObject<HTMLElement | null>, active: boolean): void;
@@ -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
- }