@kortix/ui 0.15.8 → 0.15.10
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 +75 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/session/attachment-tile.d.ts +32 -0
- package/dist/_vendor/shared/session/stop-refusal.d.ts +15 -0
- package/dist/_vendor/shared/session/tool-row-text.d.ts +58 -0
- package/dist/_vendor/shared/session-delivery.d.ts +2 -0
- package/dist/access/access/access-dialog-share.js +12 -6
- package/dist/access/access/share-selection.d.ts +9 -0
- package/dist/access/access/share-selection.js +64 -0
- package/dist/customize/connectors/connector-identity.js +3 -3
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
- package/dist/customize/connectors/detail/connector-accounts.js +2 -2
- package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
- package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
- package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
- package/dist/customize/connectors/detail/connector-notice.js +23 -4
- package/dist/customize/connectors/detail/connector-page.js +35 -10
- package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
- package/dist/customize/connectors/detail/connector-status.js +11 -0
- package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
- package/dist/customize/connectors/detail/status-badge.js +2 -1
- package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/providers/provider-accordion.js +9 -8
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +10 -16
- package/dist/customize/providers/provider-sheet.js +13 -8
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- package/dist/customize/sections/connector-connection-form.d.ts +0 -1
- package/dist/customize/sections/connector-connection-form.js +0 -9
- package/dist/customize/sections/connectors-view.d.ts +4 -1
- package/dist/customize/sections/connectors-view.js +42 -7
- package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
- package/dist/customize/sections/view/account-secret-resources-panel.js +44 -5
- package/dist/customize/sections/view/review-center-connected.js +7 -3
- package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
- package/dist/customize/sections/view/secret-delivery.js +14 -4
- package/dist/customize/sections/view/secrets-view.js +21 -5
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
- package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
- package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
- package/dist/customize/triggers/schedule/then-fields.js +8 -4
- package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
- package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
- package/dist/customize/triggers/schedule/trigger-list.js +18 -2
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/files/renderers/pptx-renderer.js +5 -20
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
- package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
- package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
- package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
- package/dist/files/renderers/presentation/presentation-utils.js +4 -0
- package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
- package/dist/files/renderers/presentation/slide-iframe.js +61 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
- package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
- package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
- package/dist/files/renderers/show-content-renderer.js +16 -11
- package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
- package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
- package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
- package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
- package/dist/files/viewer/file-content-renderer.js +1 -4
- package/dist/files/viewer/use-file-content-state.js +10 -9
- package/dist/i18n/en.d.ts +55 -7
- package/dist/i18n/en.js +59 -11
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
- package/dist/internal/chrome/use-chrome-offered.js +4 -2
- package/dist/internal/hooks/connectors/invalidate-connections.d.ts +10 -0
- package/dist/internal/hooks/connectors/invalidate-connections.js +18 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +2 -0
- package/dist/internal/hooks/projects/use-new-project-session.js +4 -1
- 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/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/error-handler.js +33 -0
- package/dist/internal/lib/trigger-clock.d.ts +7 -2
- package/dist/internal/lib/trigger-clock.js +17 -3
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/connector-gate-store.d.ts +3 -1
- package/dist/internal/stores/connector-gate-store.js +13 -3
- package/dist/internal/stores/upgrade-dialog-store.d.ts +4 -0
- package/dist/internal/stores/upgrade-dialog-store.js +2 -0
- package/dist/lib/routes.d.ts +4 -11
- package/dist/lib/routes.js +3 -5
- package/dist/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/markdown/unified-markdown-utils.d.ts +7 -0
- package/dist/markdown/unified-markdown-utils.js +19 -0
- package/dist/markdown/unified-markdown.js +16 -3
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/dialog.js +3 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/modal.js +1 -1
- package/dist/primitives/preview-image.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/session/composer/ComposerCard.js +4 -2
- package/dist/session/composer/attachment-tile.d.ts +2 -26
- package/dist/session/composer/attachment-tile.js +3 -47
- package/dist/session/composer/composer-chat-input.d.ts +2 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.d.ts +2 -0
- package/dist/session/composer/composer.js +5 -8
- package/dist/session/composer/draft/home-composer-focus-handoff.d.ts +7 -0
- package/dist/session/composer/draft/home-composer-focus-handoff.js +94 -0
- package/dist/session/composer/draft/use-composer-draft.d.ts +3 -1
- package/dist/session/composer/draft/use-composer-draft.js +22 -2
- package/dist/session/composer/editor/composer-editor.d.ts +4 -2
- package/dist/session/composer/editor/composer-editor.js +7 -3
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/models/chatgpt-connection-button.js +5 -9
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +21 -5
- package/dist/session/models/model-connection-layout.d.ts +2 -0
- package/dist/session/models/model-connection-layout.js +4 -0
- package/dist/session/models/model-picker-panel.js +6 -2
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/provider-key-action.d.ts +10 -0
- package/dist/session/models/provider-key-action.js +35 -0
- package/dist/session/models/provider-key-slot.d.ts +9 -0
- package/dist/session/models/provider-key-slot.js +19 -0
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/overrides/session-overrides-toolbar.js +2 -4
- package/dist/session/prompts/ask-deck.d.ts +5 -1
- package/dist/session/prompts/ask-deck.js +15 -3
- package/dist/session/prompts/question-labels.d.ts +16 -0
- package/dist/session/prompts/question-labels.js +34 -0
- package/dist/session/prompts/question-prompt.js +6 -6
- package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/status/stop-refusal.d.ts +6 -12
- package/dist/session/status/stop-refusal.js +6 -19
- package/dist/session/thread/agent-run-props.d.ts +19 -0
- package/dist/session/thread/agent-run-props.js +54 -0
- package/dist/session/thread/session-chat.js +34 -6
- package/dist/session/thread/transcript.d.ts +17 -1
- package/dist/session/thread/transcript.js +104 -16
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/turn/answer-streaming.d.ts +21 -0
- package/dist/session/turn/answer-streaming.js +34 -0
- package/dist/session/turn/queued-prompt-bubbles.d.ts +5 -0
- package/dist/session/turn/queued-prompt-bubbles.js +12 -0
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +55 -7
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/inbox/workspace-inbox.d.ts +6 -16
- package/dist/workspace/inbox/workspace-inbox.js +9 -51
- package/dist/workspace/layout/project-home.js +5 -11
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +29 -15
- package/dist/workspace/new/advanced-fields.d.ts +4 -1
- package/dist/workspace/new/advanced-fields.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +9 -0
- package/dist/workspace/new/workspace-name.js +20 -0
- package/dist/workspace/projects/session-starter.d.ts +6 -4
- package/dist/workspace/projects/session-starter.js +8 -14
- package/dist/workspace/review/review-center.d.ts +6 -2
- package/dist/workspace/review/review-center.js +45 -25
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/package.json +3 -7
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/customize/connectors/invalidate-connections.d.ts +0 -2
- package/dist/customize/connectors/invalidate-connections.js +0 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +0 -17
- package/dist/internal/notifications/use-inbox-summary.js +0 -28
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { connectorConnectionQueryKeys } from '
|
|
4
|
-
import { invalidateConnections } from '../invalidate-connections.js';
|
|
3
|
+
import { connectorConnectionQueryKeys, invalidateConnections } from '../../../internal/hooks/connectors/invalidate-connections.js';
|
|
5
4
|
import { ConnectorNoticeRow, NOTICE_BODY, NOTICE_TITLE, NoticeLogLine, } from './connector-notice-view.js';
|
|
6
5
|
import { DetailPageShell, DETAIL_PAGE_COLUMN as PAGE_COLUMN } from './detail-page-shell.js';
|
|
7
|
-
import { getProjectDetail, listConnectors, syncConnectors } from '@kortix/sdk';
|
|
6
|
+
import { connectorAccountNeedsSignIn, connectorAccountSignInStarted, getProjectDetail, listConnectors, syncConnectors, } from '@kortix/sdk';
|
|
8
7
|
import { contract, FRESHNESS, qk, useProjectAccountId } from '@kortix/sdk/react';
|
|
9
8
|
import { CaretLeftIcon, PlugIcon, PlusIcon } from '@phosphor-icons/react';
|
|
10
9
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
@@ -33,14 +32,15 @@ import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
|
33
32
|
import { isManagedConnectorProvider } from '../provider-label.js';
|
|
34
33
|
import { ConnectorDetailTabs } from './connector-detail-tabs.js';
|
|
35
34
|
import { ConnectorMoveRow, useConnectorMove } from './connector-move-row.js';
|
|
36
|
-
import { connectorNotice, noticeButton, noticeTarget } from './connector-notice.js';
|
|
35
|
+
import { accountNeverSignedIn, connectorNotice, noticeButton, noticeTarget } from './connector-notice.js';
|
|
37
36
|
import { connectHandoff, connectorPageState } from './connector-page-state.js';
|
|
38
|
-
import { connectorRunsOver,
|
|
37
|
+
import { connectorRunsOver, connectorTone } from './connector-status.js';
|
|
39
38
|
import { CONNECTOR_TAB_LABEL_KEY, connectorTabs } from './connector-tabs.js';
|
|
40
39
|
import { useConnectorEventTriggers } from './connector-triggers.js';
|
|
41
40
|
import { ProviderInfo, providerName } from './provider-info.js';
|
|
42
41
|
import { ConnectorStatusBadge } from './status-badge.js';
|
|
43
42
|
import { useConnectorDetail } from './use-connector-detail.js';
|
|
43
|
+
import { useMcpOAuthSignIn } from './use-mcp-oauth-sign-in.js';
|
|
44
44
|
/** The column `CapabilityPageShell` gives the list page beside this one. */
|
|
45
45
|
/**
|
|
46
46
|
* `/workspaces/<id>/admin/connectors/<app>/<connector>` — one connector, as
|
|
@@ -118,6 +118,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
118
118
|
const t = useTranslations('connectorPages');
|
|
119
119
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
120
120
|
const tSharing = useTranslations('accessSharing');
|
|
121
|
+
const tSignIn = useTranslations('connectSignIn');
|
|
121
122
|
const search = useUiSearchParams();
|
|
122
123
|
const router = useUiRouter();
|
|
123
124
|
const pathname = useUiPathname();
|
|
@@ -233,6 +234,14 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
233
234
|
const everyoneLabel = projectName
|
|
234
235
|
? tSharing('everyone', { project: projectName })
|
|
235
236
|
: tSharing('visibilityEveryone');
|
|
237
|
+
// The account the banner's button fixes (see `noticeTarget`).
|
|
238
|
+
const target = noticeTarget(accounts);
|
|
239
|
+
const targetAccount = target && target !== 'add' ? target : null;
|
|
240
|
+
// An MCP server with one-click OAuth signs in like a managed app: its
|
|
241
|
+
// accounts say "Sign in", never "credential". Any account answers for it.
|
|
242
|
+
const oauthMcp = useMcpOAuthSignIn(projectId, connector, (targetAccount ?? accounts.find((account) => account.authorized === false) ?? null)
|
|
243
|
+
?.connection_id ?? null);
|
|
244
|
+
const signsIn = isManagedProvider || oauthMcp;
|
|
236
245
|
// One banner says what is wrong and carries the button that fixes it.
|
|
237
246
|
const notice = connectorNotice({
|
|
238
247
|
provider: connector.provider,
|
|
@@ -244,6 +253,9 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
244
253
|
managed: isManagedProvider,
|
|
245
254
|
accountCount: accounts.length,
|
|
246
255
|
accountsLoaded: connectionsQuery.isSuccess,
|
|
256
|
+
signsIn,
|
|
257
|
+
neverSignedIn: targetAccount ? accountNeverSignedIn(targetAccount) : true,
|
|
258
|
+
toolCount: connector.actions.length,
|
|
247
259
|
});
|
|
248
260
|
// Re-read the connector's tools. The list refetch that follows shows the
|
|
249
261
|
// new status, or the same error with its reason.
|
|
@@ -273,9 +285,11 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
273
285
|
// A Pipedream connector that can move: the move is the fix. A new Pipedream
|
|
274
286
|
// account would only have to sign in again after the move.
|
|
275
287
|
const move = useConnectorMove(projectId, connector);
|
|
276
|
-
const fix = move?.to ? null : noticeButton(notice,
|
|
288
|
+
const fix = move?.to ? null : noticeButton(notice, target, isManagedProvider);
|
|
277
289
|
const runFix = () => {
|
|
278
|
-
if (fix?.run === '
|
|
290
|
+
if (fix?.run === 'settings')
|
|
291
|
+
setTab('settings');
|
|
292
|
+
else if (fix?.run === 'add')
|
|
279
293
|
requestAdd();
|
|
280
294
|
else if (fix?.run === 'sign_in' && fix.account)
|
|
281
295
|
signIn.mutate(fix.account);
|
|
@@ -286,7 +300,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
286
300
|
// account reconnects through its provider window.
|
|
287
301
|
const needsSignIn = isManagedProvider || Boolean(connector.authSecret);
|
|
288
302
|
const connectAccount = (account) => isManagedProvider ? reconnectAccount(account) : signIn.mutate(account);
|
|
289
|
-
const tone =
|
|
303
|
+
const tone = connectorTone(connector, connectionsQuery.isSuccess ? accounts.length : undefined);
|
|
290
304
|
const providerManagedBy = isManagedConnectorProvider(connector.provider)
|
|
291
305
|
? connectorRunsOver(connector.provider)
|
|
292
306
|
: null;
|
|
@@ -308,8 +322,14 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
308
322
|
: [{ key: 'runs', label: t('infoRunsOver'), value: connectorRunsOver(connector.provider) }]),
|
|
309
323
|
];
|
|
310
324
|
// The Accounts tab's own query; a channel has none, and the cell waits for it.
|
|
325
|
+
// It counts accounts an agent can use: a row whose sign-in never finished is
|
|
326
|
+
// listed in the tab, not counted here.
|
|
311
327
|
if (!isChannel && connectionsQuery.isSuccess)
|
|
312
|
-
stripCells.push({
|
|
328
|
+
stripCells.push({
|
|
329
|
+
key: 'accounts',
|
|
330
|
+
label: t('stripAccounts'),
|
|
331
|
+
value: String(accounts.filter((account) => !connectorAccountNeedsSignIn(account, connector)).length),
|
|
332
|
+
});
|
|
313
333
|
stripCells.push({
|
|
314
334
|
key: 'tools',
|
|
315
335
|
label: t('stripTools'),
|
|
@@ -322,7 +342,11 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
322
342
|
const addAccountControl = isComputer ? (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: () => setComputerOpen(true), children: [_jsx(PlusIcon, { className: "size-4 shrink-0" }), tI18nComplete.raw('text1a2303ede074')] })) : (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: requestAdd, disabled: connectPending, children: [_jsx(PlusIcon, { className: "size-4 shrink-0" }), tSharing('addAccount')] }));
|
|
323
343
|
return (_jsxs(SplitSheet, { open: sheetOpen, onOpenChange: closeCredential, size: "lg", className: "flex-1", children: [_jsx(SplitSheetMain, { children: _jsxs("div", { className: columnClassName, children: [back, _jsxs("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx(ConnectorLogo, { source: installedConnectorLogoSource(connector), size: "lg" }), wrapTitle(_jsx("h1", { ref: headingRef, tabIndex: -1, className: "text-foreground min-w-0 text-xl font-medium text-balance wrap-break-word", children: displayName }))] }), _jsxs("div", { className: "flex shrink-0 flex-wrap items-center gap-2", children: [isComputer && headerCta === 'connect' ? addAccountControl : null, connected ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => startPrivateSession(), children: t('newSession') })) : null, headerEnd] })] }), _jsxs("div", { className: "bg-popover divide-border divide-y overflow-hidden rounded-md border", children: [_jsx("dl", { className: "divide-border flex divide-x", children: stripCells.map((cell) => (_jsxs("div", { className: "min-w-0 flex-1 space-y-0.5 px-4 py-2.5", children: [_jsxs("dt", { className: "text-muted-foreground flex h-4 items-center justify-between gap-2 text-xs", children: [_jsx("span", { className: "truncate", children: cell.label }), cell.labelAddon] }), _jsx("dd", { className: "text-foreground flex min-w-0 items-center gap-1.5 truncate text-sm font-medium", children: cell.value })] }, cell.key))) }), notice.kind !== 'none' && !(notice.kind === 'no_account' && tab === 'accounts') ? (_jsxs(ConnectorNoticeRow, { title: t(NOTICE_TITLE[notice.kind], { name: displayName }), detail: notice.kind === 'error' && notice.reason ? (_jsx(NoticeLogLine, { reason: notice.reason })) : (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: t(notice.kind === 'needs_credential' && isManagedProvider
|
|
324
344
|
? 'noticeReconnectBody'
|
|
325
|
-
: NOTICE_BODY[notice.kind], { name: displayName }) })), children: [notice.kind === 'error' && canWrite ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "gap-1.5", onClick: () => retry.mutate(), disabled: retry.isPending, children: [retry.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, tI18nComplete.raw('text942087cc2d41')] })) : null, fix?.kind === 'add_account' ? (addAccountControl) : fix?.kind === '
|
|
345
|
+
: NOTICE_BODY[notice.kind], { name: displayName }) })), children: [notice.kind === 'error' && canWrite ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "gap-1.5", onClick: () => retry.mutate(), disabled: retry.isPending, children: [retry.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, tI18nComplete.raw('text942087cc2d41')] })) : null, fix?.kind === 'add_account' ? (addAccountControl) : fix?.kind === 'add_routes' ? (
|
|
346
|
+
// The routes spec is on the Settings tab, which only writers see.
|
|
347
|
+
canWrite ? (_jsx(Button, { size: "sm", variant: "secondary", onClick: runFix, children: t('noticeAddRoutesAction') })) : null) : fix?.kind === 'sign_in' ? (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: runFix, disabled: signIn.isPending || connectPending, children: [signIn.isPending || connectPending ? (_jsx(SessionDotMatrix, { size: 14, className: "shrink-0" })) : null, fix.account && connectorAccountSignInStarted(fix.account)
|
|
348
|
+
? tSignIn('finishSignIn')
|
|
349
|
+
: t('noticeSignInAction')] })) : fix ? (
|
|
326
350
|
// Fix it here: credential entry for a direct account, the
|
|
327
351
|
// provider window for a managed one, or "Add account" for
|
|
328
352
|
// a caller with no account of their own.
|
|
@@ -343,6 +367,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
343
367
|
onRemoved: onLeave,
|
|
344
368
|
onSetCredential: setCredentialTarget,
|
|
345
369
|
onConnect: needsSignIn ? connectAccount : undefined,
|
|
370
|
+
signsIn,
|
|
346
371
|
showAccountInfo: true,
|
|
347
372
|
}, settings: {
|
|
348
373
|
projectId: projectId,
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import type { AdminConnector } from '@kortix/sdk';
|
|
2
2
|
/** The connector states and their rules live in `@kortix/sdk`. */
|
|
3
3
|
export { connectorDerivedState, connectorStatusTone, connectorUsable, type ConnectorDerivedState, type ConnectorStatusTone, } from '@kortix/sdk';
|
|
4
|
-
|
|
4
|
+
import { connectorStatusTone, type ConnectorStatusTone } from '@kortix/sdk';
|
|
5
|
+
/**
|
|
6
|
+
* The tone a connector shows. `no_tools`: an HTTP connector that works but has
|
|
7
|
+
* no routes, so agents have nothing to call. It reads "No tools", not
|
|
8
|
+
* "Connected" with a 0 beside it.
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectorTone = ConnectorStatusTone | 'no_tools';
|
|
11
|
+
/** An HTTP connector with no routes: it gives agents no tools. */
|
|
12
|
+
export declare function connectorHasNoTools(connector: Pick<AdminConnector, 'provider' | 'actions'>): boolean;
|
|
13
|
+
export declare function connectorTone(connector: Parameters<typeof connectorStatusTone>[0] & Pick<AdminConnector, 'provider' | 'actions'>, accountCount?: number): ConnectorTone;
|
|
14
|
+
export declare const STATUS_DOT: Record<ConnectorTone, string>;
|
|
5
15
|
/** The `connectorPages` key of each state's word. */
|
|
6
16
|
export declare const STATUS_WORD: {
|
|
7
17
|
readonly connected: "statusConnected";
|
|
8
18
|
readonly account: "statusNeedsAccount";
|
|
9
19
|
readonly error: "statusError";
|
|
20
|
+
readonly no_tools: "statusNoTools";
|
|
10
21
|
};
|
|
11
22
|
/** What the connector runs over: its provider, named the way a person says it. */
|
|
12
23
|
export declare function connectorRunsOver(provider: AdminConnector['provider']): string;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/** The connector states and their rules live in `@kortix/sdk`. */
|
|
2
2
|
export { connectorDerivedState, connectorStatusTone, connectorUsable, } from '@kortix/sdk';
|
|
3
|
+
import { connectorStatusTone } from '@kortix/sdk';
|
|
3
4
|
import { providerLabel } from '../provider-label.js';
|
|
5
|
+
/** An HTTP connector with no routes: it gives agents no tools. */
|
|
6
|
+
export function connectorHasNoTools(connector) {
|
|
7
|
+
return connector.provider === 'http' && (connector.actions?.length ?? 0) === 0;
|
|
8
|
+
}
|
|
9
|
+
export function connectorTone(connector, accountCount) {
|
|
10
|
+
const tone = connectorStatusTone(connector, accountCount);
|
|
11
|
+
return tone === 'connected' && connectorHasNoTools(connector) ? 'no_tools' : tone;
|
|
12
|
+
}
|
|
4
13
|
export const STATUS_DOT = {
|
|
5
14
|
connected: 'bg-kortix-green',
|
|
6
15
|
account: 'bg-kortix-orange',
|
|
7
16
|
error: 'bg-kortix-red',
|
|
17
|
+
no_tools: 'bg-kortix-orange',
|
|
8
18
|
};
|
|
9
19
|
/** The `connectorPages` key of each state's word. */
|
|
10
20
|
export const STATUS_WORD = {
|
|
11
21
|
connected: 'statusConnected',
|
|
12
22
|
account: 'statusNeedsAccount',
|
|
13
23
|
error: 'statusError',
|
|
24
|
+
no_tools: 'statusNoTools',
|
|
14
25
|
};
|
|
15
26
|
/** What the connector runs over: its provider, named the way a person says it. */
|
|
16
27
|
export function connectorRunsOver(provider) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
/** A connector's state as a Badge with its dot: Connected, Needs account or Error. */
|
|
1
|
+
import { type ConnectorTone } from './connector-status.js';
|
|
2
|
+
/** A connector's state as a Badge with its dot: Connected, Needs account, No tools or Error. */
|
|
3
3
|
export declare function ConnectorStatusBadge({ tone }: {
|
|
4
|
-
tone:
|
|
4
|
+
tone: ConnectorTone;
|
|
5
5
|
}): import("react").JSX.Element;
|
|
@@ -7,8 +7,9 @@ const STATUS_BADGE = {
|
|
|
7
7
|
connected: 'success',
|
|
8
8
|
account: 'warning',
|
|
9
9
|
error: 'destructive',
|
|
10
|
+
no_tools: 'warning',
|
|
10
11
|
};
|
|
11
|
-
/** A connector's state as a Badge with its dot: Connected, Needs account or Error. */
|
|
12
|
+
/** A connector's state as a Badge with its dot: Connected, Needs account, No tools or Error. */
|
|
12
13
|
export function ConnectorStatusBadge({ tone }) {
|
|
13
14
|
const t = useTranslations('connectorPages');
|
|
14
15
|
return (_jsxs(Badge, { variant: STATUS_BADGE[tone], size: "sm", children: [_jsx("span", { "data-slot": "status-dot", "aria-hidden": true, className: cn('rounded-full', STATUS_DOT[tone]) }), t(STATUS_WORD[tone])] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { listConnections, listedConnectorAccounts as connectorAccounts, } from '@kortix/sdk';
|
|
2
|
+
import { connectorAccountSignInStarted, listConnections, listedConnectorAccounts as connectorAccounts, } from '@kortix/sdk';
|
|
3
3
|
import { useProjectAccountId } from '@kortix/sdk/react';
|
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
|
5
5
|
import { useState } from 'react';
|
|
@@ -8,6 +8,7 @@ import { isManagedConnectorProvider } from '../provider-label.js';
|
|
|
8
8
|
import { connectorSetupStatus } from '../../sections/connector-connection-form.js';
|
|
9
9
|
import { usePipedreamConnectMember } from '../../../internal/hooks/connectors/use-pipedream-connect-member.js';
|
|
10
10
|
import { usePipedreamConnectProject } from '../../../internal/hooks/connectors/use-pipedream-connect-project.js';
|
|
11
|
+
import { useFinishSignIn } from '../../../internal/hooks/connectors/use-finish-sign-in.js';
|
|
11
12
|
import { useNewProjectSession } from '../../../internal/hooks/projects/use-new-project-session.js';
|
|
12
13
|
import { PROJECT_ACTIONS } from '../../../internal/lib/project-actions.js';
|
|
13
14
|
import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
@@ -53,6 +54,7 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
53
54
|
};
|
|
54
55
|
const connectShared = usePipedreamConnectProject(projectId, connector.slug, refreshAccounts);
|
|
55
56
|
const connectMine = usePipedreamConnectMember(projectId, connector.slug, refreshAccounts);
|
|
57
|
+
const finishSignIn = useFinishSignIn(projectId, connector.slug, refreshAccounts);
|
|
56
58
|
// `accountId` rides the qk.project.detail(id) cache the connectors page
|
|
57
59
|
// already filled, so the connections probe resolves on the first render
|
|
58
60
|
// instead of after its own getProject round-trip.
|
|
@@ -95,6 +97,12 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
95
97
|
* credential entry for a direct one. */
|
|
96
98
|
const reconnectAccount = (account) => {
|
|
97
99
|
const owner = account.owner_type === 'project' ? 'project' : 'me';
|
|
100
|
+
// A sign-in that started and never finished: ask the provider first, and
|
|
101
|
+
// record it when it finished there (an agent's link used outside Kortix).
|
|
102
|
+
if (isManagedProvider && account.authorized === false && connectorAccountSignInStarted(account)) {
|
|
103
|
+
finishSignIn.mutate(account);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
98
106
|
if (isManagedProvider) {
|
|
99
107
|
// Reconciling the SAME label re-points this row, never a second account.
|
|
100
108
|
if (owner === 'project')
|
|
@@ -119,7 +127,7 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
119
127
|
connected,
|
|
120
128
|
canManageConnections,
|
|
121
129
|
headerCta,
|
|
122
|
-
connectPending: connectShared.isPending || connectMine.isPending,
|
|
130
|
+
connectPending: connectShared.isPending || connectMine.isPending || finishSignIn.isPending,
|
|
123
131
|
refreshAccounts,
|
|
124
132
|
replaceSoleAccount,
|
|
125
133
|
startPrivateSession,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AdminConnector } from '@kortix/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* True when this MCP connector's accounts sign in through the server's
|
|
4
|
+
* one-click OAuth, not a typed credential. The banner and the account rows then
|
|
5
|
+
* say "Sign in", never "credential".
|
|
6
|
+
*
|
|
7
|
+
* Whether a server signs in with OAuth is a property of the server, so one
|
|
8
|
+
* account answers for the connector: the probe is the same discovery Install
|
|
9
|
+
* and the row's sign-in run. Only an account the caller may change can be
|
|
10
|
+
* probed; any other answer (no account, a refusal, no OAuth) is `false`, and
|
|
11
|
+
* the page keeps the credential wording.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMcpOAuthSignIn(projectId: string, connector: Pick<AdminConnector, 'provider' | 'authSecret'>, connectionId: string | null): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { discoverConnectionOAuth2Resource } from '@kortix/sdk';
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { autoConnectPlan } from '../../sections/connector-oauth2-auto.js';
|
|
5
|
+
/**
|
|
6
|
+
* True when this MCP connector's accounts sign in through the server's
|
|
7
|
+
* one-click OAuth, not a typed credential. The banner and the account rows then
|
|
8
|
+
* say "Sign in", never "credential".
|
|
9
|
+
*
|
|
10
|
+
* Whether a server signs in with OAuth is a property of the server, so one
|
|
11
|
+
* account answers for the connector: the probe is the same discovery Install
|
|
12
|
+
* and the row's sign-in run. Only an account the caller may change can be
|
|
13
|
+
* probed; any other answer (no account, a refusal, no OAuth) is `false`, and
|
|
14
|
+
* the page keeps the credential wording.
|
|
15
|
+
*/
|
|
16
|
+
export function useMcpOAuthSignIn(projectId, connector, connectionId) {
|
|
17
|
+
const enabled = connector.provider === 'mcp' && Boolean(connector.authSecret) && Boolean(connectionId);
|
|
18
|
+
const query = useQuery({
|
|
19
|
+
queryKey: ['connector-oauth-sign-in', projectId, connectionId],
|
|
20
|
+
queryFn: async () => {
|
|
21
|
+
const { discovery } = await discoverConnectionOAuth2Resource(projectId, connectionId);
|
|
22
|
+
return autoConnectPlan(discovery).kind === 'register';
|
|
23
|
+
},
|
|
24
|
+
enabled,
|
|
25
|
+
staleTime: 10 * 60_000,
|
|
26
|
+
retry: false,
|
|
27
|
+
});
|
|
28
|
+
return enabled && query.data === true;
|
|
29
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { invalidateConnections } from '
|
|
2
|
+
import { invalidateConnections } from '../../../internal/hooks/connectors/invalidate-connections.js';
|
|
3
3
|
import { checkMcpServerSignIn, createConnector, getDiscoverConnector, } from '@kortix/sdk';
|
|
4
4
|
import { useQueryClient } from '@tanstack/react-query';
|
|
5
5
|
import { useUiRouter } from '../../../providers/ui-provider.js';
|
|
@@ -42,7 +42,7 @@ import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/
|
|
|
42
42
|
import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
|
|
43
43
|
import { useLiveLlmProviderCatalog, useLlmProviderCatalogRevision, } from '../sections/llm-provider/use-live-catalog.js';
|
|
44
44
|
import { orderProviderRows } from '../sections/llm-provider/utils.js';
|
|
45
|
-
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
45
|
+
import { AccountSecretResourcesPanel, PooledProvidersNote } from '../sections/view/account-secret-resources-panel.js';
|
|
46
46
|
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
47
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
48
48
|
import { LLM_PROVIDERS, LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
@@ -179,14 +179,14 @@ function ExpandedBody({ projectId, entry, status, keyConnected, canWrite, enable
|
|
|
179
179
|
if (method === 'included' || (entry.envVars.length === 0 && !SUBSCRIPTION_BY_PROVIDER[entry.id])) {
|
|
180
180
|
content = (_jsx(AccordionSubRow, { children: entry.hint }));
|
|
181
181
|
}
|
|
182
|
-
else if (pooled.
|
|
183
|
-
content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }));
|
|
182
|
+
else if (pooled.accountId && entry.id === 'openai') {
|
|
183
|
+
content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) }), _jsx("p", { className: "text-foreground pt-3 text-xs font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }));
|
|
184
184
|
}
|
|
185
|
-
else if (pooled.
|
|
185
|
+
else if (pooled.accountId && entry.id === 'anthropic') {
|
|
186
186
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
187
187
|
content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('claudeAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsx("div", { className: "border-border border-t py-3", children: _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }) })] }));
|
|
188
188
|
}
|
|
189
|
-
else if (pooled.
|
|
189
|
+
else if (pooled.accountId && supportsPooledProviderKey(entry)) {
|
|
190
190
|
content = (_jsxs(_Fragment, { children: [SUBSCRIPTION_BY_PROVIDER[entry.id] ? _jsx(SignInSubRows, { projectId: projectId, entry: entry, canWrite: canWrite }) : null, _jsx("div", { className: "border-border border-t py-3", children: _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }) })] }));
|
|
191
191
|
}
|
|
192
192
|
else if (SUBSCRIPTION_BY_PROVIDER[entry.id]) {
|
|
@@ -281,8 +281,9 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
|
|
|
281
281
|
return null;
|
|
282
282
|
const singleKey = entry.envVars.length === 1 &&
|
|
283
283
|
!SUBSCRIPTION_BY_PROVIDER[entry.id] &&
|
|
284
|
-
!
|
|
285
|
-
|
|
284
|
+
!supportsPooledProviderKey(entry);
|
|
285
|
+
// A key saved through the form lands in the named store ("Workspace key").
|
|
286
|
+
const keyConnected = connectedIds.has(entry.id) || pooled.pooledProviderIds.has(entry.id);
|
|
286
287
|
if (addingId === row.id && singleKey && canWrite) {
|
|
287
288
|
return (_jsx(InlineAddKeyRow, { projectId: projectId, entry: entry, row: row, onDone: () => setAddingId(null) }, row.id));
|
|
288
289
|
}
|
|
@@ -318,7 +319,7 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
|
|
|
318
319
|
event.stopPropagation();
|
|
319
320
|
setSearchOpen(false);
|
|
320
321
|
}
|
|
321
|
-
} }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null,
|
|
322
|
+
} }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null, _jsx(PooledProvidersNote, { projectId: projectId, className: "text-muted-foreground px-1 pb-2 text-xs text-pretty" }), empty ? (_jsx(EmptyState, { size: "sm", title: t('noMatch', { query: search.trim() }) })) : (_jsxs(_Fragment, { children: [inUse.length > 0 ? (_jsx(AccordionGroupLabel, { label: `${t('inUse')} · ${inUse.length}`, action: searchOpen ? null : searchButton })) : null, inUse.map(renderRow), visibleAvailable.length > 0 ? (_jsx(AccordionGroupLabel, { label: t('available'), className: inUse.length > 0 ? 'pt-3.5' : undefined, action: inUse.length === 0 && !searchOpen ? searchButton : null })) : null, visibleAvailable.map(renderRow)] })), hiddenCount > 0 ? (_jsxs("div", { className: "flex items-center gap-2 px-1 pt-1", "data-provider-load-more": "", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), children: t('showMore') }), _jsx("span", { className: "text-muted-foreground text-xs tabular-nums", children: t('shownOf', {
|
|
322
323
|
shown: inUse.length + visibleAvailable.length,
|
|
323
324
|
total: inUse.length + available.length,
|
|
324
325
|
}) })] })) : null] }));
|
|
@@ -69,7 +69,7 @@ export interface ProviderConnectViewProps {
|
|
|
69
69
|
/** The provider open in the host's sheet, if any. */
|
|
70
70
|
selectedId?: string | null;
|
|
71
71
|
onSelect: (providerId: string) => void;
|
|
72
|
-
/** One line above the list:
|
|
72
|
+
/** One line above the list: who the keys added here are shared with. */
|
|
73
73
|
note?: string;
|
|
74
74
|
className?: string;
|
|
75
75
|
}
|
|
@@ -84,7 +84,6 @@ export declare function ProviderConnectView({ inUse, available, totalCount, hidd
|
|
|
84
84
|
export declare function useManagedProvider(projectId: string | null): LlmProviderEntry;
|
|
85
85
|
/** Provider ids that hold a usable pooled (account-level) key for this project. */
|
|
86
86
|
export declare function usePooledProviderIds(projectId: string, enabled: boolean): {
|
|
87
|
-
pooledSecretsEnabled: boolean;
|
|
88
87
|
accountId: string | undefined;
|
|
89
88
|
pooledProviderIds: Set<string | null>;
|
|
90
89
|
isLoading: boolean;
|
|
@@ -94,6 +93,7 @@ export declare function usePooledProviderIds(projectId: string, enabled: boolean
|
|
|
94
93
|
};
|
|
95
94
|
export interface ProviderConnectProps {
|
|
96
95
|
projectId: string;
|
|
96
|
+
/** @deprecated Unused: every member sees who the keys added here are shared with. */
|
|
97
97
|
canWrite?: boolean;
|
|
98
98
|
/** Set while this surface is visible; drives the underlying queries. */
|
|
99
99
|
enabled?: boolean;
|
|
@@ -101,4 +101,4 @@ export interface ProviderConnectProps {
|
|
|
101
101
|
onSelect: (providerId: string) => void;
|
|
102
102
|
className?: string;
|
|
103
103
|
}
|
|
104
|
-
export declare function ProviderConnect({ projectId,
|
|
104
|
+
export declare function ProviderConnect({ projectId, enabled, selectedId, onSelect, className, }: ProviderConnectProps): import("react").JSX.Element;
|
|
@@ -35,8 +35,9 @@ import { LLM_PROVIDERS } from '../../internal/lib/llm-providers.js';
|
|
|
35
35
|
import { cn } from '../../internal/lib/utils.js';
|
|
36
36
|
import { PLATFORM_FEE_PERCENT } from '../../internal/billing/compute-pricing.js';
|
|
37
37
|
import { FIRST_CLASS_PROVIDER_IDS, PROVIDER_SUBSCRIPTIONS, getProjectDetail, providerConnectMethod, providerConnectedVia, } from '@kortix/sdk';
|
|
38
|
-
import { qk, useAccountSecretResources,
|
|
38
|
+
import { qk, useAccountSecretResources, useModelAccess, useProjectModelPickerCatalog, } from '@kortix/sdk/react';
|
|
39
39
|
import { useQuery } from '@tanstack/react-query';
|
|
40
|
+
import { useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
|
|
40
41
|
import { SUBSCRIPTION_ROW, SubscriptionRowMeter, summarizeSubscriptions, useLiveSubscriptionUsages, useSubscriptionLogins, useSubscriptionRowSummary, } from '../sections/view/subscription-usage.js';
|
|
41
42
|
export { FIRST_CLASS_PROVIDER_IDS, supportsPooledProviderKey, } from '@kortix/sdk';
|
|
42
43
|
/** Providers whose sheet offers a subscription sign-in beside the API key. */
|
|
@@ -151,24 +152,21 @@ export function useManagedProvider(projectId) {
|
|
|
151
152
|
}
|
|
152
153
|
/** Provider ids that hold a usable pooled (account-level) key for this project. */
|
|
153
154
|
export function usePooledProviderIds(projectId, enabled) {
|
|
154
|
-
const pooledFlag = useFeatureFlag(enabled ? projectId : null, 'pooled_provider_secrets');
|
|
155
|
-
const pooledSecretsEnabled = pooledFlag.enabled;
|
|
156
155
|
const project = useQuery({
|
|
157
156
|
queryKey: qk.project.detail(projectId),
|
|
158
157
|
queryFn: () => getProjectDetail(projectId),
|
|
159
|
-
enabled
|
|
158
|
+
enabled,
|
|
160
159
|
});
|
|
161
160
|
const accountId = project.data?.project?.account_id;
|
|
162
|
-
const pooledResources = useAccountSecretResources(enabled
|
|
161
|
+
const pooledResources = useAccountSecretResources(enabled ? accountId : null, projectId);
|
|
163
162
|
const pooledProviderIds = useMemo(() => new Set((pooledResources.data?.secrets ?? [])
|
|
164
163
|
.filter((secret) => secret.can_use && secret.active)
|
|
165
164
|
.map((secret) => secret.provider_id)), [pooledResources.data]);
|
|
166
165
|
return {
|
|
167
|
-
pooledSecretsEnabled,
|
|
168
166
|
accountId,
|
|
169
167
|
pooledProviderIds,
|
|
170
|
-
isLoading:
|
|
171
|
-
isError:
|
|
168
|
+
isLoading: project.isLoading || pooledResources.isLoading,
|
|
169
|
+
isError: project.isError || pooledResources.isError,
|
|
172
170
|
isFetching: project.isFetching || pooledResources.isFetching,
|
|
173
171
|
refetch: () => {
|
|
174
172
|
void project.refetch();
|
|
@@ -176,18 +174,18 @@ export function usePooledProviderIds(projectId, enabled) {
|
|
|
176
174
|
},
|
|
177
175
|
};
|
|
178
176
|
}
|
|
179
|
-
export function ProviderConnect({ projectId,
|
|
180
|
-
const t = useTranslations('providerSheet');
|
|
177
|
+
export function ProviderConnect({ projectId, enabled = true, selectedId, onSelect, className, }) {
|
|
181
178
|
const common = useTranslations('common');
|
|
182
179
|
const tPooled = useTranslations('pooledSecrets');
|
|
183
180
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
184
181
|
const access = useModelAccess(enabled ? projectId : null);
|
|
185
182
|
const managedProvider = useManagedProvider(enabled ? projectId : null);
|
|
186
183
|
const pooled = usePooledProviderIds(projectId, enabled);
|
|
184
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
187
185
|
useLiveLlmProviderCatalog(projectId, enabled);
|
|
188
186
|
const catalogRevision = useLlmProviderCatalogRevision();
|
|
189
187
|
const { connectedProviders, providerStateLoading } = useConnectedProviders(projectId, enabled);
|
|
190
|
-
const subscriptionAccountId = enabled
|
|
188
|
+
const subscriptionAccountId = enabled ? pooled.accountId : null;
|
|
191
189
|
const subscriptions = useSubscriptionLogins(subscriptionAccountId, projectId);
|
|
192
190
|
const liveUsage = useLiveSubscriptionUsages(subscriptionAccountId, projectId, subscriptions.logins);
|
|
193
191
|
const rowSummary = useSubscriptionRowSummary();
|
|
@@ -258,9 +256,5 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
|
|
|
258
256
|
if (pooled.isError) {
|
|
259
257
|
return (_jsx(ErrorState, { size: "sm", title: tPooled('loadError'), action: _jsx(Button, { size: "sm", variant: "secondary", disabled: pooled.isFetching, onClick: pooled.refetch, children: common('retry') }) }));
|
|
260
258
|
}
|
|
261
|
-
return (_jsx(ProviderConnectView, { inUse: inUse, available: visibleAvailable, totalCount: searchable.length, hiddenCount: available.length - visibleAvailable.length, onLoadMore: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), search: search, onSearchChange: setSearch, selectedId: selectedId, onSelect: onSelect, note:
|
|
262
|
-
? tPooled('sharedDescription')
|
|
263
|
-
: canWrite
|
|
264
|
-
? undefined
|
|
265
|
-
: t('readOnly'), className: className }));
|
|
259
|
+
return (_jsx(ProviderConnectView, { inUse: inUse, available: visibleAvailable, totalCount: searchable.length, hiddenCount: available.length - visibleAvailable.length, onLoadMore: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), search: search, onSearchChange: setSearch, selectedId: selectedId, onSelect: onSelect, note: tPooled(canShare ? 'sharedDescription' : 'sharedOnlyYouDescription'), className: className }));
|
|
266
260
|
}
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
* - **OpenAI and OpenCode Go** — two ways in. With nothing connected the sheet
|
|
15
15
|
* asks which: a subscription sign-in (device code) or an API key. With
|
|
16
16
|
* either connected it lists the connections and offers the other.
|
|
17
|
-
* - **Pooled keys**
|
|
17
|
+
* - **Pooled keys** — the account-level key
|
|
18
18
|
* manager, as before.
|
|
19
19
|
*
|
|
20
20
|
* Saving is a button, not a blur. The old list saved a field when focus left
|
|
@@ -42,7 +42,7 @@ import { ProviderLogoStatus, connectedVia, providerMethod, supportsPooledProvide
|
|
|
42
42
|
import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/llm-provider/chatgpt-subscription-connect.js';
|
|
43
43
|
import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
|
|
44
44
|
import { envVarPlaceholder, formatTokenCount, prettyFieldLabel, providerDisconnectPlan, } from '../sections/llm-provider/utils.js';
|
|
45
|
-
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
45
|
+
import { AccountSecretResourcesPanel, useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
|
|
46
46
|
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
47
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
48
48
|
import { LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
@@ -266,6 +266,7 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
|
|
|
266
266
|
const access = useModelAccess(enabled ? projectId : null);
|
|
267
267
|
const managed = useManagedProvider(enabled ? projectId : null);
|
|
268
268
|
const pooled = usePooledProviderIds(projectId, enabled);
|
|
269
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
269
270
|
const { connectedProviders } = useConnectedProviders(projectId, enabled);
|
|
270
271
|
const entry = providerId === 'kortix' ? managed : LLM_PROVIDER_BY_ID.get(providerId);
|
|
271
272
|
if (!entry)
|
|
@@ -284,19 +285,23 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
|
|
|
284
285
|
.setEnabled({ target: 'provider', id: entry.id, enabled: next })
|
|
285
286
|
.catch((error) => errorToast(error instanceof Error ? error.message : tAccess('providerError'))) })) : null;
|
|
286
287
|
const models = (_jsxs(_Fragment, { children: [status !== 'none' ? accessRow : null, _jsx(ProviderModelsList, { models: entry.models, connected: status !== 'none' })] }));
|
|
287
|
-
|
|
288
|
+
// A key form writes the named store now (the API files it as a "Workspace
|
|
289
|
+
// key"), so a key saved there counts as this provider's saved key too.
|
|
290
|
+
const bodyProps = {
|
|
291
|
+
projectId, entry, connected: keyConnected || pooled.pooledProviderIds.has(entry.id), canWrite, models,
|
|
292
|
+
};
|
|
288
293
|
let content;
|
|
289
294
|
if (method === 'included') {
|
|
290
295
|
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: entry.hint }), models] }));
|
|
291
296
|
}
|
|
292
|
-
else if (pooled.
|
|
293
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('oauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), models] }));
|
|
297
|
+
else if (pooled.accountId && entry.id === 'openai') {
|
|
298
|
+
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'oauthPrivateDescription' : 'oauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
294
299
|
}
|
|
295
|
-
else if (pooled.
|
|
300
|
+
else if (pooled.accountId && entry.id === 'anthropic') {
|
|
296
301
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
297
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('claudeOauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
302
|
+
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'claudeOauthPrivateDescription' : 'claudeOauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
298
303
|
}
|
|
299
|
-
else if (pooled.
|
|
304
|
+
else if (pooled.accountId && supportsPooledProviderKey(entry)) {
|
|
300
305
|
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }), models] }));
|
|
301
306
|
}
|
|
302
307
|
else if (SUBSCRIPTION_BY_PROVIDER[entry.id]) {
|
|
@@ -92,6 +92,8 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
92
92
|
const managedAvailable = mode.data?.managed_available === true;
|
|
93
93
|
// An older server omits it; the address preview then shows "…".
|
|
94
94
|
const managedDomain = mode.data?.managed_domain || '…';
|
|
95
|
+
// Outside prod the server ends a managed address in `.<env>` (`agent.dev@`).
|
|
96
|
+
const managedSuffix = mode.data?.managed_suffix ?? '';
|
|
95
97
|
const [homeChoice, setHome] = useState(null);
|
|
96
98
|
// Until the user picks, the home follows what the deployment offers.
|
|
97
99
|
const home = managedAvailable ? (homeChoice ?? 'own') : 'own';
|
|
@@ -128,7 +130,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
128
130
|
const domain = domainChoice || ownDomains.find((d) => d.verified)?.domain || ownDomains[0]?.domain || (key ? ADD_DOMAIN : '');
|
|
129
131
|
const selected = home === 'own' ? ownDomains.find((d) => d.domain === domain) : undefined;
|
|
130
132
|
const addressDomain = home === 'managed' ? managedDomain : !domain || domain === ADD_DOMAIN ? '…' : domain;
|
|
131
|
-
const address = `${username || 'agent'}@${addressDomain}`;
|
|
133
|
+
const address = `${username || 'agent'}${home === 'managed' ? managedSuffix : ''}@${addressDomain}`;
|
|
132
134
|
const domainReady = home === 'managed' || (Boolean(domain) && domain !== ADD_DOMAIN && selected?.verified !== false);
|
|
133
135
|
const submit = () => {
|
|
134
136
|
setError(null);
|
|
@@ -155,7 +157,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
155
157
|
sender_policy: policy,
|
|
156
158
|
}, { onSuccess: onConnected, onError: (e) => setError(e.message) });
|
|
157
159
|
};
|
|
158
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "
|
|
160
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "orders", autoComplete: "off", spellCheck: false, className: "min-w-0 flex-1" }), home === 'managed' && managedSuffix ? (_jsx("span", { className: "text-muted-foreground text-sm", children: managedSuffix })) : null, _jsx("span", { className: "text-muted-foreground text-sm", children: "@" }), home === 'managed' ? (_jsx("span", { className: "bg-muted text-foreground flex h-9 min-w-0 flex-1 items-center rounded-md px-3 text-sm", children: _jsx("span", { className: "truncate", children: managedDomain }) })) : (_jsxs(Select, { value: domain, onValueChange: setDomain, children: [_jsx(SelectTrigger, { "aria-label": t('domainLabel'), className: "min-w-0 flex-1", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [ownDomains.map((d) => (_jsx(SelectItem, { value: d.domain, children: _jsxs("span", { className: "flex items-center gap-2", children: [d.domain, d.verified ? null : _jsx(Badge, { variant: "secondary", children: t('domainPending') })] }) }, d.domain))), _jsx(SelectSeparator, {}), _jsx(SelectItem, { value: ADD_DOMAIN, disabled: !key, children: t('domainAdd') })] })] }))] }), _jsxs("p", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx(EnvelopeSimpleIcon, { className: "size-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [displayName.trim() || 'Kortix Agent', " <", address, ">"] })] }), home === 'own' && domain === ADD_DOMAIN ? (_jsx(AddDomain, { projectId: projectId, apiKey: key, onAdded: (result) => {
|
|
159
161
|
setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]);
|
|
160
162
|
setDomain(result.domain.domain);
|
|
161
163
|
} })) : null, home === 'own' && selected && !selected.verified ? (_jsx(DomainRecords, { projectId: projectId, apiKey: key, domain: selected, onChecked: (result) => setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]) })) : null, _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-name", children: t('displayNameLabel') }), _jsx(Input, { id: "email-connect-name", value: displayName, onChange: (e) => setDisplayName(e.target.value), placeholder: "Kortix Agent" })] })] })) : null, _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('sendersTitle') }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t('sendersHint') })] }), _jsxs(RadioGroup, { value: senders, onValueChange: (v) => setSenders(v), children: [viewerEmail ? _jsx(RadioGroupItem, { value: "me", label: t('sendersMe', { email: viewerEmail }) }) : null, teamDomain ? _jsx(RadioGroupItem, { value: "team", label: t('sendersTeam', { domain: teamDomain }) }) : null, _jsx(RadioGroupItem, { value: "custom", label: t('sendersCustom') }), _jsx(RadioGroupItem, { value: "anyone", label: t('sendersAnyone'), description: t('sendersAnyoneHint') })] }), senders === 'custom' ? (_jsx(Textarea, { "aria-label": t('sendersCustom'), value: customList, onChange: (e) => setCustomList(e.target.value), placeholder: t('sendersCustomPlaceholder'), rows: 3, spellCheck: false })) : null] }), _jsxs("section", { className: "space-y-3", children: [_jsx(Button, { type: "button", variant: "text", size: "sm", className: "px-0", onClick: () => setAttachOpen((open) => !open), children: attachOpen ? t('attachClose') : t('attachOpen') }), attachOpen ? (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-email", children: t('attachEmail') }), _jsx(Input, { id: "email-connect-inbox-email", value: inboxEmail, onChange: (e) => setInboxEmail(e.target.value.trim().toLowerCase()), placeholder: "support@example.com", autoComplete: "off", spellCheck: false })] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-id", children: t('attachId') }), _jsx(Input, { id: "email-connect-inbox-id", value: inboxId, onChange: (e) => setInboxId(e.target.value.trim()), autoComplete: "off", spellCheck: false })] }), _jsx("p", { className: "text-muted-foreground text-xs sm:col-span-2", children: t('attachHint') })] })) : null] }), error ? _jsx(BannerAlert, { variant: "destructive", children: _jsx(BannerAlertDescription, { children: error }) }) : null, _jsx("div", { className: "flex justify-end", children: _jsxs(Button, { onClick: submit, disabled: connect.isPending || mode.isLoading || (!attachOpen && !domainReady), children: [connect.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, attachOpen ? t('submitAttach') : t('submitCreate', { address })] }) })] }));
|
|
@@ -16,7 +16,6 @@ export interface EasyConnectConnectionInput {
|
|
|
16
16
|
}
|
|
17
17
|
/** A connector's setup status. The rules live in `@kortix/sdk`. */
|
|
18
18
|
export { connectorSetupStatus, isConnectorAuthChallenge as isAuthChallenge, type ConnectorSetupStatus, } from '@kortix/sdk';
|
|
19
|
-
export declare function connectorConnectionQueryKeys(projectId: string): readonly [readonly ["kx", "project", string, "connectors"], readonly ["connections", string], readonly ["connections-all", string], readonly ["session-scope-catalog", string]];
|
|
20
19
|
export declare function createOnlyConnectorDraft(draft: ConnectorDraftInput): ConnectorDraftInput;
|
|
21
20
|
export declare function connectorSyncErrorForSlug(result: {
|
|
22
21
|
sync?: ConnectorSyncResult;
|