@kortix/ui 0.15.10 → 0.15.11
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 +396 -2
- package/dist/_vendor/shared/app-config.d.ts +6 -30
- package/dist/_vendor/shared/channel-descriptors.d.ts +0 -34
- package/dist/_vendor/shared/channel-header.d.ts +2 -1
- package/dist/_vendor/shared/connector-sections.d.ts +0 -25
- package/dist/_vendor/shared/file-tags.d.ts +2 -1
- package/dist/_vendor/shared/pasted-content.d.ts +0 -4
- package/dist/_vendor/shared/pixel-mark.d.ts +0 -17
- package/dist/_vendor/shared/project-glyphs.d.ts +0 -1
- package/dist/customize/agents/agent-model-view.d.ts +11 -1
- package/dist/customize/agents/agent-model-view.js +12 -1
- package/dist/customize/agents/agent-page.js +19 -6
- package/dist/customize/agents/agent-tabs.d.ts +2 -0
- package/dist/customize/agents/agent-tabs.js +2 -0
- package/dist/customize/connectors/detail/connector-triggers.js +1 -1
- package/dist/customize/connectors/use-agent-access.d.ts +1 -0
- package/dist/customize/sections/component/teams-byo-wizard.js +4 -1
- package/dist/customize/triggers/runtime-triggers.js +13 -2
- package/dist/customize/triggers/schedule/event-trigger-copy.js +1 -1
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +5 -4
- package/dist/customize/triggers/schedule/then-fields.d.ts +5 -1
- package/dist/customize/triggers/schedule/then-fields.js +23 -3
- package/dist/customize/triggers/schedule/trigger-callouts.js +1 -1
- package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +27 -0
- package/dist/customize/triggers/schedule/trigger-composer-logic.js +51 -5
- package/dist/customize/triggers/schedule/trigger-composer.js +19 -13
- package/dist/customize/triggers/schedule/trigger-edit-logic.js +25 -5
- package/dist/customize/triggers/schedule/trigger-filter.d.ts +10 -3
- package/dist/customize/triggers/schedule/trigger-filter.js +7 -6
- package/dist/customize/triggers/schedule/trigger-readonly.js +1 -1
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +1 -1
- package/dist/customize/triggers/schedule/when-event.js +1 -1
- package/dist/customize/triggers/schedule/when-schedule.d.ts +5 -1
- package/dist/customize/triggers/schedule/when-schedule.js +16 -1
- package/dist/customize/triggers/schedule-view.js +4 -2
- package/dist/i18n/en.d.ts +49 -0
- package/dist/i18n/en.js +57 -8
- package/dist/internal/layout/project-settings-nav.d.ts +17 -0
- package/dist/internal/layout/project-settings-nav.js +24 -0
- package/dist/internal/lib/capability-tab-routes.d.ts +8 -0
- package/dist/internal/lib/capability-tab-routes.js +11 -0
- package/dist/internal/stores/composer-prefill-store.d.ts +7 -0
- package/dist/internal/stores/composer-prefill-store.js +1 -0
- package/dist/session/actions/session-label.js +2 -2
- package/dist/session/agents/agent-strip.d.ts +10 -5
- package/dist/session/agents/agent-strip.js +40 -12
- package/dist/session/agents/held-messages.d.ts +6 -2
- package/dist/session/agents/held-messages.js +6 -3
- package/dist/session/composer/ComposerCard.js +4 -1
- package/dist/session/composer/agent-selector.d.ts +2 -0
- package/dist/session/composer/agent-selector.js +5 -0
- package/dist/session/composer/composer-chat-input.d.ts +1 -0
- package/dist/session/composer/composer-logic.d.ts +7 -0
- package/dist/session/composer/composer-logic.js +18 -0
- package/dist/session/composer/composer-reset.d.ts +8 -14
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +3 -3
- package/dist/session/composer/composer.d.ts +7 -0
- package/dist/session/composer/composer.js +17 -3
- package/dist/session/composer/editor/composer-editor.js +6 -4
- package/dist/session/header/session-site-header.d.ts +3 -1
- package/dist/session/header/session-site-header.js +3 -2
- package/dist/session/models/connect-model-step.d.ts +29 -0
- package/dist/session/models/connect-model-step.js +50 -0
- package/dist/session/models/use-workspace-model-gate.d.ts +11 -0
- package/dist/session/models/use-workspace-model-gate.js +62 -0
- package/dist/session/models/workspace-model-gate.d.ts +46 -0
- package/dist/session/models/workspace-model-gate.js +66 -0
- package/dist/session/prompts/session-connect-card.d.ts +63 -0
- package/dist/session/prompts/{session-connect-prompt.js → session-connect-card.js} +53 -42
- package/dist/session/thread/session-chat.js +294 -298
- package/dist/session/thread/transcript.d.ts +2 -1
- package/dist/session/thread/transcript.js +7 -3
- package/dist/session/tool/tool-part-renderer.js +7 -2
- package/dist/session/tool/tools/kortix-action-tool.js +10 -2
- package/dist/session/turn/turn-viewport.d.ts +66 -10
- package/dist/session/turn/turn-viewport.js +92 -12
- package/dist/session/turn/user-message.js +7 -5
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +49 -0
- package/dist/workspace/admin/project-admin-dashboard.js +2 -4
- package/dist/workspace/home/existing-repo-setup-prompt.d.ts +5 -8
- package/dist/workspace/home/existing-repo-setup-prompt.js +16 -42
- package/dist/workspace/home/no-agent-home.d.ts +3 -1
- package/dist/workspace/home/no-agent-home.js +2 -2
- package/dist/workspace/layout/project-home.js +16 -9
- package/dist/workspace/sidebar/session-grouping.d.ts +1 -1
- package/dist/workspace/sidebar/session-grouping.js +1 -1
- package/dist/workspace/spaces/space-details-panel.js +2 -2
- package/dist/workspace/spaces/space-triggers.js +2 -2
- package/dist/workspace/spaces/space-view.js +11 -5
- package/package.json +15 -3
- package/dist/session/prompts/session-connect-prompt.d.ts +0 -40
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace model gate: a workspace opens only when the viewer can run at
|
|
3
|
+
* least one model. Without one, every workspace page shows the "Connect a
|
|
4
|
+
* model" step instead (`apps/web` `ConnectModelScreen`).
|
|
5
|
+
*
|
|
6
|
+
* "Can run a model" is the composer's own test (`isRunnableModel`) over the
|
|
7
|
+
* server-resolved `/model-picker` list. That list already applies the plan
|
|
8
|
+
* (a Free account sees no Kortix model), the viewer's own Claude login, the
|
|
9
|
+
* project's ChatGPT login and keys, and the model switches. So a Credits or
|
|
10
|
+
* Enterprise workspace opens on Kortix models, and a Free workspace opens once
|
|
11
|
+
* a ChatGPT plan, a Claude plan or an API key is connected.
|
|
12
|
+
*
|
|
13
|
+
* Pure and framework-free: the hook (`use-workspace-model-gate.ts`) feeds it.
|
|
14
|
+
*/
|
|
15
|
+
export type WorkspaceModelGateView = 'open' | 'pending' | 'blocked';
|
|
16
|
+
export interface WorkspaceModelGateInput {
|
|
17
|
+
/** False turns the gate off: no project yet, or the project runs program agents. */
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/** The flattened `/model-picker` list, or `undefined` while no answer is in. */
|
|
20
|
+
models: ReadonlyArray<{
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
available?: boolean;
|
|
23
|
+
}> | undefined;
|
|
24
|
+
/** The `/model-picker` read failed and holds no answer. */
|
|
25
|
+
failed: boolean;
|
|
26
|
+
/** This browser saw a runnable model in this workspace for this viewer before. */
|
|
27
|
+
rememberedReady: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* - A settled answer decides: one runnable model opens the workspace, none
|
|
31
|
+
* blocks it.
|
|
32
|
+
* - A failed read opens the workspace. The server still refuses a session with
|
|
33
|
+
* no model (`no_model_available`), so an outage of `/model-picker` must not
|
|
34
|
+
* lock every workspace.
|
|
35
|
+
* - No answer yet: a workspace this browser saw ready opens at once (no wait
|
|
36
|
+
* on every load); any other waits, so a blocked workspace never flashes.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveWorkspaceModelGate(input: WorkspaceModelGateInput): WorkspaceModelGateView;
|
|
39
|
+
/**
|
|
40
|
+
* Whether this browser saw a runnable model for this viewer in this workspace.
|
|
41
|
+
* A per-viewer hint that only skips the wait; the server answer always wins.
|
|
42
|
+
* False when storage is blocked (private mode, a preview frame).
|
|
43
|
+
*/
|
|
44
|
+
export declare function readModelReady(viewerId: string | null | undefined, projectId: string): boolean;
|
|
45
|
+
/** Record the server's answer, so the next load of this workspace waits only when it was blocked. */
|
|
46
|
+
export declare function writeModelReady(viewerId: string | null | undefined, projectId: string, ready: boolean): void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace model gate: a workspace opens only when the viewer can run at
|
|
3
|
+
* least one model. Without one, every workspace page shows the "Connect a
|
|
4
|
+
* model" step instead (`apps/web` `ConnectModelScreen`).
|
|
5
|
+
*
|
|
6
|
+
* "Can run a model" is the composer's own test (`isRunnableModel`) over the
|
|
7
|
+
* server-resolved `/model-picker` list. That list already applies the plan
|
|
8
|
+
* (a Free account sees no Kortix model), the viewer's own Claude login, the
|
|
9
|
+
* project's ChatGPT login and keys, and the model switches. So a Credits or
|
|
10
|
+
* Enterprise workspace opens on Kortix models, and a Free workspace opens once
|
|
11
|
+
* a ChatGPT plan, a Claude plan or an API key is connected.
|
|
12
|
+
*
|
|
13
|
+
* Pure and framework-free: the hook (`use-workspace-model-gate.ts`) feeds it.
|
|
14
|
+
*/
|
|
15
|
+
import { isRunnableModel } from './model-availability.js';
|
|
16
|
+
/**
|
|
17
|
+
* - A settled answer decides: one runnable model opens the workspace, none
|
|
18
|
+
* blocks it.
|
|
19
|
+
* - A failed read opens the workspace. The server still refuses a session with
|
|
20
|
+
* no model (`no_model_available`), so an outage of `/model-picker` must not
|
|
21
|
+
* lock every workspace.
|
|
22
|
+
* - No answer yet: a workspace this browser saw ready opens at once (no wait
|
|
23
|
+
* on every load); any other waits, so a blocked workspace never flashes.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveWorkspaceModelGate(input) {
|
|
26
|
+
if (!input.enabled)
|
|
27
|
+
return 'open';
|
|
28
|
+
if (input.models)
|
|
29
|
+
return input.models.some(isRunnableModel) ? 'open' : 'blocked';
|
|
30
|
+
if (input.failed)
|
|
31
|
+
return 'open';
|
|
32
|
+
return input.rememberedReady ? 'open' : 'pending';
|
|
33
|
+
}
|
|
34
|
+
const READY_KEY_PREFIX = 'kortix:model-ready:';
|
|
35
|
+
function readyKey(viewerId, projectId) {
|
|
36
|
+
return `${READY_KEY_PREFIX}${viewerId}:${projectId}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether this browser saw a runnable model for this viewer in this workspace.
|
|
40
|
+
* A per-viewer hint that only skips the wait; the server answer always wins.
|
|
41
|
+
* False when storage is blocked (private mode, a preview frame).
|
|
42
|
+
*/
|
|
43
|
+
export function readModelReady(viewerId, projectId) {
|
|
44
|
+
if (!viewerId || !projectId || typeof window === 'undefined')
|
|
45
|
+
return false;
|
|
46
|
+
try {
|
|
47
|
+
return window.localStorage.getItem(readyKey(viewerId, projectId)) === '1';
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Record the server's answer, so the next load of this workspace waits only when it was blocked. */
|
|
54
|
+
export function writeModelReady(viewerId, projectId, ready) {
|
|
55
|
+
if (!viewerId || !projectId || typeof window === 'undefined')
|
|
56
|
+
return;
|
|
57
|
+
try {
|
|
58
|
+
if (ready)
|
|
59
|
+
window.localStorage.setItem(readyKey(viewerId, projectId), '1');
|
|
60
|
+
else
|
|
61
|
+
window.localStorage.removeItem(readyKey(viewerId, projectId));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Storage blocked: every load waits for the answer, which is still correct.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Connect card of a connector sign-in the agent started, drawn in the
|
|
3
|
+
* transcript under the call that started it: `kortix connectors connect <app>`
|
|
4
|
+
* in the shell, or the `kortix_connectors` tool's `connect` (the SDK reads
|
|
5
|
+
* both, `connectorSignInCalls`). The SDK keeps that call out of every fold, so
|
|
6
|
+
* the card stays in view the way a pasted `/connect/<token>` link did.
|
|
7
|
+
*
|
|
8
|
+
* #12500 (2026-11-12) docked this card above the composer. A sign-in the
|
|
9
|
+
* person never finished stayed docked for the life of the session: a person
|
|
10
|
+
* who connected the app another way (the native Supabase connector instead of
|
|
11
|
+
* the Composio toolkit the agent picked) kept the card over the input, with
|
|
12
|
+
* nothing to dismiss it (2026-11-13). In the transcript it stays where the
|
|
13
|
+
* agent asked, scrolls away with its turn, and reads "Connected as …" once done.
|
|
14
|
+
*
|
|
15
|
+
* The API records which session asked on the account row
|
|
16
|
+
* (`requesting_session_id`). `SessionConnectRequestsProvider` reads those rows
|
|
17
|
+
* once per session (`listSessionConnectRequests`); each card picks the ones its
|
|
18
|
+
* call names (`connectorSignInRequests`) and finishes each through
|
|
19
|
+
* `connectionSignInSteps`: the window opens inside the click, the first request
|
|
20
|
+
* records a sign-in that already finished at the provider, and only an
|
|
21
|
+
* unfinished one goes to a new sign-in page. Finalize tells the session that
|
|
22
|
+
* asked, so the agent continues on its own.
|
|
23
|
+
*/
|
|
24
|
+
import { type ConnectorSignInCall, type SessionConnectRequest } from '@kortix/sdk';
|
|
25
|
+
import { type ReactNode } from 'react';
|
|
26
|
+
/** Stable id of one request: its account row, or the connector on an older server. */
|
|
27
|
+
export declare function sessionConnectRequestKey(request: SessionConnectRequest): string;
|
|
28
|
+
interface SessionConnectRequests {
|
|
29
|
+
projectId: string;
|
|
30
|
+
requests: readonly SessionConnectRequest[];
|
|
31
|
+
refetch: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The session's connect requests, read once for every card in its transcript.
|
|
35
|
+
* Without a project and session (a read-only view) it provides nothing, and no
|
|
36
|
+
* call draws a card.
|
|
37
|
+
*/
|
|
38
|
+
export declare function SessionConnectRequestsProvider({ projectId, sessionId, busy, children, }: {
|
|
39
|
+
projectId: string | null | undefined;
|
|
40
|
+
sessionId: string | null | undefined;
|
|
41
|
+
/** The agent is running: poll faster, and read again when it stops. */
|
|
42
|
+
busy: boolean;
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}): import("react").JSX.Element;
|
|
45
|
+
/** The session's connect requests, or null outside a session that can finish them. */
|
|
46
|
+
export declare function useSessionConnectRequests(): SessionConnectRequests | null;
|
|
47
|
+
/**
|
|
48
|
+
* The Connect card under a call that started connector sign-ins: one row per
|
|
49
|
+
* request the call names. Nothing when the session holds no such request
|
|
50
|
+
* (another member's private sign-in, an account removed since).
|
|
51
|
+
*/
|
|
52
|
+
export declare function SessionConnectCard({ calls, className, }: {
|
|
53
|
+
calls: readonly ConnectorSignInCall[];
|
|
54
|
+
className?: string;
|
|
55
|
+
}): import("react").JSX.Element | null;
|
|
56
|
+
/** The card itself: a headline, then one row per request. */
|
|
57
|
+
export declare function SessionConnectNotice({ requests, projectId, onSettled, className, }: {
|
|
58
|
+
requests: readonly SessionConnectRequest[];
|
|
59
|
+
projectId: string;
|
|
60
|
+
onSettled: () => void;
|
|
61
|
+
className?: string;
|
|
62
|
+
}): import("react").JSX.Element;
|
|
63
|
+
export {};
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
4
|
+
* The Connect card of a connector sign-in the agent started, drawn in the
|
|
5
|
+
* transcript under the call that started it: `kortix connectors connect <app>`
|
|
6
|
+
* in the shell, or the `kortix_connectors` tool's `connect` (the SDK reads
|
|
7
|
+
* both, `connectorSignInCalls`). The SDK keeps that call out of every fold, so
|
|
8
|
+
* the card stays in view the way a pasted `/connect/<token>` link did.
|
|
6
9
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* #12500 (2026-11-12) docked this card above the composer. A sign-in the
|
|
11
|
+
* person never finished stayed docked for the life of the session: a person
|
|
12
|
+
* who connected the app another way (the native Supabase connector instead of
|
|
13
|
+
* the Composio toolkit the agent picked) kept the card over the input, with
|
|
14
|
+
* nothing to dismiss it (2026-11-13). In the transcript it stays where the
|
|
15
|
+
* agent asked, scrolls away with its turn, and reads "Connected as …" once done.
|
|
16
|
+
*
|
|
17
|
+
* The API records which session asked on the account row
|
|
18
|
+
* (`requesting_session_id`). `SessionConnectRequestsProvider` reads those rows
|
|
19
|
+
* once per session (`listSessionConnectRequests`); each card picks the ones its
|
|
20
|
+
* call names (`connectorSignInRequests`) and finishes each through
|
|
12
21
|
* `connectionSignInSteps`: the window opens inside the click, the first request
|
|
13
22
|
* records a sign-in that already finished at the provider, and only an
|
|
14
23
|
* unfinished one goes to a new sign-in page. Finalize tells the session that
|
|
15
24
|
* asked, so the agent continues on its own.
|
|
16
|
-
*
|
|
17
|
-
* Shown: every request still to sign in, and each one that connected while
|
|
18
|
-
* this page was open ("Connected as …"). A request that was connected before
|
|
19
|
-
* the page loaded is history and stays hidden.
|
|
20
25
|
*/
|
|
21
|
-
import { connectionSignInSteps, listSessionConnectRequests, } from '@kortix/sdk';
|
|
26
|
+
import { connectionSignInSteps, connectorSignInRequests, listSessionConnectRequests, } from '@kortix/sdk';
|
|
22
27
|
import { CheckIcon, PlugsConnectedIcon } from '@phosphor-icons/react';
|
|
23
28
|
import { useQuery } from '@tanstack/react-query';
|
|
24
|
-
import { useEffect, useRef, useState } from 'react';
|
|
29
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
25
30
|
import { useTranslations } from '../../i18n/index.js';
|
|
26
31
|
import { cn } from '../../lib/utils.js';
|
|
27
32
|
import { runConnectLinkFlow } from '../../internal/hooks/connectors/use-connect-link.js';
|
|
@@ -33,23 +38,23 @@ import { errorToast } from '../../primitives/toast.js';
|
|
|
33
38
|
const BUSY_POLL_MS = 8_000;
|
|
34
39
|
/** A card whose sign-in the person may finish in another tab. */
|
|
35
40
|
const PENDING_POLL_MS = 10_000;
|
|
41
|
+
const NO_REQUESTS = Object.freeze([]);
|
|
36
42
|
/** Stable id of one request: its account row, or the connector on an older server. */
|
|
37
43
|
export function sessionConnectRequestKey(request) {
|
|
38
44
|
return request.connection_id ?? request.slug;
|
|
39
45
|
}
|
|
46
|
+
const SessionConnectRequestsContext = createContext(null);
|
|
40
47
|
/**
|
|
41
|
-
* The
|
|
42
|
-
*
|
|
48
|
+
* The session's connect requests, read once for every card in its transcript.
|
|
49
|
+
* Without a project and session (a read-only view) it provides nothing, and no
|
|
50
|
+
* call draws a card.
|
|
43
51
|
*/
|
|
44
|
-
export function
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
export function SessionConnectPrompt({ projectId, sessionId, busy, onDockedChange, }) {
|
|
48
|
-
const seenPending = useRef(new Set());
|
|
52
|
+
export function SessionConnectRequestsProvider({ projectId, sessionId, busy, children, }) {
|
|
53
|
+
const enabled = Boolean(projectId && sessionId);
|
|
49
54
|
const query = useQuery({
|
|
50
55
|
queryKey: ['session-connect-requests', projectId, sessionId],
|
|
51
56
|
queryFn: () => listSessionConnectRequests(projectId, sessionId),
|
|
52
|
-
enabled
|
|
57
|
+
enabled,
|
|
53
58
|
staleTime: 2_000,
|
|
54
59
|
retry: false,
|
|
55
60
|
refetchOnWindowFocus: true,
|
|
@@ -59,36 +64,42 @@ export function SessionConnectPrompt({ projectId, sessionId, busy, onDockedChang
|
|
|
59
64
|
? PENDING_POLL_MS
|
|
60
65
|
: false,
|
|
61
66
|
});
|
|
62
|
-
const { refetch } = query;
|
|
67
|
+
const { refetch, data } = query;
|
|
63
68
|
// The agent stops right after it starts a sign-in: read once more then.
|
|
64
69
|
const wasBusy = useRef(busy);
|
|
65
70
|
useEffect(() => {
|
|
66
|
-
if (wasBusy.current && !busy)
|
|
71
|
+
if (enabled && wasBusy.current && !busy)
|
|
67
72
|
void refetch();
|
|
68
73
|
wasBusy.current = busy;
|
|
69
|
-
}, [busy, refetch]);
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
}, [busy, enabled, refetch]);
|
|
75
|
+
const value = useMemo(() => enabled && projectId
|
|
76
|
+
? { projectId, requests: data ?? NO_REQUESTS, refetch: () => void refetch() }
|
|
77
|
+
: null, [enabled, projectId, data, refetch]);
|
|
78
|
+
return _jsx(SessionConnectRequestsContext.Provider, { value: value, children: children });
|
|
79
|
+
}
|
|
80
|
+
/** The session's connect requests, or null outside a session that can finish them. */
|
|
81
|
+
export function useSessionConnectRequests() {
|
|
82
|
+
return useContext(SessionConnectRequestsContext);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The Connect card under a call that started connector sign-ins: one row per
|
|
86
|
+
* request the call names. Nothing when the session holds no such request
|
|
87
|
+
* (another member's private sign-in, an account removed since).
|
|
88
|
+
*/
|
|
89
|
+
export function SessionConnectCard({ calls, className, }) {
|
|
90
|
+
const context = useSessionConnectRequests();
|
|
91
|
+
if (!context || calls.length === 0)
|
|
92
|
+
return null;
|
|
93
|
+
const requests = connectorSignInRequests(context.requests, calls);
|
|
94
|
+
if (requests.length === 0)
|
|
82
95
|
return null;
|
|
83
|
-
return (_jsx(SessionConnectNotice, { requests:
|
|
96
|
+
return (_jsx(SessionConnectNotice, { requests: requests, projectId: context.projectId, onSettled: context.refetch, className: className }));
|
|
84
97
|
}
|
|
85
|
-
/** The card itself: one row per request. */
|
|
86
|
-
export function SessionConnectNotice({ requests, projectId, onSettled, }) {
|
|
98
|
+
/** The card itself: a headline, then one row per request. */
|
|
99
|
+
export function SessionConnectNotice({ requests, projectId, onSettled, className, }) {
|
|
87
100
|
const t = useTranslations('connectSignIn');
|
|
88
101
|
const allConnected = requests.every((request) => request.connected);
|
|
89
|
-
return (
|
|
90
|
-
// `w-full`, or the composer's `items-center` strip shrinks this to its content width.
|
|
91
|
-
_jsxs("div", { className: "relative isolate z-10 w-full", "data-testid": "session-connect-prompt", children: [_jsxs("div", { className: "text-muted-foreground flex min-h-6 items-center gap-1.5 px-3 py-1 text-xs", children: [_jsx(PlugsConnectedIcon, { className: cn('size-3.5 shrink-0', allConnected ? 'text-kortix-green' : 'text-kortix-orange') }), _jsx("span", { className: "min-w-0 truncate", children: allConnected ? t('signInFinished') : t('cardHeadline') })] }), _jsx("ul", { className: "flex flex-col gap-1 px-3 pt-0.5 pb-2.5", children: requests.map((request) => (_jsx(SessionConnectRow, { request: request, projectId: projectId, onSettled: onSettled }, sessionConnectRequestKey(request)))) })] }));
|
|
102
|
+
return (_jsxs("div", { className: cn('w-full', className), "data-testid": "session-connect-card", children: [_jsxs("div", { className: "text-muted-foreground flex min-h-6 items-center gap-1.5 py-1 text-xs", children: [_jsx(PlugsConnectedIcon, { className: cn('size-3.5 shrink-0', allConnected ? 'text-kortix-green' : 'text-kortix-orange') }), _jsx("span", { className: "min-w-0 truncate", children: allConnected ? t('signInFinished') : t('cardHeadline') })] }), _jsx("ul", { className: "flex flex-col gap-1 pt-0.5", children: requests.map((request) => (_jsx(SessionConnectRow, { request: request, projectId: projectId, onSettled: onSettled }, sessionConnectRequestKey(request)))) })] }));
|
|
92
103
|
}
|
|
93
104
|
function SessionConnectRow({ request, projectId, onSettled, }) {
|
|
94
105
|
const t = useTranslations('connectSignIn');
|