@stigmer/react 3.12.2 → 3.12.3
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/access/ManageAccessDialog.d.ts.map +1 -1
- package/access/ManageAccessDialog.js +3 -19
- package/access/ManageAccessDialog.js.map +1 -1
- package/agent-instance/CreateAgentInstanceDialog.d.ts.map +1 -1
- package/agent-instance/CreateAgentInstanceDialog.js +7 -20
- package/agent-instance/CreateAgentInstanceDialog.js.map +1 -1
- package/attachment/AttachmentImageLightbox.d.ts.map +1 -1
- package/attachment/AttachmentImageLightbox.js +8 -23
- package/attachment/AttachmentImageLightbox.js.map +1 -1
- package/channel/ChannelConversationsDialog.d.ts.map +1 -1
- package/channel/ChannelConversationsDialog.js +3 -19
- package/channel/ChannelConversationsDialog.js.map +1 -1
- package/channel/ChannelCredentialsDialog.d.ts.map +1 -1
- package/channel/ChannelCredentialsDialog.js +3 -19
- package/channel/ChannelCredentialsDialog.js.map +1 -1
- package/channel/ChannelTemplatesDialog.d.ts.map +1 -1
- package/channel/ChannelTemplatesDialog.js +4 -20
- package/channel/ChannelTemplatesDialog.js.map +1 -1
- package/channel/ConnectSlackDialog.d.ts.map +1 -1
- package/channel/ConnectSlackDialog.js +3 -21
- package/channel/ConnectSlackDialog.js.map +1 -1
- package/channel/ConnectWhatsAppDialog.d.ts.map +1 -1
- package/channel/ConnectWhatsAppDialog.js +3 -21
- package/channel/ConnectWhatsAppDialog.js.map +1 -1
- package/conversation/ConversationAttentionBanner.d.ts +23 -6
- package/conversation/ConversationAttentionBanner.d.ts.map +1 -1
- package/conversation/ConversationAttentionBanner.js +25 -10
- package/conversation/ConversationAttentionBanner.js.map +1 -1
- package/conversation/ConversationListPane.d.ts.map +1 -1
- package/conversation/ConversationListPane.js +25 -6
- package/conversation/ConversationListPane.js.map +1 -1
- package/conversation/ConversationsWorkbench.d.ts.map +1 -1
- package/conversation/ConversationsWorkbench.js +1 -1
- package/conversation/ConversationsWorkbench.js.map +1 -1
- package/execution/ApprovalCard.d.ts.map +1 -1
- package/execution/ApprovalCard.js +13 -3
- package/execution/ApprovalCard.js.map +1 -1
- package/execution/ArtifactPreviewModal.d.ts.map +1 -1
- package/execution/ArtifactPreviewModal.js +11 -17
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/ToolCallItem.d.ts +3 -1
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +19 -7
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/index.d.ts +1 -1
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +1 -1
- package/execution/index.js.map +1 -1
- package/execution/tool-categories.d.ts +51 -0
- package/execution/tool-categories.d.ts.map +1 -1
- package/execution/tool-categories.js +103 -1
- package/execution/tool-categories.js.map +1 -1
- package/execution/tool-presenter.d.ts +15 -0
- package/execution/tool-presenter.d.ts.map +1 -1
- package/execution/tool-presenter.js +7 -2
- package/execution/tool-presenter.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/internal/DialogShell.d.ts +77 -0
- package/internal/DialogShell.d.ts.map +1 -0
- package/internal/DialogShell.js +77 -0
- package/internal/DialogShell.js.map +1 -0
- package/manifest/ApplyManifestDialog.d.ts.map +1 -1
- package/manifest/ApplyManifestDialog.js +7 -17
- package/manifest/ApplyManifestDialog.js.map +1 -1
- package/manifest/EditResourceYamlDialog.d.ts.map +1 -1
- package/manifest/EditResourceYamlDialog.js +3 -19
- package/manifest/EditResourceYamlDialog.js.map +1 -1
- package/mcp-server/McpServerConnectDialog.d.ts.map +1 -1
- package/mcp-server/McpServerConnectDialog.js +8 -20
- package/mcp-server/McpServerConnectDialog.js.map +1 -1
- package/mcp-server/McpServerDetailView.d.ts.map +1 -1
- package/mcp-server/McpServerDetailView.js +4 -15
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/package.json +4 -4
- package/resource-detail/ConfirmDialog.d.ts +2 -3
- package/resource-detail/ConfirmDialog.d.ts.map +1 -1
- package/resource-detail/ConfirmDialog.js +8 -20
- package/resource-detail/ConfirmDialog.js.map +1 -1
- package/sharing/ShareAgentDialog.d.ts.map +1 -1
- package/sharing/ShareAgentDialog.js +2 -20
- package/sharing/ShareAgentDialog.js.map +1 -1
- package/skill/SkillDiffDialog.d.ts.map +1 -1
- package/skill/SkillDiffDialog.js +5 -21
- package/skill/SkillDiffDialog.js.map +1 -1
- package/src/access/ManageAccessDialog.tsx +7 -27
- package/src/agent-instance/CreateAgentInstanceDialog.tsx +14 -27
- package/src/attachment/AttachmentImageLightbox.tsx +13 -36
- package/src/channel/ChannelConversationsDialog.tsx +8 -27
- package/src/channel/ChannelCredentialsDialog.tsx +8 -28
- package/src/channel/ChannelTemplatesDialog.tsx +10 -29
- package/src/channel/ConnectSlackDialog.tsx +8 -30
- package/src/channel/ConnectWhatsAppDialog.tsx +8 -30
- package/src/conversation/ConversationAttentionBanner.tsx +64 -19
- package/src/conversation/ConversationListPane.tsx +42 -17
- package/src/conversation/ConversationsWorkbench.tsx +1 -0
- package/src/conversation/__tests__/ConversationAttentionBanner.test.tsx +76 -2
- package/src/conversation/__tests__/ConversationListPane.test.tsx +15 -4
- package/src/execution/ApprovalCard.tsx +23 -2
- package/src/execution/ArtifactPreviewModal.tsx +15 -27
- package/src/execution/ToolCallItem.tsx +19 -8
- package/src/execution/__tests__/intent-title.test.tsx +221 -0
- package/src/execution/index.ts +3 -0
- package/src/execution/tool-categories.ts +123 -1
- package/src/execution/tool-presenter.ts +22 -1
- package/src/index.ts +3 -0
- package/src/internal/DialogShell.tsx +169 -0
- package/src/internal/__tests__/DialogShell.test.tsx +223 -0
- package/src/manifest/ApplyManifestDialog.tsx +8 -26
- package/src/manifest/EditResourceYamlDialog.tsx +4 -31
- package/src/mcp-server/McpServerConnectDialog.tsx +15 -29
- package/src/mcp-server/McpServerDetailView.tsx +12 -24
- package/src/resource-detail/ConfirmDialog.tsx +9 -30
- package/src/sharing/ShareAgentDialog.tsx +7 -29
- package/src/skill/SkillDiffDialog.tsx +13 -36
- package/src/workflow/ViewYamlDialog.tsx +18 -37
- package/src/workflow/WorkflowArchitectDialog.tsx +11 -43
- package/src/workflow/WorkflowExplainDialog.tsx +11 -37
- package/src/workflow/WorkflowGraphFullscreenDialog.tsx +14 -26
- package/src/workflow/WorkflowRunDialog.tsx +21 -48
- package/src/workflow/execution-comparison/ExecutionComparisonPicker.tsx +14 -31
- package/src/workflow/instance/CreateWorkflowInstanceDialog.tsx +14 -27
- package/src/workflow/templates/WorkflowTemplatePreview.tsx +18 -28
- package/styles.css +1 -1
- package/workflow/ViewYamlDialog.d.ts.map +1 -1
- package/workflow/ViewYamlDialog.js +10 -29
- package/workflow/ViewYamlDialog.js.map +1 -1
- package/workflow/WorkflowArchitectDialog.d.ts.map +1 -1
- package/workflow/WorkflowArchitectDialog.js +5 -24
- package/workflow/WorkflowArchitectDialog.js.map +1 -1
- package/workflow/WorkflowExplainDialog.d.ts.map +1 -1
- package/workflow/WorkflowExplainDialog.js +5 -21
- package/workflow/WorkflowExplainDialog.js.map +1 -1
- package/workflow/WorkflowGraphFullscreenDialog.d.ts.map +1 -1
- package/workflow/WorkflowGraphFullscreenDialog.js +11 -17
- package/workflow/WorkflowGraphFullscreenDialog.js.map +1 -1
- package/workflow/WorkflowRunDialog.d.ts.map +1 -1
- package/workflow/WorkflowRunDialog.js +13 -29
- package/workflow/WorkflowRunDialog.js.map +1 -1
- package/workflow/execution-comparison/ExecutionComparisonPicker.d.ts.map +1 -1
- package/workflow/execution-comparison/ExecutionComparisonPicker.js +8 -26
- package/workflow/execution-comparison/ExecutionComparisonPicker.js.map +1 -1
- package/workflow/instance/CreateWorkflowInstanceDialog.d.ts.map +1 -1
- package/workflow/instance/CreateWorkflowInstanceDialog.js +7 -20
- package/workflow/instance/CreateWorkflowInstanceDialog.js.map +1 -1
- package/workflow/templates/WorkflowTemplatePreview.d.ts +1 -1
- package/workflow/templates/WorkflowTemplatePreview.d.ts.map +1 -1
- package/workflow/templates/WorkflowTemplatePreview.js +10 -22
- package/workflow/templates/WorkflowTemplatePreview.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageAccessDialog.d.ts","sourceRoot":"","sources":["../../src/access/ManageAccessDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManageAccessDialog.d.ts","sourceRoot":"","sources":["../../src/access/ManageAccessDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,YAAY,GACb,EAAE,uBAAuB,2CAgHzB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId
|
|
3
|
+
import { useCallback, useId } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
5
6
|
import { hasGrantableRoles } from "@stigmer/sdk";
|
|
6
7
|
import { PeopleWithAccess } from "../iam-policy/PeopleWithAccess.js";
|
|
7
8
|
import { ResourceVisibilityControl } from "../library/ResourceVisibilityControl.js";
|
|
@@ -44,33 +45,16 @@ import { ResourceVisibilityControl } from "../library/ResourceVisibilityControl.
|
|
|
44
45
|
* ```
|
|
45
46
|
*/
|
|
46
47
|
export function ManageAccessDialog({ open, onOpenChange, resource, visibility, extraSection, }) {
|
|
47
|
-
const dialogRef = useRef(null);
|
|
48
48
|
// Instance-scoped title id (oss#593): a reusable component must not
|
|
49
49
|
// hardcode DOM ids — hosts legitimately mount this dialog more than once
|
|
50
50
|
// per page (e.g. zone-cached detail pages), and duplicate ids break the
|
|
51
51
|
// aria-labelledby association for every copy after the first.
|
|
52
52
|
const titleId = useId();
|
|
53
53
|
const handleClose = useCallback(() => {
|
|
54
|
-
dialogRef.current?.close();
|
|
55
54
|
onOpenChange(false);
|
|
56
55
|
}, [onOpenChange]);
|
|
57
|
-
// Sync native dialog open state (matches the SDK dialog convention).
|
|
58
|
-
const prevOpenRef = useRef(false);
|
|
59
|
-
if (open !== prevOpenRef.current) {
|
|
60
|
-
prevOpenRef.current = open;
|
|
61
|
-
if (open) {
|
|
62
|
-
requestAnimationFrame(() => {
|
|
63
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
64
|
-
dialogRef.current.showModal();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else if (dialogRef.current?.open) {
|
|
69
|
-
dialogRef.current.close();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
56
|
const showPeople = hasGrantableRoles(resource.kind);
|
|
73
|
-
return (_jsx(
|
|
57
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: onOpenChange, width: "md", "aria-labelledby": titleId, children: open && (_jsxs("div", { className: "stg:flex stg:flex-col", children: [_jsxs("div", { className: "stg:flex stg:items-start stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4", children: [_jsxs("div", { className: "stg:min-w-0", children: [_jsx("h2", { id: titleId, className: "stg:text-base stg:font-semibold stg:text-foreground", children: "Manage access" }), resource.name && (_jsx("p", { className: "stg:mt-0.5 stg:truncate stg:text-xs stg:text-muted-foreground", children: resource.name }))] }), _jsx("button", { type: "button", onClick: handleClose, "aria-label": "Close", className: cn("stg:rounded-md stg:p-1 stg:text-muted-foreground", "stg:hover:text-foreground stg:hover:bg-accent-hover", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"), children: _jsx(CloseIcon, {}) })] }), _jsxs("div", { className: "stg:flex stg:flex-col stg:divide-y stg:divide-border", children: [visibility && (_jsx(AccessSection, { title: "General access", description: "Who can find and open this resource.", children: _jsx(ResourceVisibilityControl, { kind: visibility.kind, resourceId: resource.id, visibility: visibility.current, org: visibility.org, onChanged: visibility.onChanged }) })), showPeople && (_jsx(AccessSection, { title: "People with access", children: _jsx(PeopleWithAccess, { resource: {
|
|
74
58
|
kind: resource.kindString,
|
|
75
59
|
id: resource.id,
|
|
76
60
|
resourceKind: resource.kind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageAccessDialog.js","sourceRoot":"","sources":["../../src/access/ManageAccessDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"ManageAccessDialog.js","sourceRoot":"","sources":["../../src/access/ManageAccessDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AA2BpF;;;;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AAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,iBAAa,MAAM,YAC5E,eAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,KAAK,EAAC,aAAa,EAAC,OAAO,GAAG,GACzF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAgentInstanceDialog.d.ts","sourceRoot":"","sources":["../../src/agent-instance/CreateAgentInstanceDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateAgentInstanceDialog.d.ts","sourceRoot":"","sources":["../../src/agent-instance/CreateAgentInstanceDialog.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAOhG,mDAAmD;AACnD,MAAM,WAAW,8BAA8B;IAC7C,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;CACxD;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,IAAI,EACJ,YAAY,EACZ,GAAG,EACH,OAAO,EACP,SAAS,GACV,EAAE,8BAA8B,2CA6MhC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId,
|
|
3
|
+
import { useCallback, useId, useState } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
5
6
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
6
7
|
import { getUserMessage } from "@stigmer/sdk";
|
|
7
8
|
import { useCreateAgentInstance } from "./useCreateAgentInstance.js";
|
|
@@ -16,7 +17,6 @@ import { InstanceVisibilitySelector } from "../library/InstanceVisibilitySelecto
|
|
|
16
17
|
* Uses native `<dialog>` element for proper focus trapping and escape handling.
|
|
17
18
|
*/
|
|
18
19
|
export function CreateAgentInstanceDialog({ open, onOpenChange, org, agentId, onCreated, }) {
|
|
19
|
-
const dialogRef = useRef(null);
|
|
20
20
|
const { create, isCreating, error, clearError } = useCreateAgentInstance();
|
|
21
21
|
// Instance-scoped element ids (oss#593): a reusable component must not
|
|
22
22
|
// hardcode DOM ids — hosts legitimately mount this dialog more than once
|
|
@@ -38,10 +38,13 @@ export function CreateAgentInstanceDialog({ open, onOpenChange, org, agentId, on
|
|
|
38
38
|
clearError();
|
|
39
39
|
}, [clearError]);
|
|
40
40
|
const handleClose = useCallback(() => {
|
|
41
|
-
dialogRef.current?.close();
|
|
42
41
|
onOpenChange(false);
|
|
43
42
|
resetForm();
|
|
44
43
|
}, [onOpenChange, resetForm]);
|
|
44
|
+
const handleShellOpenChange = useCallback((nextOpen) => {
|
|
45
|
+
if (!nextOpen)
|
|
46
|
+
handleClose();
|
|
47
|
+
}, [handleClose]);
|
|
45
48
|
const handleSubmit = useCallback(async (e) => {
|
|
46
49
|
e.preventDefault();
|
|
47
50
|
if (!name.trim())
|
|
@@ -62,23 +65,7 @@ export function CreateAgentInstanceDialog({ open, onOpenChange, org, agentId, on
|
|
|
62
65
|
// error state is managed by the hook
|
|
63
66
|
}
|
|
64
67
|
}, [name, org, agentId, description, environmentRefs, visibility, create, onCreated, handleClose]);
|
|
65
|
-
|
|
66
|
-
const prevOpenRef = useRef(false);
|
|
67
|
-
if (open !== prevOpenRef.current) {
|
|
68
|
-
prevOpenRef.current = open;
|
|
69
|
-
if (open) {
|
|
70
|
-
// Must defer showModal to after render
|
|
71
|
-
requestAnimationFrame(() => {
|
|
72
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
73
|
-
dialogRef.current.showModal();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
else if (dialogRef.current?.open) {
|
|
78
|
-
dialogRef.current.close();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return (_jsx("dialog", { ref: dialogRef, onClose: handleClose, className: cn("stg:fixed stg:inset-0 stg:m-auto stg:w-full stg:max-w-lg stg:rounded-xl stg:border stg:border-border stg:bg-popover stg:p-0 stg:shadow-xl", "stg:backdrop:bg-backdrop"), "aria-labelledby": titleId, children: _jsxs("form", { onSubmit: handleSubmit, className: "stg:flex stg:flex-col", children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4", children: [_jsx("h2", { id: titleId, className: "stg:text-base stg:font-semibold stg:text-foreground", children: "Create Agent Instance" }), _jsx("button", { type: "button", onClick: handleClose, "aria-label": "Close", className: cn("stg:rounded-md stg:p-1 stg:text-muted-foreground", "stg:hover:text-foreground stg:hover:bg-accent-hover", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"), children: _jsx(CloseIcon, {}) })] }), _jsxs("div", { className: "stg:space-y-5 stg:px-6 stg:py-5", children: [_jsxs("div", { children: [_jsxs("label", { htmlFor: nameId, className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: ["Name ", _jsx("span", { className: "stg:text-destructive", children: "*" })] }), _jsx("input", { id: nameId, type: "text", required: true, value: name, onChange: (e) => setName(e.target.value), placeholder: "e.g. prod, staging, qa-team", disabled: isCreating, className: cn("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm", "stg:text-foreground stg:placeholder:text-muted-foreground", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), autoFocus: true }), _jsx("p", { className: "stg:mt-1 stg:text-[0.65rem] stg:text-muted-foreground", children: "A URL-friendly slug will be generated from this name." })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: descriptionId, className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Description" }), _jsx("textarea", { id: descriptionId, value: description, onChange: (e) => setDescription(e.target.value), placeholder: "What is this instance used for?", disabled: isCreating, rows: 2, className: cn("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm stg:resize-none", "stg:text-foreground stg:placeholder:text-muted-foreground", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50") })] }), _jsxs("div", { children: [_jsx("label", { className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Environments" }), _jsx("p", { className: "stg:text-[0.65rem] stg:text-muted-foreground stg:mb-2", children: "Bind credentials and configuration to this instance." }), _jsx(EnvironmentPicker, { org: org, value: environmentRefs, onChange: setEnvironmentRefs, disabled: isCreating })] }), _jsxs("div", { children: [_jsx("label", { className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Visibility" }), _jsx(InstanceVisibilitySelector, { visibility: visibility, onVisibilityChange: setVisibility, mode: "create", disabled: isCreating })] }), error && (_jsx("div", { className: "stg:rounded-md stg:bg-destructive/10 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive", role: "alert", children: getUserMessage(error) }))] }), _jsxs("div", { className: "stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-6 stg:py-4", children: [_jsx("button", { type: "button", onClick: handleClose, disabled: isCreating, className: cn("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium", "stg:text-foreground stg:hover:bg-accent-hover", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), children: "Cancel" }), _jsx("button", { type: "submit", disabled: isCreating || !name.trim(), className: cn("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium", "stg:bg-primary stg:text-primary-foreground", "stg:hover:bg-primary/90", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), children: isCreating ? "Creating..." : "Create Instance" })] })] }) }));
|
|
68
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: handleShellOpenChange, width: "lg", "aria-labelledby": titleId, children: _jsxs("form", { onSubmit: handleSubmit, className: "stg:flex stg:flex-col", children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4", children: [_jsx("h2", { id: titleId, className: "stg:text-base stg:font-semibold stg:text-foreground", children: "Create Agent Instance" }), _jsx("button", { type: "button", onClick: handleClose, "aria-label": "Close", className: cn("stg:rounded-md stg:p-1 stg:text-muted-foreground", "stg:hover:text-foreground stg:hover:bg-accent-hover", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"), children: _jsx(CloseIcon, {}) })] }), _jsxs("div", { className: "stg:space-y-5 stg:px-6 stg:py-5", children: [_jsxs("div", { children: [_jsxs("label", { htmlFor: nameId, className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: ["Name ", _jsx("span", { className: "stg:text-destructive", children: "*" })] }), _jsx("input", { id: nameId, type: "text", required: true, value: name, onChange: (e) => setName(e.target.value), placeholder: "e.g. prod, staging, qa-team", disabled: isCreating, className: cn("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm", "stg:text-foreground stg:placeholder:text-muted-foreground", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), autoFocus: true }), _jsx("p", { className: "stg:mt-1 stg:text-[0.65rem] stg:text-muted-foreground", children: "A URL-friendly slug will be generated from this name." })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: descriptionId, className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Description" }), _jsx("textarea", { id: descriptionId, value: description, onChange: (e) => setDescription(e.target.value), placeholder: "What is this instance used for?", disabled: isCreating, rows: 2, className: cn("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm stg:resize-none", "stg:text-foreground stg:placeholder:text-muted-foreground", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50") })] }), _jsxs("div", { children: [_jsx("label", { className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Environments" }), _jsx("p", { className: "stg:text-[0.65rem] stg:text-muted-foreground stg:mb-2", children: "Bind credentials and configuration to this instance." }), _jsx(EnvironmentPicker, { org: org, value: environmentRefs, onChange: setEnvironmentRefs, disabled: isCreating })] }), _jsxs("div", { children: [_jsx("label", { className: "stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5", children: "Visibility" }), _jsx(InstanceVisibilitySelector, { visibility: visibility, onVisibilityChange: setVisibility, mode: "create", disabled: isCreating })] }), error && (_jsx("div", { className: "stg:rounded-md stg:bg-destructive/10 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive", role: "alert", children: getUserMessage(error) }))] }), _jsxs("div", { className: "stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-6 stg:py-4", children: [_jsx("button", { type: "button", onClick: handleClose, disabled: isCreating, className: cn("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium", "stg:text-foreground stg:hover:bg-accent-hover", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), children: "Cancel" }), _jsx("button", { type: "submit", disabled: isCreating || !name.trim(), className: cn("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium", "stg:bg-primary stg:text-primary-foreground", "stg:hover:bg-primary/90", "stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50"), children: isCreating ? "Creating..." : "Create Instance" })] })] }) }));
|
|
82
69
|
}
|
|
83
70
|
function CloseIcon() {
|
|
84
71
|
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAgentInstanceDialog.js","sourceRoot":"","sources":["../../src/agent-instance/CreateAgentInstanceDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CreateAgentInstanceDialog.js","sourceRoot":"","sources":["../../src/agent-instance/CreateAgentInstanceDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAG/F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AA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mentImageLightbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AttachmentImageLightbox.d.ts","sourceRoot":"","sources":["../../src/attachment/AttachmentImageLightbox.tsx"],"names":[],"mappings":"AAMA,iDAAiD;AACjD,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,GACV,EAAE,4BAA4B,2CA0D9B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback
|
|
3
|
+
import { useCallback } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
5
6
|
/**
|
|
6
7
|
* Full-size image preview in a native `<dialog>` — the click-to-open target
|
|
7
8
|
* for composer attachment chips (stigmer/stigmer#371).
|
|
@@ -23,30 +24,14 @@ import { cn } from "@stigmer/theme";
|
|
|
23
24
|
* older dialogs — the token is the designed value (Dont-Do #3).
|
|
24
25
|
*/
|
|
25
26
|
export function AttachmentImageLightbox({ src, filename, open, onClose, className, }) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const dialog = dialogRef.current;
|
|
29
|
-
if (!dialog)
|
|
30
|
-
return;
|
|
31
|
-
if (open && !dialog.open) {
|
|
32
|
-
dialog.showModal();
|
|
33
|
-
}
|
|
34
|
-
else if (!open && dialog.open) {
|
|
35
|
-
dialog.close();
|
|
36
|
-
}
|
|
37
|
-
}, [open]);
|
|
38
|
-
// Escape arrives as the native `cancel` event; intercept it so the
|
|
39
|
-
// caller's `open` prop stays the single source of truth for visibility.
|
|
40
|
-
const handleCancel = useCallback((e) => {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
onClose();
|
|
43
|
-
}, [onClose]);
|
|
44
|
-
const handleBackdropClick = useCallback((e) => {
|
|
45
|
-
if (e.target === dialogRef.current) {
|
|
27
|
+
const handleOpenChange = useCallback((nextOpen) => {
|
|
28
|
+
if (!nextOpen)
|
|
46
29
|
onClose();
|
|
47
|
-
}
|
|
48
30
|
}, [onClose]);
|
|
49
|
-
return (_jsx(
|
|
31
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: handleOpenChange, dismissOnBackdrop: true, "aria-label": `Preview ${filename}`,
|
|
32
|
+
// Lightbox outlier: viewport-relative sizing (not a width preset) and
|
|
33
|
+
// the background surface for image content.
|
|
34
|
+
className: cn("stg:w-auto stg:max-h-[85vh] stg:max-w-[85vw] stg:bg-background stg:text-foreground stg:outline-none", className), children: open && (_jsxs("div", { className: "stg:flex stg:flex-col", children: [_jsxs("div", { className: "stg:flex stg:items-center stg:gap-2 stg:px-3 stg:py-2", children: [_jsx("span", { className: "stg:min-w-0 stg:flex-1 stg:truncate stg:text-xs stg:font-semibold stg:text-foreground", children: filename }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close image preview", className: "stg:shrink-0 stg:cursor-pointer stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring", children: _jsx(CloseIcon, {}) })] }), _jsx("div", { className: "stg:min-h-0 stg:overflow-auto stg:border-t stg:border-border", children: src ? (_jsx("img", { src: src, alt: filename, className: "stg:block stg:max-h-[75vh] stg:max-w-full stg:object-contain" })) : (_jsx("div", { className: "stg:h-48 stg:w-72 stg:animate-pulse stg:bg-muted", "aria-hidden": "true" })) })] })) }));
|
|
50
35
|
}
|
|
51
36
|
// ---------------------------------------------------------------------------
|
|
52
37
|
// Inline SVG icons (SDK pattern: no external icon dependency)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentImageLightbox.js","sourceRoot":"","sources":["../../src/attachment/AttachmentImageLightbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"AttachmentImageLightbox.js","sourceRoot":"","sources":["../../src/attachment/AttachmentImageLightbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAoBzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,GACoB;IAC7B,MAAM,gBAAgB,GAAG,WAAW,CAClC,CAAC,QAAiB,EAAE,EAAE;QACpB,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;IAC3B,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,KAAC,WAAW,IACV,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,gBAAgB,EAC9B,iBAAiB,sBACL,WAAW,QAAQ,EAAE;QACjC,sEAAsE;QACtE,4CAA4C;QAC5C,SAAS,EAAE,EAAE,CACX,qGAAqG,EACrG,SAAS,CACV,YAEA,IAAI,IAAI,CACP,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAK,SAAS,EAAC,uDAAuD,aAKpE,eAAM,SAAS,EAAC,uFAAuF,YACpG,QAAQ,GACJ,EACP,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACL,qBAAqB,EAChC,SAAS,EAAC,qNAAqN,YAE/N,KAAC,SAAS,KAAG,GACN,IACL,EACN,cAAK,SAAS,EAAC,8DAA8D,YAC1E,GAAG,CAAC,CAAC,CAAC,CACL,cACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,QAAQ,EACb,SAAS,EAAC,8DAA8D,GACxE,CACH,CAAC,CAAC,CAAC,CACF,cACE,SAAS,EAAC,kDAAkD,iBAChD,MAAM,GAClB,CACH,GACG,IACF,CACP,GACW,CACf,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,8DAA8D;AAC9D,8EAA8E;AAE9E,SAAS,SAAS;IAChB,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,eAAM,CAAC,EAAC,YAAY,GAAG,EACvB,eAAM,CAAC,EAAC,YAAY,GAAG,IACnB,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelConversationsDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelConversationsDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChannelConversationsDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelConversationsDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAS9F,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC9C,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,WAAW,EACX,KAAY,GACb,EAAE,+BAA+B,2CA0BjC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId
|
|
3
|
+
import { useCallback, useId } from "react";
|
|
4
4
|
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
5
5
|
import { MessageSquare, User, X } from "lucide-react";
|
|
6
6
|
import { cn } from "@stigmer/theme";
|
|
7
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
7
8
|
import { getUserMessage } from "@stigmer/sdk";
|
|
8
9
|
import { formatRelativeTime } from "../activity/format-relative-time.js";
|
|
9
10
|
import { Button } from "../button/Button.js";
|
|
@@ -35,28 +36,11 @@ import { useChannelSessions } from "./useChannelSessions.js";
|
|
|
35
36
|
* channel card action.
|
|
36
37
|
*/
|
|
37
38
|
export function ChannelConversationsDialog({ open, onOpenChange, channel, sessionHref, modal = true, }) {
|
|
38
|
-
const dialogRef = useRef(null);
|
|
39
39
|
const titleId = useId();
|
|
40
40
|
const handleClose = useCallback(() => {
|
|
41
|
-
dialogRef.current?.close();
|
|
42
41
|
onOpenChange(false);
|
|
43
42
|
}, [onOpenChange]);
|
|
44
|
-
|
|
45
|
-
const prevOpenRef = useRef(false);
|
|
46
|
-
if (modal && open !== prevOpenRef.current) {
|
|
47
|
-
prevOpenRef.current = open;
|
|
48
|
-
if (open) {
|
|
49
|
-
requestAnimationFrame(() => {
|
|
50
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
51
|
-
dialogRef.current.showModal();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else if (dialogRef.current?.open) {
|
|
56
|
-
dialogRef.current.close();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return (_jsx("dialog", { ref: dialogRef, open: modal ? undefined : open, onClose: handleClose, className: cn("stg:w-full stg:max-w-lg stg:rounded-xl stg:border stg:border-border stg:bg-popover stg:p-0 stg:shadow-xl", modal ? "stg:fixed stg:inset-0 stg:m-auto stg:backdrop:bg-backdrop" : "stg:relative"), "aria-labelledby": titleId, children: open && (_jsx(ChannelConversationsDialogBody, { titleId: titleId, channel: channel, sessionHref: sessionHref, onClose: handleClose })) }));
|
|
43
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: onOpenChange, modal: modal, width: "lg", "aria-labelledby": titleId, children: open && (_jsx(ChannelConversationsDialogBody, { titleId: titleId, channel: channel, sessionHref: sessionHref, onClose: handleClose })) }));
|
|
60
44
|
}
|
|
61
45
|
function ChannelConversationsDialogBody({ titleId, channel, sessionHref, onClose, }) {
|
|
62
46
|
const channelName = channel.metadata?.name || channel.metadata?.slug || "this channel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelConversationsDialog.js","sourceRoot":"","sources":["../../src/channel/ChannelConversationsDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ChannelConversationsDialog.js","sourceRoot":"","sources":["../../src/channel/ChannelConversationsDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,OA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AAC;AAED,SAAS,qBAAqB;IAC5B,OAAO,CACL,cAAK,SAAS,EAAC,uBAAuB,YACnC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,cAAa,SAAS,EAAC,8DAA8D,IAA3E,CAAC,CAA6E,CACzF,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,EAAE,GACN,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS;QAC7C,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelCredentialsDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelCredentialsDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChannelCredentialsDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelCredentialsDialog.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAK9F,kDAAkD;AAClD,MAAM,WAAW,6BAA6B;IAC5C,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,OAAO,EACP,KAAY,GACb,EAAE,6BAA6B,2CAgC/B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId,
|
|
3
|
+
import { useCallback, useId, useState } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
5
6
|
import { getUserMessage } from "@stigmer/sdk";
|
|
6
7
|
import { Button } from "../button/Button.js";
|
|
7
8
|
import { ChannelToolCredentials } from "./ChannelToolCredentials.js";
|
|
@@ -19,32 +20,15 @@ import { agentChannelToInput, useSaveAgentChannel } from "./useSaveAgentChannel.
|
|
|
19
20
|
* channel card action.
|
|
20
21
|
*/
|
|
21
22
|
export function ChannelCredentialsDialog({ open, onOpenChange, agent, channel, onSaved, modal = true, }) {
|
|
22
|
-
const dialogRef = useRef(null);
|
|
23
23
|
// Instance-scoped title id (oss#593): a reusable component must not
|
|
24
24
|
// hardcode DOM ids — hosts legitimately mount this dialog more than once
|
|
25
25
|
// per page (e.g. zone-cached detail pages), and duplicate ids break the
|
|
26
26
|
// aria-labelledby association for every copy after the first.
|
|
27
27
|
const titleId = useId();
|
|
28
28
|
const handleClose = useCallback(() => {
|
|
29
|
-
dialogRef.current?.close();
|
|
30
29
|
onOpenChange(false);
|
|
31
30
|
}, [onOpenChange]);
|
|
32
|
-
|
|
33
|
-
const prevOpenRef = useRef(false);
|
|
34
|
-
if (modal && open !== prevOpenRef.current) {
|
|
35
|
-
prevOpenRef.current = open;
|
|
36
|
-
if (open) {
|
|
37
|
-
requestAnimationFrame(() => {
|
|
38
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
39
|
-
dialogRef.current.showModal();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else if (dialogRef.current?.open) {
|
|
44
|
-
dialogRef.current.close();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return (_jsx("dialog", { ref: dialogRef, open: modal ? undefined : open, onClose: handleClose, className: cn("stg:w-full stg:max-w-md stg:rounded-xl stg:border stg:border-border stg:bg-popover stg:p-0 stg:shadow-xl", modal ? "stg:fixed stg:inset-0 stg:m-auto stg:backdrop:bg-backdrop" : "stg:relative"), "aria-labelledby": titleId, children: open && (_jsx(ChannelCredentialsDialogBody, { agent: agent, channel: channel, onSaved: onSaved, onClose: handleClose, titleId: titleId })) }));
|
|
31
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: onOpenChange, modal: modal, width: "md", "aria-labelledby": titleId, children: open && (_jsx(ChannelCredentialsDialogBody, { agent: agent, channel: channel, onSaved: onSaved, onClose: handleClose, titleId: titleId })) }));
|
|
48
32
|
}
|
|
49
33
|
function ChannelCredentialsDialogBody({ agent, channel, onSaved, onClose, titleId, }) {
|
|
50
34
|
const channelName = channel.metadata?.name || channel.metadata?.slug || "this channel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelCredentialsDialog.js","sourceRoot":"","sources":["../../src/channel/ChannelCredentialsDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ChannelCredentialsDialog.js","sourceRoot":"","sources":["../../src/channel/ChannelCredentialsDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,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,SAAS,KAAG,GACN,IACL,EAEN,eAAK,SAAS,EAAC,mBAAmB,aAChC,KAAC,sBAAsB,IACrB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,KAAK,GACvC,EAED,KAAK,IAAI,CACR,cACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,2IAA2I,YAEpJ,cAAc,CAAC,KAAK,CAAC,GAClB,CACP,IACG,EAEN,eAAK,SAAS,EAAC,qFAAqF,aAClG,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE;4BACZ,UAAU,EAAE,CAAC;4BACb,OAAO,EAAE,CAAC;wBACZ,CAAC,EACD,QAAQ,EAAE,SAAS,uBAGZ,EACT,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,UAAU,EAAE,EAChC,QAAQ,EAAE,SAAS,qBAGZ,IACL,IACF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CACL,cAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,KAAK,EAAC,aAAa,EAAC,OAAO,iBAAa,MAAM,YAC1I,eAAM,CAAC,EAAC,oBAAoB,GAAG,GAC3B,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelTemplatesDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelTemplatesDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChannelTemplatesDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ChannelTemplatesDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AA2B9F,gDAAgD;AAChD,MAAM,WAAW,2BAA2B;IAC1C,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAY,GACb,EAAE,2BAA2B,2CA6B7B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId
|
|
3
|
+
import { useCallback, useId } from "react";
|
|
4
4
|
import { ExternalLink, LayoutTemplate, X } from "lucide-react";
|
|
5
5
|
import { cn } from "@stigmer/theme";
|
|
6
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
6
7
|
import { getUserMessage } from "@stigmer/sdk";
|
|
7
8
|
import { Button } from "../button/Button.js";
|
|
8
9
|
import { EmptyState } from "../empty-state/EmptyState.js";
|
|
@@ -47,31 +48,14 @@ const WHATSAPP_MANAGER_TEMPLATES_URL = "https://business.facebook.com/wa/manage/
|
|
|
47
48
|
* whose descriptor declares `supportsMessageTemplates`.
|
|
48
49
|
*/
|
|
49
50
|
export function ChannelTemplatesDialog({ open, onOpenChange, channel, onEditYaml, modal = true, }) {
|
|
50
|
-
const dialogRef = useRef(null);
|
|
51
51
|
const titleId = useId();
|
|
52
52
|
const handleClose = useCallback(() => {
|
|
53
|
-
dialogRef.current?.close();
|
|
54
53
|
onOpenChange(false);
|
|
55
54
|
}, [onOpenChange]);
|
|
56
|
-
|
|
57
|
-
const prevOpenRef = useRef(false);
|
|
58
|
-
if (modal && open !== prevOpenRef.current) {
|
|
59
|
-
prevOpenRef.current = open;
|
|
60
|
-
if (open) {
|
|
61
|
-
requestAnimationFrame(() => {
|
|
62
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
63
|
-
dialogRef.current.showModal();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
else if (dialogRef.current?.open) {
|
|
68
|
-
dialogRef.current.close();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return (_jsx("dialog", { ref: dialogRef, open: modal ? undefined : open, onClose: handleClose, className: cn(
|
|
55
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: onOpenChange, modal: modal,
|
|
72
56
|
// Wider than the conversations dialog on purpose: template
|
|
73
57
|
// bodies are the content, and a narrow column shreds them.
|
|
74
|
-
|
|
58
|
+
width: "2xl", "aria-labelledby": titleId, children: open && (_jsx(ChannelTemplatesDialogBody, { titleId: titleId, channel: channel, onEditYaml: onEditYaml, onClose: handleClose })) }));
|
|
75
59
|
}
|
|
76
60
|
function ChannelTemplatesDialogBody({ titleId, channel, onEditYaml, onClose, }) {
|
|
77
61
|
const channelName = channel.metadata?.name || channel.metadata?.slug || "this channel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelTemplatesDialog.js","sourceRoot":"","sources":["../../src/channel/ChannelTemplatesDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"ChannelTemplatesDialog.js","sourceRoot":"","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version":3,"file":"ConnectSlackDialog.d.ts","sourceRoot":"","sources":["../../src/channel/ConnectSlackDialog.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAkB9F,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,KAAY,EACZ,eAAe,GAChB,EAAE,uBAAuB,2CAiCzB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId, useMemo,
|
|
3
|
+
import { useCallback, useId, useMemo, useState } from "react";
|
|
4
4
|
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
5
6
|
import { getErrorReason } from "@stigmer/sdk";
|
|
6
7
|
import { AgentChannelInstallState } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/status_pb";
|
|
7
8
|
import { Button } from "../button/Button.js";
|
|
@@ -36,34 +37,15 @@ import { SlackMarkIcon } from "./SlackMarkIcon.js";
|
|
|
36
37
|
* Render it directly only when you own the open-state.
|
|
37
38
|
*/
|
|
38
39
|
export function ConnectSlackDialog({ open, onOpenChange, agent, channel, onChannelsChanged, modal = true, channelAppsHref, }) {
|
|
39
|
-
const dialogRef = useRef(null);
|
|
40
40
|
// Instance-scoped title id (oss#593): a reusable component must not
|
|
41
41
|
// hardcode DOM ids — hosts legitimately mount this dialog more than once
|
|
42
42
|
// per page (e.g. zone-cached detail pages), and duplicate ids break the
|
|
43
43
|
// aria-labelledby association for every copy after the first.
|
|
44
44
|
const titleId = useId();
|
|
45
45
|
const handleClose = useCallback(() => {
|
|
46
|
-
dialogRef.current?.close();
|
|
47
46
|
onOpenChange(false);
|
|
48
47
|
}, [onOpenChange]);
|
|
49
|
-
|
|
50
|
-
// Non-modal hosts pass `open` as a plain attribute instead — the dialog
|
|
51
|
-
// renders in-flow with no top layer to manage.
|
|
52
|
-
const prevOpenRef = useRef(false);
|
|
53
|
-
if (modal && open !== prevOpenRef.current) {
|
|
54
|
-
prevOpenRef.current = open;
|
|
55
|
-
if (open) {
|
|
56
|
-
requestAnimationFrame(() => {
|
|
57
|
-
if (dialogRef.current && !dialogRef.current.open) {
|
|
58
|
-
dialogRef.current.showModal();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else if (dialogRef.current?.open) {
|
|
63
|
-
dialogRef.current.close();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return (_jsx("dialog", { ref: dialogRef, open: modal ? undefined : open, onClose: handleClose, className: cn("stg:w-full stg:max-w-md stg:rounded-xl stg:border stg:border-border stg:bg-popover stg:p-0 stg:shadow-xl", modal ? "stg:fixed stg:inset-0 stg:m-auto stg:backdrop:bg-backdrop" : "stg:relative"), "aria-labelledby": titleId, children: open && (_jsx(ConnectSlackDialogBody, { agent: agent, channel: channel ?? null, onChannelsChanged: onChannelsChanged, onClose: handleClose, titleId: titleId, channelAppsHref: channelAppsHref })) }));
|
|
48
|
+
return (_jsx(DialogShell, { open: open, onOpenChange: onOpenChange, modal: modal, width: "md", "aria-labelledby": titleId, children: open && (_jsx(ConnectSlackDialogBody, { agent: agent, channel: channel ?? null, onChannelsChanged: onChannelsChanged, onClose: handleClose, titleId: titleId, channelAppsHref: channelAppsHref })) }));
|
|
67
49
|
}
|
|
68
50
|
function ConnectSlackDialogBody({ agent, channel, onChannelsChanged, onClose, channelAppsHref, titleId, }) {
|
|
69
51
|
const deploymentMode = useDeploymentMode();
|