@kortix/ui 0.16.0 → 0.16.1
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 +24 -25
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.js +3 -1
- package/dist/test-utils/intl.d.ts +2 -0
- package/dist/workspace/layout/project-home.js +2 -1
- package/dist/workspace/setup/setup-banner.d.ts +4 -0
- package/dist/workspace/setup/setup-banner.js +57 -0
- package/dist/workspace/setup/setup-steps.d.ts +14 -0
- package/dist/workspace/setup/setup-steps.js +15 -0
- package/dist/workspace/setup/use-setup-steps.d.ts +18 -0
- package/dist/workspace/setup/use-setup-steps.js +57 -0
- package/dist/workspace/setup/workspace-setup-page.js +8 -41
- package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
- package/package.json +3 -3
|
@@ -4559,15 +4559,10 @@ parse.
|
|
|
4559
4559
|
9. **Keep the reply.** Do what the person chose. When a choice cannot work as
|
|
4560
4560
|
chosen, only the person decides the change: say why in one line, give your
|
|
4561
4561
|
fix and wait for the answer. Never swap a choice without saying so.
|
|
4562
|
-
10. **
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
or GitHub sign-in they already have), each row of the setup page (a
|
|
4567
|
-
connector's sign-in and consent, Add to Slack, a model plan) and the
|
|
4568
|
-
GitHub App install. Never type a password, a one-time code, a card number
|
|
4569
|
-
or a secret value: when a page asks for one, that step is the person's.
|
|
4570
|
-
Say so in one line, wait, and go on.
|
|
4562
|
+
10. **The setup page is the person's.** Every sign-in (the model plan, a
|
|
4563
|
+
connector, Slack, the GitHub App) and every pasted token happen there, in
|
|
4564
|
+
the page \`onboard\` opens. Never sign in, connect or click for the person,
|
|
4565
|
+
in the terminal or in a browser.
|
|
4571
4566
|
|
|
4572
4567
|
## 0. Install
|
|
4573
4568
|
|
|
@@ -4613,6 +4608,11 @@ message of step 3.
|
|
|
4613
4608
|
the shape: one repository (a monorepo is one: several apps, one
|
|
4614
4609
|
repository), or one product over several repositories (a web app, an API,
|
|
4615
4610
|
services, each in its own). The shape decides where Kortix lives (step 3).
|
|
4611
|
+
Check the person's rights on each code repository:
|
|
4612
|
+
\`gh api repos/<owner>/<repo> --jq .permissions\`. \`onboard\` creates the
|
|
4613
|
+
GitHub webhooks with their \`gh\`, which needs \`admin\`. Without it, say so on
|
|
4614
|
+
the \`Found:\` line and name who can: an owner of the repository runs
|
|
4615
|
+
\`kortix doctor --loops --fix\` once, or the triggers poll instead.
|
|
4616
4616
|
3. **The software.** Start from the plan's \`integrations\` (each has a
|
|
4617
4617
|
category and its evidence), \`unrecognized_services\` and \`mcp_servers\`.
|
|
4618
4618
|
Add what you find yourself: SDK imports, webhook handlers, secret names in
|
|
@@ -4736,9 +4736,7 @@ The questions:
|
|
|
4736
4736
|
names to upload (every \`local\` name the app reads; never a \`remote\` or
|
|
4737
4737
|
\`prod\` one), the sandbox size with its cost ("4 vCPU, 8 GB, 30 GB disk:
|
|
4738
4738
|
about $${sandboxHourlyUsd(4, 8).toFixed(2)} an hour while a session runs"), the Kortix
|
|
4739
|
-
rule in \`AGENTS.md\` (default: add it)
|
|
4740
|
-
you can drive their browser, "I make the sign-in clicks in your browser"
|
|
4741
|
-
(rule 10).
|
|
4739
|
+
rule in \`AGENTS.md\` (default: add it).
|
|
4742
4740
|
- **A gap is a question only when a chosen source needs it.** An
|
|
4743
4741
|
\`unrecognized_services\` prefix or an empty category becomes one question
|
|
4744
4742
|
with likely answers ("Tickets: a) GitHub Issues (recommended) b) Linear
|
|
@@ -4861,27 +4859,23 @@ repository, the step 3 answer decides how they land:
|
|
|
4861
4859
|
open a pull request instead.
|
|
4862
4860
|
- **A pull request:** \`git switch -c kortix/setup\`, commit, push,
|
|
4863
4861
|
\`gh pr create\`. When the person has merged it, switch to the default
|
|
4864
|
-
branch, pull, and go on.
|
|
4862
|
+
branch, pull, and go on. Never point the workspace at \`kortix/setup\` to
|
|
4863
|
+
start before the merge: many repositories delete a merged branch
|
|
4864
|
+
(\`delete_branch_on_merge\`), and the workspace would then read a branch
|
|
4865
|
+
that no longer exists.
|
|
4865
4866
|
|
|
4866
4867
|
## 5. Connect the models
|
|
4867
4868
|
|
|
4868
4869
|
The setup page (step 6) asks for a model first when the workspace has none:
|
|
4869
|
-
the person picks their Claude or ChatGPT plan, or adds a key,
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
- **Claude Pro or Max:** \`kortix providers login claude --start --share workspace --json\`;
|
|
4873
|
-
give the person the \`authorize_url\`; they paste the code back;
|
|
4874
|
-
\`kortix providers login claude --flow <flow_id> --code <code> --share workspace\`.
|
|
4875
|
-
- **ChatGPT Plus or Pro:** \`kortix providers login openai\` in the background;
|
|
4876
|
-
give the person the link and the code it prints.
|
|
4877
|
-
- **An API key:** \`kortix providers set <provider>\`; the person types the key.
|
|
4870
|
+
the person picks their Claude or ChatGPT plan, or adds a key, there (rule
|
|
4871
|
+
10). Connect no model from the terminal.
|
|
4878
4872
|
|
|
4879
4873
|
## 6. Do it
|
|
4880
4874
|
|
|
4881
4875
|
\`\`\`bash
|
|
4882
4876
|
kortix onboard --yes --json --wait \\
|
|
4883
4877
|
[--env-file <file> --only <A,B>]... \\
|
|
4884
|
-
[--channels <a,b>]
|
|
4878
|
+
[--channels <a,b>] \\
|
|
4885
4879
|
--repo <owner/repo> [--name "<workspace name>"]
|
|
4886
4880
|
\`\`\`
|
|
4887
4881
|
|
|
@@ -4919,6 +4913,12 @@ row is done." Never print those links in the terminal. \`--wait\` keeps the run
|
|
|
4919
4913
|
going until the page shows every row done, then finishes the phases that
|
|
4920
4914
|
waited.
|
|
4921
4915
|
|
|
4916
|
+
Run the command as written. Never add \`--no-open\` and never drop \`--wait\`:
|
|
4917
|
+
the page is where the person makes every click (rule 10). Wait for
|
|
4918
|
+
\`onboard\` to exit before you end your turn: ending the turn can stop a
|
|
4919
|
+
command that runs in the background, and a question to the person never waits
|
|
4920
|
+
on a running \`onboard\`.
|
|
4921
|
+
|
|
4922
4922
|
A repository webhook that already sends the same event to another Kortix
|
|
4923
4923
|
workspace is left in place and reported in the \`webhooks\` detail. Tell the
|
|
4924
4924
|
person: two workspaces would act on the same event. They pick one; delete the
|
|
@@ -4933,8 +4933,7 @@ App. The first run asks for the App's install on this repository: a
|
|
|
4933
4933
|
|
|
4934
4934
|
Exit 0 is done and green. Exit 4: steps are left. A \`user_action\` the page
|
|
4935
4935
|
does not show (\`/invite\` the bot to a private Slack channel, install the
|
|
4936
|
-
GitHub App) goes to the person once, in one message
|
|
4937
|
-
their yes (rule 10). \`--wait\` timed out
|
|
4936
|
+
GitHub App) goes to the person once, in one message. \`--wait\` timed out
|
|
4938
4937
|
(\`next\` says what the page still lists): tell the person in one line, then
|
|
4939
4938
|
run the same command again. Exit 1: read the failed phase's \`detail\`, fix
|
|
4940
4939
|
it, run again.
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -10628,6 +10628,8 @@ declare const catalog: {
|
|
|
10628
10628
|
setSecret: string;
|
|
10629
10629
|
addSlack: string;
|
|
10630
10630
|
connectSlack: string;
|
|
10631
|
+
bannerTitle: string;
|
|
10632
|
+
bannerDismiss: string;
|
|
10631
10633
|
};
|
|
10632
10634
|
};
|
|
10633
10635
|
export default catalog;
|
package/dist/i18n/en.js
CHANGED
|
@@ -10628,7 +10628,9 @@ const catalog = {
|
|
|
10628
10628
|
"reconnect": "Reconnect {name}",
|
|
10629
10629
|
"setSecret": "Set {name}",
|
|
10630
10630
|
"addSlack": "Add Kortix to Slack",
|
|
10631
|
-
"connectSlack": "Connect Slack"
|
|
10631
|
+
"connectSlack": "Connect Slack",
|
|
10632
|
+
"bannerTitle": "{left, plural, one {# setup step is left} other {# setup steps are left}}",
|
|
10633
|
+
"bannerDismiss": "Dismiss"
|
|
10632
10634
|
}
|
|
10633
10635
|
};
|
|
10634
10636
|
export default catalog;
|
|
@@ -10637,6 +10637,8 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
10637
10637
|
setSecret: string;
|
|
10638
10638
|
addSlack: string;
|
|
10639
10639
|
connectSlack: string;
|
|
10640
|
+
bannerTitle: string;
|
|
10641
|
+
bannerDismiss: string;
|
|
10640
10642
|
};
|
|
10641
10643
|
}, "hardcodedUi.i18nComplete">;
|
|
10642
10644
|
export declare function IntlTestProvider({ children, locale, timeZone, messages, fallback, ...rest }: Partial<IntlConfig> & {
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { ACCOUNT_PANEL_PARAM, hubTarget } from '../../internal/stores/account-panel-store.js';
|
|
5
5
|
import { SplitNoticeBanner } from '../settings/split-notice-banner.js';
|
|
6
|
+
import { SetupBanner } from '../setup/setup-banner.js';
|
|
6
7
|
import { useTranslations } from '../../i18n/index.js';
|
|
7
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
9
|
import { ComposerChatInput, } from '../../session/composer/composer-chat-input.js';
|
|
@@ -302,5 +303,5 @@ function ProjectHomeView({ projectId, onSend, busy, beforeSend, onboarding: onbo
|
|
|
302
303
|
return (
|
|
303
304
|
// A file dropped anywhere on the page attaches to the composer, as on a
|
|
304
305
|
// session page.
|
|
305
|
-
_jsxs(ComposerDropZone, { className: "bg-background relative flex min-h-0 flex-1 flex-col overflow-hidden lg:px-4.5", children: [_jsx(ProjectHomeWallpaper, {}), _jsx(SidebarToggle, { placement: "floating" }), _jsx(AccessRequestsBell, { requests: accessRequests.data?.requests ?? [], to: accessRequestsTo }), firstChatPending || !onboarded || noAgent || !HomeAnnouncement ? null : _jsx(HomeAnnouncement, {}),
|
|
306
|
+
_jsxs(ComposerDropZone, { className: "bg-background relative flex min-h-0 flex-1 flex-col overflow-hidden lg:px-4.5", children: [_jsx(ProjectHomeWallpaper, {}), _jsx(SidebarToggle, { placement: "floating" }), _jsx(AccessRequestsBell, { requests: accessRequests.data?.requests ?? [], to: accessRequestsTo }), firstChatPending || !onboarded || noAgent || !HomeAnnouncement ? null : _jsx(HomeAnnouncement, {}), _jsxs("div", { className: "relative z-10 mx-auto flex w-full max-w-2xl flex-col gap-2 px-4 pt-14 empty:hidden", children: [_jsx(SplitNoticeBanner, { workspaceId: projectId }), _jsx(SetupBanner, { projectId: projectId }, projectId)] }), noAgentReason ? (_jsx(NoAgentHome, { reason: noAgentReason, repoUrl: projectRowQuery.data?.repo_url, branch: projectRowQuery.data?.default_branch, dashboardUrl: projectRowQuery.data?.dashboard_url })) : firstChat ? (_jsx(FirstChat, { projectId: projectId, composer: composer })) : (_jsx(ProjectHomeWelcomeBody, { projectId: projectId, onPickSuggestion: applySuggestion, composer: composer }))] }));
|
|
306
307
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The way back to `/workspaces/<id>/setup`. The workspace home shows it while
|
|
5
|
+
* the setup page has an open step the viewer can finish: a connector to sign
|
|
6
|
+
* in, a required secret, Slack. It counts the same steps as the page. A viewer
|
|
7
|
+
* can dismiss it; the dismissal stays in this browser and holds until a step
|
|
8
|
+
* opens that was not open then.
|
|
9
|
+
*/
|
|
10
|
+
import { useProjectAccountId } from '@kortix/sdk/react';
|
|
11
|
+
import { XIcon } from '@phosphor-icons/react';
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
14
|
+
import { cn } from '../../lib/utils.js';
|
|
15
|
+
import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
|
|
16
|
+
import { useProjectCan } from '../../internal/lib/use-project-can.js';
|
|
17
|
+
import { Alert, AlertActions, AlertTitle } from '../../primitives/alert.js';
|
|
18
|
+
import { Button } from '../../primitives/button.js';
|
|
19
|
+
import { UiLink as Link } from '../../providers/ui-provider.js';
|
|
20
|
+
import { openStepsFor, setupBannerDismissed } from './setup-steps.js';
|
|
21
|
+
import { useSetupSteps } from './use-setup-steps.js';
|
|
22
|
+
const DISMISS_KEY = (projectId) => `kortix.setupBanner.dismissed.${projectId}`;
|
|
23
|
+
/** The step ids that were open when the viewer dismissed the banner, or null. */
|
|
24
|
+
function readDismissed(projectId) {
|
|
25
|
+
try {
|
|
26
|
+
const raw = window.localStorage.getItem(DISMISS_KEY(projectId));
|
|
27
|
+
const ids = raw ? JSON.parse(raw) : null;
|
|
28
|
+
return Array.isArray(ids) ? ids.filter((id) => typeof id === 'string') : null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function SetupBanner({ projectId, className }) {
|
|
35
|
+
const t = useTranslations('workspaceSetup');
|
|
36
|
+
const accountId = useProjectAccountId(projectId);
|
|
37
|
+
const canConnect = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_CONNECTOR_WRITE, { accountId }).allowed === true;
|
|
38
|
+
const canSetSecrets = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_SECRET_WRITE).allowed === true;
|
|
39
|
+
const { steps } = useSetupSteps(projectId, { enabled: canConnect || canSetSecrets });
|
|
40
|
+
const open = openStepsFor(steps, { connect: canConnect, setSecrets: canSetSecrets });
|
|
41
|
+
const [dismissed, setDismissed] = useState(() => (typeof window === 'undefined' ? null : readDismissed(projectId)));
|
|
42
|
+
if (open.length === 0 || setupBannerDismissed(open, dismissed))
|
|
43
|
+
return null;
|
|
44
|
+
const dismiss = () => {
|
|
45
|
+
const ids = open.map((step) => step.id);
|
|
46
|
+
try {
|
|
47
|
+
window.localStorage.setItem(DISMISS_KEY(projectId), JSON.stringify(ids));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Private mode: the banner hides for this view only.
|
|
51
|
+
}
|
|
52
|
+
setDismissed(ids);
|
|
53
|
+
};
|
|
54
|
+
return (
|
|
55
|
+
// One line: the title centers on the button, not on the alert's first line.
|
|
56
|
+
_jsxs(Alert, { variant: "default", className: cn('items-center', className), "data-testid": "setup-banner", children: [_jsx(AlertTitle, { children: t('bannerTitle', { left: open.length }) }), _jsxs(AlertActions, { children: [_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: `/workspaces/${projectId}/setup`, children: t('title') }) }), _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": t('bannerDismiss'), onClick: dismiss, children: _jsx(XIcon, { className: "size-3.5" }) })] })] }));
|
|
57
|
+
}
|
|
@@ -41,3 +41,17 @@ export declare function setupSteps({ connectors, secrets, slack, slackName, }: {
|
|
|
41
41
|
};
|
|
42
42
|
slackName: string;
|
|
43
43
|
}): SetupStep[];
|
|
44
|
+
/**
|
|
45
|
+
* The open steps this viewer can finish: a secret needs secret write; a
|
|
46
|
+
* connector sign-in and Slack need connector write (the Slack install route
|
|
47
|
+
* checks `project.connector.write`). The home banner counts these.
|
|
48
|
+
*/
|
|
49
|
+
export declare function openStepsFor(steps: SetupStep[], can: {
|
|
50
|
+
connect: boolean;
|
|
51
|
+
setSecrets: boolean;
|
|
52
|
+
}): SetupStep[];
|
|
53
|
+
/**
|
|
54
|
+
* A dismissed banner stays hidden until a step opens that was not open when
|
|
55
|
+
* the viewer dismissed it, for example a connector a later setup added.
|
|
56
|
+
*/
|
|
57
|
+
export declare function setupBannerDismissed(open: SetupStep[], dismissedIds: readonly string[] | null): boolean;
|
|
@@ -36,3 +36,18 @@ export function setupSteps({ connectors, secrets, slack, slackName, }) {
|
|
|
36
36
|
steps.push({ kind: 'slack', id: 'slack', name: slackName, done: slack.installed });
|
|
37
37
|
return [...steps.filter((step) => !step.done), ...steps.filter((step) => step.done)];
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The open steps this viewer can finish: a secret needs secret write; a
|
|
41
|
+
* connector sign-in and Slack need connector write (the Slack install route
|
|
42
|
+
* checks `project.connector.write`). The home banner counts these.
|
|
43
|
+
*/
|
|
44
|
+
export function openStepsFor(steps, can) {
|
|
45
|
+
return steps.filter((step) => !step.done && (step.kind === 'secret' ? can.setSecrets : can.connect));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A dismissed banner stays hidden until a step opens that was not open when
|
|
49
|
+
* the viewer dismissed it, for example a connector a later setup added.
|
|
50
|
+
*/
|
|
51
|
+
export function setupBannerDismissed(open, dismissedIds) {
|
|
52
|
+
return dismissedIds !== null && open.every((step) => dismissedIds.includes(step.id));
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SetupStep } from './setup-steps.js';
|
|
2
|
+
/**
|
|
3
|
+
* A workspace's setup steps, read from the cache entries the Customize pages
|
|
4
|
+
* and the project shell's prefetch already fill. The setup page polls them
|
|
5
|
+
* (`pollMs`): the person may finish a step in another tab. The home banner
|
|
6
|
+
* reads them as they are.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSetupSteps(projectId: string, { slackRequested, pollMs, enabled }?: {
|
|
9
|
+
slackRequested?: boolean;
|
|
10
|
+
pollMs?: number;
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
steps: SetupStep[];
|
|
14
|
+
usesSlack: boolean;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
failed: boolean;
|
|
17
|
+
refresh: () => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { getSlackInstallation, listConnectors, listProjectSecrets } from '@kortix/sdk';
|
|
3
|
+
import { contract, FRESHNESS, qk } from '@kortix/sdk/react';
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { buildRows } from '../../customize/sections/view/secrets-view.js';
|
|
6
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
7
|
+
import { setupSteps, slackNeeded } from './setup-steps.js';
|
|
8
|
+
/**
|
|
9
|
+
* A workspace's setup steps, read from the cache entries the Customize pages
|
|
10
|
+
* and the project shell's prefetch already fill. The setup page polls them
|
|
11
|
+
* (`pollMs`): the person may finish a step in another tab. The home banner
|
|
12
|
+
* reads them as they are.
|
|
13
|
+
*/
|
|
14
|
+
export function useSetupSteps(projectId, { slackRequested = false, pollMs, enabled = true } = {}) {
|
|
15
|
+
const t = useTranslations('workspaceSetup');
|
|
16
|
+
const connectorsQuery = useQuery({
|
|
17
|
+
queryKey: qk.project.connectors(projectId),
|
|
18
|
+
queryFn: () => listConnectors(projectId, { includeSchemas: false }),
|
|
19
|
+
...contract(FRESHNESS.connectors),
|
|
20
|
+
enabled,
|
|
21
|
+
});
|
|
22
|
+
const secretsQuery = useQuery({
|
|
23
|
+
queryKey: qk.project.secrets(projectId),
|
|
24
|
+
queryFn: () => listProjectSecrets(projectId),
|
|
25
|
+
...contract('config'),
|
|
26
|
+
refetchOnWindowFocus: true,
|
|
27
|
+
refetchInterval: pollMs ?? false,
|
|
28
|
+
enabled,
|
|
29
|
+
});
|
|
30
|
+
const connectors = connectorsQuery.data?.connectors ?? [];
|
|
31
|
+
const usesSlack = slackNeeded(connectors, slackRequested);
|
|
32
|
+
// The same cache entry as the Channels page (`useSlackInstall`).
|
|
33
|
+
const slackInstallQuery = useQuery({
|
|
34
|
+
queryKey: ['channels', 'slack-install', projectId],
|
|
35
|
+
queryFn: () => getSlackInstallation(projectId),
|
|
36
|
+
enabled: enabled && usesSlack,
|
|
37
|
+
refetchOnWindowFocus: true,
|
|
38
|
+
refetchInterval: (query) => (pollMs && !query.state.data ? pollMs : false),
|
|
39
|
+
});
|
|
40
|
+
const loading = connectorsQuery.isLoading || secretsQuery.isLoading || (usesSlack && slackInstallQuery.isLoading);
|
|
41
|
+
const failed = connectorsQuery.isError || secretsQuery.isError;
|
|
42
|
+
const steps = !enabled || loading || failed
|
|
43
|
+
? []
|
|
44
|
+
: setupSteps({
|
|
45
|
+
connectors,
|
|
46
|
+
secrets: buildRows(secretsQuery.data),
|
|
47
|
+
slack: { needed: usesSlack, installed: Boolean(slackInstallQuery.data) },
|
|
48
|
+
slackName: t('slackName'),
|
|
49
|
+
});
|
|
50
|
+
const refresh = () => {
|
|
51
|
+
void connectorsQuery.refetch();
|
|
52
|
+
void secretsQuery.refetch();
|
|
53
|
+
if (usesSlack)
|
|
54
|
+
void slackInstallQuery.refetch();
|
|
55
|
+
};
|
|
56
|
+
return { steps, usesSlack, loading, failed, refresh };
|
|
57
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { CheckCircleIcon, KeyIcon } from '@phosphor-icons/react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { getSlackMode } from '@kortix/sdk';
|
|
5
|
+
import { useProjectAccountId } from '@kortix/sdk/react';
|
|
6
6
|
import { useQuery } from '@tanstack/react-query';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
import { connectorHref } from '../../customize/connectors/connector-routes.js';
|
|
9
9
|
import { SetCredentialModal } from '../../customize/sections/connectors-view.js';
|
|
10
|
-
import {
|
|
10
|
+
import { ProjectSecretDialog } from '../../customize/sections/view/secrets-view.js';
|
|
11
11
|
import { CapabilityPageShell } from '../../customize/shared/capability-page-shell.js';
|
|
12
12
|
import { useTranslations } from '../../i18n/index.js';
|
|
13
13
|
import { ConnectorLogo } from '../../internal/connector-logo/connector-logo.js';
|
|
@@ -23,7 +23,7 @@ import { EmptyArt } from '../../primitives/empty-art.js';
|
|
|
23
23
|
import { ErrorState } from '../../primitives/error-state.js';
|
|
24
24
|
import { Skeleton } from '../../primitives/skeleton.js';
|
|
25
25
|
import { UiLink as Link, useUiSearchParams } from '../../providers/ui-provider.js';
|
|
26
|
-
import {
|
|
26
|
+
import { useSetupSteps } from './use-setup-steps.js';
|
|
27
27
|
/** While a step is open, read it again this often: the person may finish it in another tab. */
|
|
28
28
|
const OPEN_STEP_POLL_MS = 5_000;
|
|
29
29
|
/**
|
|
@@ -39,51 +39,18 @@ export function WorkspaceSetupPage({ projectId }) {
|
|
|
39
39
|
const accountId = useProjectAccountId(projectId);
|
|
40
40
|
const canConnect = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_CONNECTOR_WRITE, { accountId }).allowed === true;
|
|
41
41
|
const canSetSecrets = useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_SECRET_WRITE).allowed === true;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...contract(FRESHNESS.connectors),
|
|
46
|
-
});
|
|
47
|
-
const secretsQuery = useQuery({
|
|
48
|
-
queryKey: qk.project.secrets(projectId),
|
|
49
|
-
queryFn: () => listProjectSecrets(projectId),
|
|
50
|
-
...contract('config'),
|
|
51
|
-
refetchOnWindowFocus: true,
|
|
52
|
-
refetchInterval: OPEN_STEP_POLL_MS,
|
|
53
|
-
});
|
|
54
|
-
const connectors = connectorsQuery.data?.connectors ?? [];
|
|
55
|
-
const usesSlack = slackNeeded(connectors, params.get('slack') === '1');
|
|
56
|
-
// The same cache entries as the Channels page (`useSlackInstall`, `useSlackMode`).
|
|
57
|
-
const slackInstallQuery = useQuery({
|
|
58
|
-
queryKey: ['channels', 'slack-install', projectId],
|
|
59
|
-
queryFn: () => getSlackInstallation(projectId),
|
|
60
|
-
enabled: usesSlack,
|
|
61
|
-
refetchOnWindowFocus: true,
|
|
62
|
-
refetchInterval: (query) => (query.state.data ? false : OPEN_STEP_POLL_MS),
|
|
42
|
+
const { steps, usesSlack, loading, failed, refresh } = useSetupSteps(projectId, {
|
|
43
|
+
slackRequested: params.get('slack') === '1',
|
|
44
|
+
pollMs: OPEN_STEP_POLL_MS,
|
|
63
45
|
});
|
|
46
|
+
// The same cache entry as the Channels page (`useSlackMode`).
|
|
64
47
|
const slackModeQuery = useQuery({
|
|
65
48
|
queryKey: ['channels', 'slack-mode', projectId],
|
|
66
49
|
queryFn: () => getSlackMode(projectId),
|
|
67
50
|
enabled: usesSlack,
|
|
68
51
|
staleTime: 60_000,
|
|
69
52
|
});
|
|
70
|
-
const loading = connectorsQuery.isLoading || secretsQuery.isLoading || (usesSlack && slackInstallQuery.isLoading);
|
|
71
|
-
const failed = connectorsQuery.isError || secretsQuery.isError;
|
|
72
|
-
const steps = loading || failed
|
|
73
|
-
? []
|
|
74
|
-
: setupSteps({
|
|
75
|
-
connectors,
|
|
76
|
-
secrets: buildRows(secretsQuery.data),
|
|
77
|
-
slack: { needed: usesSlack, installed: Boolean(slackInstallQuery.data) },
|
|
78
|
-
slackName: t('slackName'),
|
|
79
|
-
});
|
|
80
53
|
const done = steps.filter((step) => step.done).length;
|
|
81
|
-
const refresh = () => {
|
|
82
|
-
void connectorsQuery.refetch();
|
|
83
|
-
void secretsQuery.refetch();
|
|
84
|
-
if (usesSlack)
|
|
85
|
-
void slackInstallQuery.refetch();
|
|
86
|
-
};
|
|
87
54
|
const workspaceLink = (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: `/workspaces/${projectId}`, children: t('openWorkspace') }) }));
|
|
88
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] })) }));
|
|
89
56
|
}
|
|
@@ -82,7 +82,7 @@ export const CATEGORY_TEXT = {
|
|
|
82
82
|
warning: 'text-kortix-orange',
|
|
83
83
|
};
|
|
84
84
|
export const CATEGORY_CAUSE = {
|
|
85
|
-
quota: '
|
|
85
|
+
quota: 'Kortix’s image storage was full. Kortix frees space on its own. Retry in a few minutes.',
|
|
86
86
|
dockerfile: 'A step in the project’s Dockerfile did not finish.',
|
|
87
87
|
git: 'The build could not read the project’s repository. Its access may have expired.',
|
|
88
88
|
tunnel: 'The sandbox could not reach Kortix while it was being built.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kortix/ui",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Kortix UI: the shared React component library for apps/web, Kortix Apps and SDK hosts. Tailwind v4 classes, themed by CSS variables.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
@@ -2266,7 +2266,7 @@
|
|
|
2266
2266
|
"@extend-ai/react-docx": "^0.7.5",
|
|
2267
2267
|
"@extend-ai/react-xlsx": "0.13.4",
|
|
2268
2268
|
"@glideapps/glide-data-grid": "6.0.4-alpha24",
|
|
2269
|
-
"@kortix/llm-catalog": "0.16.
|
|
2269
|
+
"@kortix/llm-catalog": "0.16.1",
|
|
2270
2270
|
"@lezer/highlight": "1.2.3",
|
|
2271
2271
|
"@paper-design/shaders-react": "^0.0.76",
|
|
2272
2272
|
"@phosphor-icons/react": "2.1.10",
|
|
@@ -2342,7 +2342,7 @@
|
|
|
2342
2342
|
"zustand": "^5.0.3"
|
|
2343
2343
|
},
|
|
2344
2344
|
"peerDependencies": {
|
|
2345
|
-
"@kortix/sdk": "^0.16.
|
|
2345
|
+
"@kortix/sdk": "^0.16.1",
|
|
2346
2346
|
"@tanstack/react-query": "^5.75.2",
|
|
2347
2347
|
"@types/react": ">=18",
|
|
2348
2348
|
"react": ">=19",
|