@ydtb/tk-scope-capture 0.22.0
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/LICENSE +21 -0
- package/dist/src/client/pages/CaptureBuilderPage.d.ts +2 -0
- package/dist/src/client/pages/CaptureBuilderPage.d.ts.map +1 -0
- package/dist/src/client/pages/CaptureBuilderPage.js +308 -0
- package/dist/src/client/pages/CaptureBuilderPage.js.map +1 -0
- package/dist/src/client/pages/CaptureSubmissionDetailPage.d.ts +2 -0
- package/dist/src/client/pages/CaptureSubmissionDetailPage.d.ts.map +1 -0
- package/dist/src/client/pages/CaptureSubmissionDetailPage.js +64 -0
- package/dist/src/client/pages/CaptureSubmissionDetailPage.js.map +1 -0
- package/dist/src/client/pages/CaptureSubmissionsPage.d.ts +2 -0
- package/dist/src/client/pages/CaptureSubmissionsPage.d.ts.map +1 -0
- package/dist/src/client/pages/CaptureSubmissionsPage.js +22 -0
- package/dist/src/client/pages/CaptureSubmissionsPage.js.map +1 -0
- package/dist/src/client/pages/PublicFormPage.d.ts +2 -0
- package/dist/src/client/pages/PublicFormPage.d.ts.map +1 -0
- package/dist/src/client/pages/PublicFormPage.js +62 -0
- package/dist/src/client/pages/PublicFormPage.js.map +1 -0
- package/dist/src/client/pages/PublicQuizPage.d.ts +2 -0
- package/dist/src/client/pages/PublicQuizPage.d.ts.map +1 -0
- package/dist/src/client/pages/PublicQuizPage.js +87 -0
- package/dist/src/client/pages/PublicQuizPage.js.map +1 -0
- package/dist/src/client/pages/QuizBuilderPage.d.ts +2 -0
- package/dist/src/client/pages/QuizBuilderPage.d.ts.map +1 -0
- package/dist/src/client/pages/QuizBuilderPage.js +118 -0
- package/dist/src/client/pages/QuizBuilderPage.js.map +1 -0
- package/dist/src/client.d.ts +617 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +39 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/server/api/action-adapters.d.ts +93 -0
- package/dist/src/server/api/action-adapters.d.ts.map +1 -0
- package/dist/src/server/api/action-adapters.js +147 -0
- package/dist/src/server/api/action-adapters.js.map +1 -0
- package/dist/src/server/api/router.d.ts +621 -0
- package/dist/src/server/api/router.d.ts.map +1 -0
- package/dist/src/server/api/router.js +903 -0
- package/dist/src/server/api/router.js.map +1 -0
- package/dist/src/server.d.ts +3 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +15 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/shared/conditions.d.ts +5 -0
- package/dist/src/shared/conditions.d.ts.map +1 -0
- package/dist/src/shared/conditions.js +39 -0
- package/dist/src/shared/conditions.js.map +1 -0
- package/dist/src/shared/db/schema.d.ts +983 -0
- package/dist/src/shared/db/schema.d.ts.map +1 -0
- package/dist/src/shared/db/schema.js +113 -0
- package/dist/src/shared/db/schema.js.map +1 -0
- package/dist/src/shared/field-types.d.ts +7 -0
- package/dist/src/shared/field-types.d.ts.map +1 -0
- package/dist/src/shared/field-types.js +116 -0
- package/dist/src/shared/field-types.js.map +1 -0
- package/dist/src/shared/scoring.d.ts +3 -0
- package/dist/src/shared/scoring.d.ts.map +1 -0
- package/dist/src/shared/scoring.js +47 -0
- package/dist/src/shared/scoring.js.map +1 -0
- package/dist/src/shared/templates.d.ts +20 -0
- package/dist/src/shared/templates.d.ts.map +1 -0
- package/dist/src/shared/templates.js +122 -0
- package/dist/src/shared/templates.js.map +1 -0
- package/dist/src/shared/tool.d.ts +2 -0
- package/dist/src/shared/tool.d.ts.map +1 -0
- package/dist/src/shared/tool.js +7 -0
- package/dist/src/shared/tool.js.map +1 -0
- package/dist/src/shared/types.d.ts +251 -0
- package/dist/src/shared/types.d.ts.map +1 -0
- package/dist/src/shared/types.js +10 -0
- package/dist/src/shared/types.js.map +1 -0
- package/package.json +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Your Digital Toolbox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptureBuilderPage.d.ts","sourceRoot":"","sources":["../../../../src/client/pages/CaptureBuilderPage.tsx"],"names":[],"mappings":"AAsEA,wBAAgB,kBAAkB,4CAwYjC"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useNavigate, useParams } from "@tanstack/react-router";
|
|
4
|
+
import { formatRelativeTime } from "@ydtb/tk-scope-lib/date";
|
|
5
|
+
import { AlignLeft, CheckCircle2, Eye, FileText, GitBranch, Info, GripVertical, Inbox, LayoutPanelTop, PanelRight, ListTree, Mail, Palette, Phone, Plus, Save, Search, Send, Sparkles, Star, Type, } from "lucide-react";
|
|
6
|
+
import { useMutation, useQuery, useQueryClient } from "@ydtb/tk-scope-query-client";
|
|
7
|
+
import { HeaderPortal, SidebarPortal, useContributions, useScopeLink } from "@ydtb/tk-scope/client";
|
|
8
|
+
import { ToolPageHeader } from "@ydtb/tk-scope-shell";
|
|
9
|
+
import { Button } from "@ydtb/tk-scope-ui/components/button";
|
|
10
|
+
import { Input } from "@ydtb/tk-scope-ui/components/input";
|
|
11
|
+
import { Label } from "@ydtb/tk-scope-ui/components/label";
|
|
12
|
+
import { TabbedPanel } from "@ydtb/tk-scope-ui/components/tabbed-panel";
|
|
13
|
+
import { Switch } from "@ydtb/tk-scope-ui/components/switch";
|
|
14
|
+
import { Textarea } from "@ydtb/tk-scope-ui/components/textarea";
|
|
15
|
+
import { toast } from "@ydtb/tk-scope-ui/components/sonner";
|
|
16
|
+
import { cn } from "@ydtb/tk-scope-ui/lib/utils";
|
|
17
|
+
import { captureApi } from "../../client.js";
|
|
18
|
+
import { BASE_CAPTURE_FIELD_TYPES, getCaptureFieldType } from "../../shared/field-types.js";
|
|
19
|
+
import { CAPTURE_FORM_TEMPLATES } from "../../shared/templates.js";
|
|
20
|
+
const CAPTURE_BUILDER_DRAG_TYPE = "application/vnd.ydtb.capture.palette-item+json";
|
|
21
|
+
const FIELD_ICON_MAP = { AlignLeft, ListTree, Mail, Phone, Star, Type };
|
|
22
|
+
const FORM_PANEL_TABS = [
|
|
23
|
+
{ id: "outline", icon: ListTree, label: "Outline" },
|
|
24
|
+
{ id: "inspector", icon: CheckCircle2, label: "Inspector" },
|
|
25
|
+
{ id: "submissions", icon: Inbox, label: "Submissions" },
|
|
26
|
+
{ id: "actions", icon: GitBranch, label: "Actions" },
|
|
27
|
+
{ id: "publish", icon: Send, label: "Publish" },
|
|
28
|
+
{ id: "theme", icon: Palette, label: "Theme", position: "bottom" },
|
|
29
|
+
];
|
|
30
|
+
const CAPTURE_LIST_PANEL_TABS = [
|
|
31
|
+
{ id: "overview", icon: Info, label: "Overview" },
|
|
32
|
+
{ id: "submissions", icon: Inbox, label: "Submissions" },
|
|
33
|
+
{ id: "publish", icon: Send, label: "Publish" },
|
|
34
|
+
{ id: "actions", icon: GitBranch, label: "Actions" },
|
|
35
|
+
];
|
|
36
|
+
export function CaptureBuilderPage() {
|
|
37
|
+
const { id } = useParams({ strict: false });
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
const sl = useScopeLink();
|
|
40
|
+
const queryClient = useQueryClient();
|
|
41
|
+
const [newFormName] = useState("Lead capture form");
|
|
42
|
+
const [landingSearch, setLandingSearch] = useState("");
|
|
43
|
+
const [selectedLandingDefinition, setSelectedLandingDefinition] = useState(null);
|
|
44
|
+
const [activeLandingDetailTab, setActiveLandingDetailTab] = useState("overview");
|
|
45
|
+
const [formName, setFormName] = useState("Untitled form");
|
|
46
|
+
const [fields, setFields] = useState([]);
|
|
47
|
+
const [actionConfig, setActionConfig] = useState({ contacts: { enabled: false, customFieldMappings: {} } });
|
|
48
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
49
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
50
|
+
const [detailsOpen, setDetailsOpen] = useState(true);
|
|
51
|
+
const [activePanel, setActivePanel] = useState("outline");
|
|
52
|
+
const captureContributions = useContributions("capture");
|
|
53
|
+
const fieldTypes = useMemo(() => [...BASE_CAPTURE_FIELD_TYPES, ...captureContributions.flatMap((contribution) => contribution.fieldTypes ?? [])], [captureContributions]);
|
|
54
|
+
const definitionsQuery = useQuery(captureApi.definitions.list.queryOptions({ input: {} }));
|
|
55
|
+
const definitionQuery = useQuery({
|
|
56
|
+
...captureApi.definitions.get.queryOptions({ input: { id: id ?? "" } }),
|
|
57
|
+
enabled: Boolean(id),
|
|
58
|
+
});
|
|
59
|
+
const submissionsQuery = useQuery(captureApi.submissions.list.queryOptions({ input: {} }));
|
|
60
|
+
const workflowsQuery = useQuery({
|
|
61
|
+
...captureApi.definitions.listWorkflows.queryOptions({ input: {} }),
|
|
62
|
+
enabled: Boolean(id),
|
|
63
|
+
});
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const definition = definitionQuery.data;
|
|
66
|
+
if (!definition)
|
|
67
|
+
return;
|
|
68
|
+
setFormName(definition.name);
|
|
69
|
+
setFields(definition.fields);
|
|
70
|
+
setActionConfig(definition.actionConfig ?? { contacts: { enabled: false, customFieldMappings: {} } });
|
|
71
|
+
setSelectedId(definition.fields[0]?.id ?? null);
|
|
72
|
+
}, [definitionQuery.data]);
|
|
73
|
+
const selectedField = useMemo(() => fields.find((field) => field.id === selectedId) ?? null, [fields, selectedId]);
|
|
74
|
+
const invalidateCapture = useCallback(() => {
|
|
75
|
+
queryClient.invalidateQueries({ queryKey: captureApi.definitions.key() });
|
|
76
|
+
queryClient.invalidateQueries({ queryKey: captureApi.submissions.key() });
|
|
77
|
+
}, [queryClient]);
|
|
78
|
+
const createMutation = useMutation(captureApi.definitions.create.mutationOptions({
|
|
79
|
+
onSuccess: (definition) => {
|
|
80
|
+
invalidateCapture();
|
|
81
|
+
toast.success("Form created");
|
|
82
|
+
void navigate({ to: sl("/capture/forms/$id/builder"), params: { id: definition.id } });
|
|
83
|
+
},
|
|
84
|
+
onError: () => toast.error("Failed to create form"),
|
|
85
|
+
}));
|
|
86
|
+
const updateMutation = useMutation(captureApi.definitions.update.mutationOptions({
|
|
87
|
+
onSuccess: () => {
|
|
88
|
+
invalidateCapture();
|
|
89
|
+
toast.success("Form saved");
|
|
90
|
+
},
|
|
91
|
+
onError: () => toast.error("Failed to save form"),
|
|
92
|
+
}));
|
|
93
|
+
const publishMutation = useMutation(captureApi.definitions.publish.mutationOptions({
|
|
94
|
+
onSuccess: () => {
|
|
95
|
+
invalidateCapture();
|
|
96
|
+
toast.success("Form published");
|
|
97
|
+
},
|
|
98
|
+
onError: () => toast.error("Failed to publish form"),
|
|
99
|
+
}));
|
|
100
|
+
const applyFormTemplate = useCallback((templateId) => {
|
|
101
|
+
const template = CAPTURE_FORM_TEMPLATES.find((item) => item.id === templateId);
|
|
102
|
+
if (!template)
|
|
103
|
+
return;
|
|
104
|
+
setFormName(template.title);
|
|
105
|
+
setFields(template.fields.map((field) => ({ ...field, metadata: field.metadata ? { ...field.metadata } : undefined, options: field.options ? [...field.options] : undefined })));
|
|
106
|
+
setActionConfig(template.actionConfig ?? { contacts: { enabled: false, customFieldMappings: {} } });
|
|
107
|
+
setSelectedId(template.fields[0]?.id ?? null);
|
|
108
|
+
toast.success(`Applied ${template.label}`);
|
|
109
|
+
}, []);
|
|
110
|
+
const insertField = useCallback((tile) => {
|
|
111
|
+
const fieldId = `field-${Date.now().toString(36)}`;
|
|
112
|
+
const newField = {
|
|
113
|
+
id: fieldId,
|
|
114
|
+
key: `${tile.id}_${Date.now().toString(36)}`,
|
|
115
|
+
label: tile.defaultField.label,
|
|
116
|
+
type: tile.defaultField.type,
|
|
117
|
+
required: tile.defaultField.required ?? false,
|
|
118
|
+
...(tile.defaultField.options ? { options: tile.defaultField.options } : {}),
|
|
119
|
+
...(tile.defaultField.metadata ? { metadata: tile.defaultField.metadata } : {}),
|
|
120
|
+
};
|
|
121
|
+
setFields((current) => [...current, newField]);
|
|
122
|
+
setSelectedId(fieldId);
|
|
123
|
+
}, []);
|
|
124
|
+
const updateSelectedField = useCallback((patch) => {
|
|
125
|
+
if (!selectedId)
|
|
126
|
+
return;
|
|
127
|
+
setFields((current) => current.map((field) => (field.id === selectedId ? { ...field, ...patch } : field)));
|
|
128
|
+
}, [selectedId]);
|
|
129
|
+
const handleDragStart = useCallback((event, tile) => {
|
|
130
|
+
event.dataTransfer.effectAllowed = "copy";
|
|
131
|
+
event.dataTransfer.setData(CAPTURE_BUILDER_DRAG_TYPE, JSON.stringify(tile));
|
|
132
|
+
event.dataTransfer.setData("text/plain", tile.label);
|
|
133
|
+
}, []);
|
|
134
|
+
const handleDragOver = useCallback((event) => {
|
|
135
|
+
if (event.dataTransfer.types.includes(CAPTURE_BUILDER_DRAG_TYPE)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
event.dataTransfer.dropEffect = "copy";
|
|
138
|
+
setIsDragOver(true);
|
|
139
|
+
}
|
|
140
|
+
}, []);
|
|
141
|
+
const handleDrop = useCallback((event) => {
|
|
142
|
+
const raw = event.dataTransfer.getData(CAPTURE_BUILDER_DRAG_TYPE);
|
|
143
|
+
if (!raw)
|
|
144
|
+
return;
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
setIsDragOver(false);
|
|
147
|
+
const parsed = JSON.parse(raw);
|
|
148
|
+
insertField(parsed);
|
|
149
|
+
}, [insertField]);
|
|
150
|
+
const saveForm = useCallback(async () => {
|
|
151
|
+
if (!id)
|
|
152
|
+
return;
|
|
153
|
+
await updateMutation.mutateAsync({ id, name: formName, fields, actionConfig });
|
|
154
|
+
}, [actionConfig, fields, formName, id, updateMutation]);
|
|
155
|
+
const publishForm = useCallback(async () => {
|
|
156
|
+
if (!id)
|
|
157
|
+
return;
|
|
158
|
+
await updateMutation.mutateAsync({ id, name: formName, fields, actionConfig });
|
|
159
|
+
await publishMutation.mutateAsync({ id });
|
|
160
|
+
}, [actionConfig, fields, formName, id, publishMutation, updateMutation]);
|
|
161
|
+
const definitionSubmissions = useMemo(() => {
|
|
162
|
+
const rows = (submissionsQuery.data ?? []);
|
|
163
|
+
return id ? rows.filter((submission) => submission.definitionId === id) : rows;
|
|
164
|
+
}, [id, submissionsQuery.data]);
|
|
165
|
+
const publicationSlug = definitionQuery.data?.publicationSlug ?? undefined;
|
|
166
|
+
const publicPath = publicationSlug ? `/forms/${publicationSlug}` : null;
|
|
167
|
+
const openDefinition = useCallback((definitionId) => {
|
|
168
|
+
const definition = definitionsQuery.data?.find((item) => item.id === definitionId);
|
|
169
|
+
if (definition?.surface === "quiz") {
|
|
170
|
+
void navigate({ to: sl("/capture/quizzes/builder") });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
void navigate({ to: sl("/capture/forms/$id/builder"), params: { id: definitionId } });
|
|
174
|
+
}, [definitionsQuery.data, navigate, sl]);
|
|
175
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeaderPortal, { children: _jsx(ToolPageHeader, { title: id ? "Forms builder" : "Capture Items", description: id ? "Create a Capture-backed Form, publish it, and review submitted responses." : "Manage forms, quizzes, and other Capture-backed intake surfaces.", actions: id ? (_jsxs(_Fragment, { children: [publicPath && (_jsx(Button, { variant: "outline", size: "sm", type: "button", asChild: true, children: _jsxs("a", { href: publicPath, target: "_blank", rel: "noreferrer", children: [_jsx(Eye, { className: "h-4 w-4" }), "Public form"] }) })), _jsx(Button, { variant: "outline", size: "icon", type: "button", className: cn("h-9 w-9", detailsOpen && "bg-muted"), onClick: () => setDetailsOpen((open) => !open), "aria-label": detailsOpen ? "Hide details panel" : "Show details panel", "aria-pressed": detailsOpen, title: detailsOpen ? "Hide details panel" : "Show details panel", children: _jsx(PanelRight, { className: "h-4 w-4" }) }), _jsxs(Button, { variant: "outline", size: "sm", type: "button", onClick: () => void saveForm(), children: [_jsx(Save, { className: "h-4 w-4" }), "Save"] }), _jsxs(Button, { size: "sm", type: "button", onClick: () => void publishForm(), children: [_jsx(Send, { className: "h-4 w-4" }), "Publish"] })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative w-64", children: [_jsx(Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { type: "search", placeholder: "Search capture items...", value: landingSearch, onChange: (event) => setLandingSearch(event.target.value), className: "h-9 pl-9" })] }), selectedLandingDefinition && (_jsx(Button, { variant: "outline", size: "icon", type: "button", className: "h-9 w-9 bg-muted", onClick: () => setSelectedLandingDefinition(null), "aria-label": "Hide details panel", "aria-pressed": "true", title: "Hide details panel", children: _jsx(PanelRight, { className: "h-4 w-4" }) })), _jsxs(Button, { size: "sm", type: "button", onClick: () => createMutation.mutate({ name: newFormName }), children: [_jsx(Plus, { className: "h-4 w-4" }), "New Form"] })] })) }) }), _jsx(CaptureBuilderSidebar, { definitions: definitionsQuery.data ?? [], currentId: id, fields: fields, fieldTypes: fieldTypes, publicationSlug: publicationSlug, onOpen: openDefinition, onCreate: () => createMutation.mutate({ name: newFormName }), onApplyTemplate: applyFormTemplate, onInsertField: insertField, onDragStart: handleDragStart, onSave: () => void saveForm(), onPublish: () => void publishForm() }), _jsx("main", { className: "flex h-full min-h-0 flex-1 flex-col gap-4 p-4 sm:p-6", "data-testid": "capture-builder-shell", children: !id ? (_jsx(StartPanel, { definitions: definitionsQuery.data ?? [], isLoading: definitionsQuery.isLoading, search: landingSearch, selectedDefinition: selectedLandingDefinition, activeDetailTab: activeLandingDetailTab, onSelectDefinition: (definition) => {
|
|
176
|
+
setSelectedLandingDefinition(definition);
|
|
177
|
+
setActiveLandingDetailTab("overview");
|
|
178
|
+
}, onCloseDetails: () => setSelectedLandingDefinition(null), onDetailTabChange: setActiveLandingDetailTab, onCreate: () => createMutation.mutate({ name: newFormName }), onOpen: openDefinition })) : (_jsxs(_Fragment, { children: [_jsx("section", { className: "rounded-2xl border border-border bg-card p-4 shadow-sm", children: _jsxs("div", { className: "max-w-xl", children: [_jsx(Label, { htmlFor: "capture-form-name", children: "Form name" }), _jsx(Input, { id: "capture-form-name", className: "mt-1", value: formName, onChange: (event) => setFormName(event.target.value) })] }) }), _jsxs("div", { className: "flex min-h-0 flex-1 gap-4", children: [_jsxs("section", { className: "flex min-h-0 min-w-0 flex-1 flex-col rounded-2xl border border-border bg-card shadow-sm", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-border px-4 py-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LayoutPanelTop, { className: "h-4 w-4 text-primary" }), _jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Vertical form canvas" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Fields render in respondent order. Add fields from the sidebar; tune details in the right panel." })] })] }), _jsxs("span", { className: "rounded-full bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground", children: [fields.length, " field", fields.length === 1 ? "" : "s"] })] }), _jsx("div", { className: cn("m-4 flex min-h-[560px] flex-1 flex-col gap-3 rounded-2xl border border-dashed border-border bg-muted/25 p-4 transition", isDragOver && "border-primary bg-primary/5 ring-2 ring-primary/20"), onDragEnter: handleDragOver, onDragOver: handleDragOver, onDragLeave: () => setIsDragOver(false), onDrop: handleDrop, "data-testid": "capture-builder-canvas", children: fields.length === 0 ? (_jsxs("div", { className: "flex flex-1 flex-col items-center justify-center rounded-xl border border-dashed border-border bg-background/80 p-8 text-center", children: [_jsx(Plus, { className: "mb-3 h-8 w-8 text-muted-foreground" }), _jsx("h4", { className: "text-sm font-semibold text-foreground", children: "Add the first form field" }), _jsx("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: "Use the sidebar palette to add Capture-owned or contributed fields to the public form body." })] })) : (fields.map((field, index) => (_jsxs("button", { type: "button", onClick: () => { setSelectedId(field.id); setActivePanel("inspector"); setDetailsOpen(true); }, className: cn("flex items-start gap-3 rounded-xl border bg-background p-4 text-left shadow-sm transition", selectedId === field.id
|
|
179
|
+
? "border-primary ring-2 ring-primary/20"
|
|
180
|
+
: "border-border hover:border-primary/50"), children: [_jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground", children: index + 1 }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [field.label, _jsx("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary", children: getCaptureFieldType(field.type, fieldTypes).label }), field.required && _jsx("span", { className: "text-xs text-destructive", children: "Required" }), field.visibleWhen && _jsx("span", { className: "text-xs text-muted-foreground", children: "Conditional" })] }), _jsxs("span", { className: "mt-1 block text-sm text-muted-foreground", children: ["Key: ", field.key] })] })] }, field.id)))) })] }), _jsx(TabbedPanel, { open: detailsOpen, onClose: () => setDetailsOpen(false), tabs: FORM_PANEL_TABS, activeTab: activePanel, onTabChange: setActivePanel, width: "380px", inline: true, flush: true, className: "self-stretch rounded-2xl border shadow-sm", header: _jsxs("div", { className: "border-b border-border px-4 py-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: FORM_PANEL_TABS.find((tab) => tab.id === activePanel)?.label }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Builder context and selected-field controls." })] }), children: _jsx(FormDetailsPanel, { activePanel: activePanel, fields: fields, fieldTypes: fieldTypes, selectedField: selectedField, selectedId: selectedId, setSelectedId: (fieldId) => { setSelectedId(fieldId); setActivePanel("inspector"); }, updateSelectedField: updateSelectedField, submissions: definitionSubmissions, actionConfig: actionConfig, workflows: workflowsQuery.data ?? [], setActionConfig: setActionConfig }) })] })] })) })] }));
|
|
181
|
+
}
|
|
182
|
+
function CaptureBuilderSidebar({ definitions, currentId, fields, fieldTypes, publicationSlug, onOpen, onCreate, onApplyTemplate, onInsertField, onDragStart, onSave, onPublish, }) {
|
|
183
|
+
const navigate = useNavigate();
|
|
184
|
+
const sl = useScopeLink();
|
|
185
|
+
const currentDefinition = definitions.find((definition) => definition.id === currentId);
|
|
186
|
+
const itemClass = (active) => `w-full flex items-center gap-2.5 px-3 py-1.5 rounded-lg text-sm transition-colors ${active
|
|
187
|
+
? "bg-muted text-foreground font-medium"
|
|
188
|
+
: "text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`;
|
|
189
|
+
return (_jsx(SidebarPortal, { children: _jsxs("div", { className: "flex h-full flex-col", children: [_jsxs("div", { className: "flex-1 overflow-y-auto px-3 py-2", children: [_jsxs("div", { children: [_jsx("div", { className: "px-3 mb-1", children: _jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider text-primary", children: "Navigate" }) }), _jsxs("div", { className: "space-y-0.5", children: [_jsxs("button", { type: "button", className: itemClass(true), onClick: () => currentId ? onOpen(currentId) : undefined, children: [_jsx(FileText, { className: "h-4 w-4 shrink-0" }), _jsx("span", { className: "flex-1 text-left", children: "Forms" })] }), _jsxs("button", { type: "button", className: itemClass(false), onClick: () => void navigate({ to: sl("/capture/quizzes/builder") }), children: [_jsx(Sparkles, { className: "h-4 w-4 shrink-0" }), _jsx("span", { className: "flex-1 text-left", children: "Quizzes" })] }), _jsxs("button", { type: "button", className: itemClass(false), onClick: () => void navigate({ to: sl("/capture/submissions") }), children: [_jsx(Inbox, { className: "h-4 w-4 shrink-0" }), _jsx("span", { className: "flex-1 text-left", children: "Submissions" })] })] })] }), _jsx("div", { className: "my-3 border-t border-border" }), currentId && (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-3 mb-1", children: [_jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider text-primary", children: "Current Form" }), _jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: fields.length })] }), _jsxs("div", { className: "rounded-lg bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: [_jsx("p", { className: "font-medium text-foreground", children: currentDefinition?.name ?? "Untitled form" }), _jsxs("p", { className: "mt-1", children: [currentDefinition?.status ?? "draft", publicationSlug ? ` · /forms/${publicationSlug}` : ""] })] })] })), definitions.length > 0 && (_jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "flex items-center justify-between px-3 mb-1", children: [_jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider text-primary", children: "Capture Items" }), _jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: definitions.length })] }), _jsx("div", { className: "space-y-0.5", children: definitions.map((definition) => (_jsxs("button", { type: "button", className: itemClass(definition.id === currentId), onClick: () => onOpen(definition.id), children: [definition.surface === "quiz" ? _jsx(Sparkles, { className: "h-3.5 w-3.5 shrink-0" }) : _jsx(FileText, { className: "h-3.5 w-3.5 shrink-0" }), _jsxs("span", { className: "min-w-0 flex-1 text-left", children: [_jsx("span", { className: "block truncate", children: definition.name }), _jsx("span", { className: "block text-[11px] capitalize text-muted-foreground", children: definition.surface })] })] }, definition.id))) })] })), currentId && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mt-4", children: [_jsx("div", { className: "px-3 mb-1", children: _jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider text-primary", children: "Templates" }) }), _jsx("div", { className: "space-y-1", children: CAPTURE_FORM_TEMPLATES.map((template) => (_jsxs("button", { type: "button", onClick: () => onApplyTemplate(template.id), className: "w-full rounded-lg px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground", children: [_jsx("span", { className: "block font-medium", children: template.label }), _jsx("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: template.description })] }, template.id))) })] }), _jsxs("div", { className: "mt-4", children: [_jsx("div", { className: "px-3 mb-1", children: _jsx("span", { className: "text-[11px] font-semibold uppercase tracking-wider text-primary", children: "Palette" }) }), _jsx("div", { className: "space-y-1", children: fieldTypes.map((tile) => {
|
|
190
|
+
const Icon = FIELD_ICON_MAP[tile.icon] ?? Type;
|
|
191
|
+
return (_jsxs("button", { type: "button", draggable: true, onClick: () => onInsertField(tile), onDragStart: (event) => onDragStart(event, tile), className: "group flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground", children: [_jsx(Icon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block text-sm font-medium", children: tile.label }), _jsx("span", { className: "block text-xs text-muted-foreground", children: tile.description })] }), _jsx(GripVertical, { className: "mt-0.5 h-3.5 w-3.5 opacity-40 transition group-hover:opacity-80" })] }, tile.id));
|
|
192
|
+
}) })] })] }))] }), _jsxs("div", { className: "space-y-1.5 border-t border-border px-3 py-3", children: [currentId && (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "w-full justify-center", onClick: onSave, children: [_jsx(Save, { className: "h-4 w-4" }), "Save"] }), _jsxs(Button, { type: "button", size: "sm", className: "w-full justify-center", onClick: onPublish, children: [_jsx(Send, { className: "h-4 w-4" }), "Publish"] })] })), _jsxs(Button, { type: "button", variant: currentId ? "ghost" : "default", size: "sm", className: "w-full justify-center", onClick: onCreate, children: [_jsx(Plus, { className: "h-4 w-4" }), "New form"] })] })] }) }));
|
|
193
|
+
}
|
|
194
|
+
function FormDetailsPanel({ activePanel, fields, fieldTypes, selectedField, selectedId, setSelectedId, updateSelectedField, submissions, actionConfig, workflows, setActionConfig, }) {
|
|
195
|
+
if (activePanel === "outline") {
|
|
196
|
+
return (_jsx("div", { className: "p-3", children: fields.length === 0 ? _jsx(EmptyPanelText, { children: "No form fields yet." }) : (_jsx("div", { className: "space-y-1", children: fields.map((field, index) => (_jsxs("button", { type: "button", onClick: () => setSelectedId(field.id), className: cn("flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm transition", selectedId === field.id
|
|
197
|
+
? "bg-muted text-foreground"
|
|
198
|
+
: "text-muted-foreground hover:bg-muted/60 hover:text-foreground"), children: [_jsx("span", { className: "text-xs font-semibold tabular-nums", children: index + 1 }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: field.label }), _jsx("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: getCaptureFieldType(field.type, fieldTypes).label })] }, field.id))) })) }));
|
|
199
|
+
}
|
|
200
|
+
if (activePanel === "inspector") {
|
|
201
|
+
return (_jsx("div", { className: "p-3", children: selectedField ? (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "field-label", children: "Label" }), _jsx(Input, { id: "field-label", value: selectedField.label, onChange: (event) => updateSelectedField({ label: event.target.value }) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "field-key", children: "Key" }), _jsx(Input, { id: "field-key", value: selectedField.key, onChange: (event) => updateSelectedField({ key: event.target.value }) })] }), _jsxs("div", { className: "flex items-center justify-between gap-3 rounded-lg border border-border p-2", children: [_jsx("span", { className: "text-sm text-muted-foreground", children: "Required respondent answer" }), _jsx(Switch, { checked: selectedField.required, onCheckedChange: (checked) => updateSelectedField({ required: checked }) })] }), _jsxs("div", { className: "space-y-2 rounded-lg border border-border p-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-sm text-muted-foreground", children: "Show condition" }), _jsx(Switch, { checked: Boolean(selectedField.visibleWhen), onCheckedChange: (checked) => {
|
|
202
|
+
const source = fields.find((field) => field.id !== selectedField.id);
|
|
203
|
+
updateSelectedField({
|
|
204
|
+
visibleWhen: checked && source
|
|
205
|
+
? { fieldId: source.id, fieldKey: source.key, operator: "equals", value: "" }
|
|
206
|
+
: undefined,
|
|
207
|
+
});
|
|
208
|
+
}, disabled: fields.every((field) => field.id === selectedField.id) })] }), selectedField.visibleWhen && (_jsxs("div", { className: "space-y-2", children: [_jsx("select", { className: "h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", value: selectedField.visibleWhen.fieldId, onChange: (event) => {
|
|
209
|
+
const source = fields.find((field) => field.id === event.target.value);
|
|
210
|
+
if (!source)
|
|
211
|
+
return;
|
|
212
|
+
updateSelectedField({ visibleWhen: { ...selectedField.visibleWhen, fieldId: source.id, fieldKey: source.key } });
|
|
213
|
+
}, children: fields.filter((field) => field.id !== selectedField.id).map((field) => (_jsxs("option", { value: field.id, children: [field.label, " (", field.key, ")"] }, field.id))) }), _jsx(Input, { placeholder: "Show when answer equals\u2026", value: String(selectedField.visibleWhen.value ?? ""), onChange: (event) => updateSelectedField({ visibleWhen: { ...selectedField.visibleWhen, value: event.target.value } }) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Uses stable field ID plus key so future renames keep a fallback." })] }))] }), selectedField.type === "select" && (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "field-options", children: "Options, one per line" }), _jsx(Textarea, { id: "field-options", value: (selectedField.options ?? []).join("\n"), onChange: (event) => updateSelectedField({
|
|
214
|
+
options: event.target.value.split("\n").map((option) => option.trim()).filter(Boolean),
|
|
215
|
+
}) })] }))] })) : _jsx(EmptyPanelText, { children: "Select a field to edit its basics." }) }));
|
|
216
|
+
}
|
|
217
|
+
if (activePanel === "submissions") {
|
|
218
|
+
return _jsx("div", { className: "p-3", children: _jsx(SubmissionPreview, { submissions: submissions }) });
|
|
219
|
+
}
|
|
220
|
+
if (activePanel === "actions") {
|
|
221
|
+
return _jsx("div", { className: "p-3", children: _jsx(ActionsPanel, { fields: fields, config: actionConfig, workflows: workflows, onChange: setActionConfig }) });
|
|
222
|
+
}
|
|
223
|
+
return (_jsx("div", { className: "p-3", children: _jsxs("div", { className: "rounded-2xl border border-dashed border-border bg-muted/25 p-8 text-center", children: [_jsx(Send, { className: "mx-auto mb-3 h-8 w-8 text-muted-foreground" }), _jsxs("h3", { className: "text-sm font-semibold text-foreground", children: [activePanel === "publish" ? "Publish" : "Theme", " placeholder"] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Reserved for the next Capture builder refinement pass." })] }) }));
|
|
224
|
+
}
|
|
225
|
+
function StartPanel({ definitions, isLoading, search, selectedDefinition, activeDetailTab, onSelectDefinition, onCloseDetails, onDetailTabChange, onCreate, onOpen, }) {
|
|
226
|
+
const filteredDefinitions = useMemo(() => {
|
|
227
|
+
const query = search.trim().toLowerCase();
|
|
228
|
+
if (!query)
|
|
229
|
+
return definitions;
|
|
230
|
+
return definitions.filter((definition) => [definition.name, definition.surface, definition.status, definition.slug]
|
|
231
|
+
.some((value) => value.toLowerCase().includes(query)));
|
|
232
|
+
}, [definitions, search]);
|
|
233
|
+
const showEmptyState = !isLoading && definitions.length === 0;
|
|
234
|
+
const showNoResults = !isLoading && definitions.length > 0 && filteredDefinitions.length === 0;
|
|
235
|
+
return (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [showEmptyState && (_jsxs("div", { className: "flex flex-col items-center justify-center rounded-2xl border border-border bg-card py-20 text-center shadow-sm", children: [_jsx(Inbox, { className: "mb-4 h-12 w-12 text-muted-foreground/40" }), _jsx("h3", { className: "mb-1 text-sm font-semibold text-foreground", children: "No capture items yet" }), _jsx("p", { className: "mb-4 text-sm text-muted-foreground", children: "Create your first form to get started." }), _jsxs(Button, { onClick: onCreate, children: [_jsx(Plus, { className: "h-4 w-4" }), "Create your first form"] })] })), showNoResults && (_jsxs("div", { className: "flex flex-col items-center justify-center rounded-2xl border border-border bg-card py-20 text-center shadow-sm", children: [_jsx(Search, { className: "mb-3 h-10 w-10 text-muted-foreground/40" }), _jsx("h3", { className: "mb-1 text-sm font-semibold text-foreground", children: "No capture items match your search" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Try adjusting your search." })] })), isLoading && (_jsx("div", { className: "rounded-xl border border-border bg-card p-4 text-sm text-muted-foreground shadow-sm", children: "Loading capture items\u2026" })), !isLoading && filteredDefinitions.length > 0 && (_jsxs("div", { className: "flex min-h-0 flex-1 items-stretch gap-4", children: [_jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm", children: [_jsx("div", { className: "hidden min-h-0 flex-1 overflow-auto sm:block", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("th", { className: "px-5 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Name" }), _jsx("th", { className: "px-5 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Type" }), _jsx("th", { className: "px-5 py-3 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Status" }), _jsx("th", { className: "px-5 py-3 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Fields" }), _jsx("th", { className: "px-5 py-3 text-right text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Last Modified" })] }) }), _jsx("tbody", { className: "divide-y divide-border/50", children: filteredDefinitions.map((definition) => {
|
|
236
|
+
const SurfaceIcon = definition.surface === "quiz" ? Sparkles : FileText;
|
|
237
|
+
return (_jsxs("tr", { className: cn("cursor-pointer transition-colors hover:bg-muted/50", selectedDefinition?.id === definition.id && "bg-muted/60"), onClick: () => onSelectDefinition(definition), children: [_jsx("td", { className: "px-5 py-3.5", children: _jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10", children: _jsx(SurfaceIcon, { className: "h-4 w-4 text-primary" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-medium text-foreground", children: definition.name }), _jsxs("div", { className: "truncate text-xs text-muted-foreground", children: ["/", definition.slug] })] })] }) }), _jsx("td", { className: "px-5 py-3.5 text-sm capitalize text-muted-foreground", children: definition.surface }), _jsx("td", { className: "px-5 py-3.5", children: _jsx(CaptureStatusBadge, { status: definition.status }) }), _jsx("td", { className: "px-5 py-3.5 text-right text-sm tabular-nums text-muted-foreground", children: definition.fieldCount }), _jsx("td", { className: "px-5 py-3.5 text-right text-sm whitespace-nowrap text-muted-foreground", children: formatRelativeTime(definition.updatedAt ?? definition.createdAt ?? new Date()) })] }, definition.id));
|
|
238
|
+
}) })] }) }), _jsx("div", { className: "min-h-0 flex-1 divide-y divide-border/50 overflow-auto sm:hidden", children: filteredDefinitions.map((definition) => {
|
|
239
|
+
const SurfaceIcon = definition.surface === "quiz" ? Sparkles : FileText;
|
|
240
|
+
return (_jsxs("button", { type: "button", onClick: () => onSelectDefinition(definition), className: "flex w-full items-center gap-3 px-4 py-3 text-left active:bg-muted/50", children: [_jsx("span", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10", children: _jsx(SurfaceIcon, { className: "h-4 w-4 text-primary" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-sm font-medium text-foreground", children: definition.name }), _jsxs("span", { className: "block text-xs capitalize text-muted-foreground", children: [definition.surface, " \u00B7 ", definition.fieldCount, " fields \u00B7 ", definition.status] })] })] }, definition.id));
|
|
241
|
+
}) })] }), _jsx(TabbedPanel, { open: selectedDefinition != null, onClose: onCloseDetails, tabs: CAPTURE_LIST_PANEL_TABS, activeTab: activeDetailTab, onTabChange: onDetailTabChange, width: "380px", inline: true, flush: true, className: "self-stretch rounded-xl border shadow-sm", header: selectedDefinition ? (_jsxs("div", { className: "border-b border-border px-4 py-3", children: [_jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: selectedDefinition.name }), _jsxs("p", { className: "mt-1 text-xs capitalize text-muted-foreground", children: [selectedDefinition.surface, " \u00B7 ", selectedDefinition.status] })] })) : undefined, footer: selectedDefinition ? (_jsx("div", { className: "flex items-center justify-end gap-2 border-t border-border px-4 py-3", children: _jsx(Button, { size: "sm", onClick: () => onOpen(selectedDefinition.id), children: "Open builder" }) })) : undefined, children: selectedDefinition ? (_jsx(CaptureListDetailPanel, { definition: selectedDefinition, activeTab: activeDetailTab })) : null })] }))] }));
|
|
242
|
+
}
|
|
243
|
+
function CaptureListDetailPanel({ definition, activeTab, }) {
|
|
244
|
+
if (activeTab === "overview") {
|
|
245
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("div", { className: "rounded-xl border border-border bg-background p-3", children: [_jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Summary" }), _jsxs("dl", { className: "mt-3 grid gap-3 text-sm", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("dt", { className: "text-muted-foreground", children: "Type" }), _jsx("dd", { className: "font-medium capitalize text-foreground", children: definition.surface })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("dt", { className: "text-muted-foreground", children: "Status" }), _jsx("dd", { children: _jsx(CaptureStatusBadge, { status: definition.status }) })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("dt", { className: "text-muted-foreground", children: "Fields" }), _jsx("dd", { className: "font-medium tabular-nums text-foreground", children: definition.fieldCount })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("dt", { className: "text-muted-foreground", children: "Last modified" }), _jsx("dd", { className: "font-medium text-foreground", children: formatRelativeTime(definition.updatedAt ?? definition.createdAt ?? new Date()) })] })] })] }), _jsxs("div", { className: "rounded-xl border border-border bg-background p-3", children: [_jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Slug" }), _jsxs("p", { className: "mt-2 break-all rounded-lg bg-muted/50 px-2 py-1.5 font-mono text-xs text-muted-foreground", children: ["/", definition.slug] })] })] }));
|
|
246
|
+
}
|
|
247
|
+
if (activeTab === "publish") {
|
|
248
|
+
return (_jsx("div", { className: "space-y-4 p-4", children: _jsxs("div", { className: "rounded-xl border border-border bg-background p-3", children: [_jsx("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Publication" }), definition.publicationSlug ? (_jsxs("p", { className: "mt-2 break-all text-sm text-foreground", children: ["/", definition.surface === "quiz" ? "quizzes" : "forms", "/", definition.publicationSlug] })) : (_jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "This capture item has not been published yet." }))] }) }));
|
|
249
|
+
}
|
|
250
|
+
if (activeTab === "submissions") {
|
|
251
|
+
return (_jsx("div", { className: "p-4", children: _jsxs("div", { className: "rounded-xl border border-dashed border-border bg-muted/25 p-6 text-center", children: [_jsx(Inbox, { className: "mx-auto mb-3 h-8 w-8 text-muted-foreground" }), _jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Submission rollup" }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Submission counts and recent responses will live here once the list endpoint returns per-item metrics." })] }) }));
|
|
252
|
+
}
|
|
253
|
+
return (_jsx("div", { className: "p-4", children: _jsxs("div", { className: "rounded-xl border border-dashed border-border bg-muted/25 p-6 text-center", children: [_jsx(GitBranch, { className: "mx-auto mb-3 h-8 w-8 text-muted-foreground" }), _jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Actions overview" }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Action health, workflow hooks, and destination status will be summarized here." })] }) }));
|
|
254
|
+
}
|
|
255
|
+
function CaptureStatusBadge({ status }) {
|
|
256
|
+
const isPublished = status === "published";
|
|
257
|
+
return (_jsx("span", { className: cn("inline-block rounded-full px-1.5 py-0.5 text-[10px] font-medium capitalize", isPublished ? "bg-success/10 text-success-foreground" : "bg-muted text-muted-foreground"), children: status }));
|
|
258
|
+
}
|
|
259
|
+
function ActionsPanel({ fields, config, workflows, onChange, }) {
|
|
260
|
+
const contacts = config.contacts ?? { enabled: false, customFieldMappings: {} };
|
|
261
|
+
const email = config.email ?? { enabled: false, subjectTemplate: "New Capture submission", bodyTemplate: "A new Capture submission was received.\n\n{{answers}}" };
|
|
262
|
+
const workflow = config.workflow ?? { enabled: false, execute: true };
|
|
263
|
+
const customMappingsText = Object.entries(contacts.customFieldMappings ?? {})
|
|
264
|
+
.map(([contactField, answerField]) => `${contactField}=${answerField}`)
|
|
265
|
+
.join("\n");
|
|
266
|
+
const patchContacts = (patch) => {
|
|
267
|
+
onChange({ ...config, contacts: { ...contacts, ...patch } });
|
|
268
|
+
};
|
|
269
|
+
const patchEmail = (patch) => {
|
|
270
|
+
onChange({ ...config, email: { ...email, ...patch } });
|
|
271
|
+
};
|
|
272
|
+
const patchWorkflow = (patch) => {
|
|
273
|
+
onChange({ ...config, workflow: { ...workflow, ...patch } });
|
|
274
|
+
};
|
|
275
|
+
const selectedWorkflow = workflows.find((candidate) => candidate.id === workflow.workflowDefinitionId);
|
|
276
|
+
const workflowPreview = {
|
|
277
|
+
event: "capture.submission.completed",
|
|
278
|
+
submission: {
|
|
279
|
+
definitionName: "Current form",
|
|
280
|
+
answers: Object.fromEntries(fields.map((field) => [field.key, `<${field.label}>`])),
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("section", { className: "rounded-2xl border border-border bg-card p-4 shadow-sm", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Contacts create/update action" }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "After a public submission is stored, map answers into Contacts. Failures are recorded as action runs without deleting the canonical submission." })] }), _jsx(Switch, { checked: contacts.enabled, onCheckedChange: (enabled) => patchContacts({ enabled }) })] }), _jsxs("div", { className: "mt-4 grid gap-4 md:grid-cols-3", children: [_jsx(FieldSelect, { label: "Name answer", value: contacts.nameFieldKey ?? "", fields: fields, onChange: (nameFieldKey) => patchContacts({ nameFieldKey }) }), _jsx(FieldSelect, { label: "Email answer", value: contacts.emailFieldKey ?? "", fields: fields, onChange: (emailFieldKey) => patchContacts({ emailFieldKey }) }), _jsx(FieldSelect, { label: "Phone answer", value: contacts.phoneFieldKey ?? "", fields: fields, onChange: (phoneFieldKey) => patchContacts({ phoneFieldKey }) })] }), _jsxs("div", { className: "mt-4 space-y-2", children: [_jsx(Label, { htmlFor: "contact-custom-field-mappings", children: "Custom field mappings" }), _jsx(Textarea, { id: "contact-custom-field-mappings", placeholder: "contact_custom_slug=capture_field_key\nlead_source=source_field", value: customMappingsText, onChange: (event) => {
|
|
284
|
+
const customFieldMappings = {};
|
|
285
|
+
for (const line of event.target.value.split("\n")) {
|
|
286
|
+
const [contactField, answerField] = line.split("=").map((part) => part?.trim());
|
|
287
|
+
if (contactField && answerField)
|
|
288
|
+
customFieldMappings[contactField] = answerField;
|
|
289
|
+
}
|
|
290
|
+
patchContacts({ customFieldMappings });
|
|
291
|
+
} }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Use one mapping per line: Contacts custom field slug/key on the left, Capture field key on the right. Quiz virtual keys include outcome.label, outcome.key, outcome.bucket, and outcome.score." })] })] }), _jsxs("section", { className: "rounded-2xl border border-border bg-card p-4 shadow-sm", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Email action" }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Send an operator email, respondent email, or both after the canonical submission is stored. Templates can include outcomeLabel, outcomeBucket, and outcomeScore." })] }), _jsx(Switch, { checked: email.enabled, onCheckedChange: (enabled) => patchEmail({ enabled }) })] }), _jsxs("div", { className: "mt-4 grid gap-4 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "capture-email-from", children: "From override" }), _jsx(Input, { id: "capture-email-from", placeholder: "Forms <forms@example.com>", value: email.from ?? "", onChange: (event) => patchEmail({ from: event.target.value || undefined }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "capture-email-internal", children: "Operator recipient" }), _jsx(Input, { id: "capture-email-internal", type: "email", placeholder: "ops@example.com", value: email.internalRecipientEmail ?? "", onChange: (event) => patchEmail({ internalRecipientEmail: event.target.value || undefined }) })] }), _jsx(FieldSelect, { label: "Respondent email answer", value: email.respondentEmailFieldKey ?? "", fields: fields, onChange: (respondentEmailFieldKey) => patchEmail({ respondentEmailFieldKey }) }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "capture-email-subject", children: "Subject template" }), _jsx(Input, { id: "capture-email-subject", value: email.subjectTemplate ?? "", onChange: (event) => patchEmail({ subjectTemplate: event.target.value || undefined }) })] })] }), _jsxs("div", { className: "mt-4 space-y-2", children: [_jsx(Label, { htmlFor: "capture-email-body", children: "Body template" }), _jsx(Textarea, { id: "capture-email-body", value: email.bodyTemplate ?? "", onChange: (event) => patchEmail({ bodyTemplate: event.target.value || undefined }) }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Template tokens can reference field keys like ", "{{email_ab12}}", "; ", "{{answers}}", " inserts all answers."] })] })] }), _jsxs("section", { className: "rounded-2xl border border-border bg-card p-4 shadow-sm", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(GitBranch, { className: "h-4 w-4 text-primary" }), _jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Workflow trigger action" })] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Start a current-scope workflow after submission. API trigger-compatible workflows receive answers plus quiz outcome summary." })] }), _jsx(Switch, { checked: workflow.enabled, onCheckedChange: (enabled) => patchWorkflow({ enabled }) })] }), _jsxs("div", { className: "mt-4 grid gap-4 md:grid-cols-[minmax(0,1fr)_220px]", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Workflow definition" }), _jsxs("select", { className: "h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", value: workflow.workflowDefinitionId ?? "", onChange: (event) => {
|
|
292
|
+
const next = workflows.find((candidate) => candidate.id === event.target.value);
|
|
293
|
+
patchWorkflow({
|
|
294
|
+
workflowDefinitionId: next?.id,
|
|
295
|
+
triggerNodeId: next?.apiTriggerNodeId,
|
|
296
|
+
});
|
|
297
|
+
}, children: [_jsx("option", { value: "", children: "Select workflow\u2026" }), workflows.map((candidate) => (_jsxs("option", { value: candidate.id, children: [candidate.name, " \u00B7 ", candidate.compatible ? "API trigger" : "not API-ready"] }, candidate.id)))] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3 rounded-lg border border-border p-3", children: [_jsx("span", { className: "text-sm text-muted-foreground", children: "Execute immediately" }), _jsx(Switch, { checked: workflow.execute ?? true, onCheckedChange: (execute) => patchWorkflow({ execute }) })] })] }), _jsxs("div", { className: "mt-4 grid gap-4 lg:grid-cols-2", children: [_jsxs("div", { className: "rounded-xl border border-border bg-background p-3", children: [_jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Compatibility" }), _jsx("p", { className: cn("mt-2 text-sm", selectedWorkflow?.compatible ? "text-foreground" : "text-destructive"), children: selectedWorkflow?.summary ?? "Select a workflow to inspect trigger compatibility." }), selectedWorkflow && (_jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: ["Version ", selectedWorkflow.currentVersion, " \u00B7 Status ", selectedWorkflow.status, " \u00B7 Triggers ", selectedWorkflow.triggerTypes.join(", ") || "none"] }))] }), _jsxs("div", { className: "rounded-xl border border-border bg-muted/30 p-3", children: [_jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Payload preview" }), _jsx("pre", { className: "mt-2 max-h-48 overflow-auto rounded-lg bg-background p-2 text-xs text-muted-foreground", children: JSON.stringify(workflowPreview, null, 2) })] })] })] })] }));
|
|
298
|
+
}
|
|
299
|
+
function FieldSelect({ label, value, fields, onChange, }) {
|
|
300
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: label }), _jsxs("select", { className: "h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", value: value, onChange: (event) => onChange(event.target.value || undefined), children: [_jsx("option", { value: "", children: "Not mapped" }), fields.map((field) => _jsxs("option", { value: field.key, children: [field.label, " (", field.key, ")"] }, field.id))] })] }));
|
|
301
|
+
}
|
|
302
|
+
function SubmissionPreview({ submissions }) {
|
|
303
|
+
return (_jsxs("div", { className: "rounded-2xl border border-border bg-card shadow-sm", children: [_jsx("div", { className: "border-b border-border px-4 py-3", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Inbox, { className: "h-4 w-4 text-primary" }), _jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Recent submissions" })] }) }), submissions.length === 0 ? (_jsx("p", { className: "p-4 text-sm text-muted-foreground", children: "No public form submissions yet." })) : (_jsx("div", { className: "divide-y divide-border", children: submissions.map((submission) => (_jsxs("div", { className: "p-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-sm font-semibold text-foreground", children: submission.definitionName }), _jsx("p", { className: "text-xs text-muted-foreground", children: new Date(submission.submittedAt).toLocaleString() })] }), submission.actionStatus && (_jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: ["Contacts action: ", submission.actionStatus, submission.contactId ? ` · Contact ${submission.contactId}` : ""] })), _jsx("dl", { className: "mt-2 grid gap-2 sm:grid-cols-2", children: Object.entries(submission.answers).map(([key, value]) => (_jsxs("div", { className: "rounded-lg bg-muted/50 p-2 text-xs", children: [_jsx("dt", { className: "font-semibold text-muted-foreground", children: key }), _jsx("dd", { className: "mt-0.5 text-foreground", children: String(value ?? "—") })] }, key))) })] }, submission.id))) }))] }));
|
|
304
|
+
}
|
|
305
|
+
function EmptyPanelText({ children }) {
|
|
306
|
+
return _jsx("p", { className: "rounded-xl bg-muted/40 p-3 text-sm text-muted-foreground", children: children });
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=CaptureBuilderPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptureBuilderPage.js","sourceRoot":"","sources":["../../../../src/client/pages/CaptureBuilderPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkC,MAAM,OAAO,CAAA;AACjG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EACL,SAAS,EACT,YAAY,EACZ,GAAG,EACH,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,GACL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,WAA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EAAC,oCAAoC,aAC3D,aAAI,SAAS,EAAC,qCAAqC,YAAE,GAAG,GAAM,EAC9D,aAAI,SAAS,EAAC,wBAAwB,YAAE,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,GAAM,KAF1D,GAAG,CAGP,CACP,CAAC,GACC,KAjBG,UAAU,CAAC,EAAE,CAkBjB,CACP,CAAC,GACE,CACP,IACG,CACP,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,QAAQ,EAA2B;IAC3D,OAAO,YAAG,SAAS,EAAC,0DAA0D,YAAE,QAAQ,GAAK,CAAA;AAC/F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaptureSubmissionDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/client/pages/CaptureSubmissionDetailPage.tsx"],"names":[],"mappings":"AAUA,wBAAgB,2BAA2B,4CA2H1C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Link, useParams } from "@tanstack/react-router";
|
|
3
|
+
import { AlertCircle, ArrowLeft, CheckCircle2, Clock, FileText, Inbox, RotateCcw, XCircle } from "lucide-react";
|
|
4
|
+
import { useMutation, useQuery, useQueryClient } from "@ydtb/tk-scope-query-client";
|
|
5
|
+
import { Button } from "@ydtb/tk-scope-ui/components/button";
|
|
6
|
+
import { toast } from "@ydtb/tk-scope-ui/components/sonner";
|
|
7
|
+
import { HeaderPortal, useScopeLink } from "@ydtb/tk-scope/client";
|
|
8
|
+
import { ToolPageHeader } from "@ydtb/tk-scope-shell";
|
|
9
|
+
import { captureApi } from "../../client.js";
|
|
10
|
+
export function CaptureSubmissionDetailPage() {
|
|
11
|
+
const { id } = useParams({ strict: false });
|
|
12
|
+
const sl = useScopeLink();
|
|
13
|
+
const queryClient = useQueryClient();
|
|
14
|
+
const submissionQuery = useQuery(captureApi.submissions.get.queryOptions({ input: { id } }));
|
|
15
|
+
const submission = submissionQuery.data;
|
|
16
|
+
const retryMutation = useMutation(captureApi.submissions.retryAction.mutationOptions({
|
|
17
|
+
onSuccess: () => {
|
|
18
|
+
toast.success("Action attempt queued");
|
|
19
|
+
void queryClient.invalidateQueries({ queryKey: captureApi.submissions.key() });
|
|
20
|
+
},
|
|
21
|
+
onError: () => toast.error("Failed to retry action"),
|
|
22
|
+
}));
|
|
23
|
+
const retryAction = (runId, mode) => {
|
|
24
|
+
const reason = window.prompt(mode === "replay" ? "Reason for audited replay?" : "Reason for retry?")?.trim();
|
|
25
|
+
if (!reason)
|
|
26
|
+
return;
|
|
27
|
+
const confirmReplay = mode === "replay"
|
|
28
|
+
? window.confirm("Replay will use a new idempotency key and may duplicate downstream side effects. Continue?")
|
|
29
|
+
: false;
|
|
30
|
+
if (mode === "replay" && !confirmReplay)
|
|
31
|
+
return;
|
|
32
|
+
retryMutation.mutate({ actionRunId: runId, mode, reason, confirmReplay });
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeaderPortal, { children: _jsx(ToolPageHeader, { title: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Link, { to: sl("/capture/submissions"), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsx("span", { className: "text-lg font-bold text-foreground", children: "Submission detail" })] }), description: submission ? `${submission.definitionName} · ${new Date(submission.submittedAt).toLocaleString()}` : "Loading submission" }) }), _jsx("main", { className: "grid gap-4 p-4 sm:p-6 xl:grid-cols-[minmax(0,1fr)_360px]", children: submissionQuery.isLoading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Loading submission\u2026" })) : !submission ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Submission not found." })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("section", { className: "rounded-2xl border border-border bg-card shadow-sm", children: [_jsx(SectionHeader, { icon: Inbox, title: "Normalized answers", description: "Rows from capture_answers." }), _jsx("div", { className: "grid gap-3 p-4 sm:grid-cols-2", children: submission.normalizedAnswers.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "No normalized answers recorded." })) : submission.normalizedAnswers.map((answer) => (_jsxs("div", { className: "rounded-xl border border-border bg-background p-3", children: [_jsx("p", { className: "text-xs font-semibold text-muted-foreground", children: answer.fieldKey }), _jsx("p", { className: "mt-1 text-sm text-foreground", children: String(answer.value ?? "—") }), _jsxs("p", { className: "mt-2 text-[11px] text-muted-foreground", children: ["Field ID: ", answer.fieldId] })] }, answer.id))) })] }), _jsxs("section", { className: "rounded-2xl border border-border bg-card shadow-sm", children: [_jsx(SectionHeader, { icon: FileText, title: "Original submission snapshot", description: "Definition fields and answer payload captured at submit time." }), _jsxs("div", { className: "space-y-4 p-4", children: [_jsx(MetaGrid, { entries: [
|
|
35
|
+
["Snapshot definition", submission.snapshot.definitionId],
|
|
36
|
+
["Snapshot title", submission.snapshot.title],
|
|
37
|
+
["Field count", String(submission.snapshot.fields.length)],
|
|
38
|
+
] }), _jsx("pre", { className: "max-h-[360px] overflow-auto rounded-xl bg-muted/50 p-3 text-xs text-foreground", children: JSON.stringify(submission.snapshot, null, 2) })] })] })] }), _jsxs("aside", { className: "space-y-4", children: [_jsxs("section", { className: "rounded-2xl border border-border bg-card shadow-sm", children: [_jsx(SectionHeader, { icon: Clock, title: "Submission metadata", description: "Source, respondent, and publication context." }), _jsxs("div", { className: "space-y-4 p-4", children: [_jsx(MetaGrid, { entries: [
|
|
39
|
+
["Submission ID", submission.id],
|
|
40
|
+
["Definition ID", submission.definitionId],
|
|
41
|
+
["Publication ID", submission.publicationId ?? "—"],
|
|
42
|
+
["Publication slug", submission.publicationSlug ?? "—"],
|
|
43
|
+
["Source", submission.source],
|
|
44
|
+
["Submitted", new Date(submission.submittedAt).toLocaleString()],
|
|
45
|
+
] }), _jsxs("div", { children: [_jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Respondent metadata" }), _jsx("pre", { className: "mt-2 max-h-[180px] overflow-auto rounded-xl bg-muted/50 p-3 text-xs text-foreground", children: JSON.stringify(submission.respondent, null, 2) })] })] })] }), _jsxs("section", { className: "rounded-2xl border border-border bg-card shadow-sm", children: [_jsx(SectionHeader, { icon: CheckCircle2, title: "Action history", description: "Internal action runs and errors are admin-only." }), _jsx("div", { className: "space-y-3 p-4", children: submission.actionRuns.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "No action runs recorded." })) : submission.actionRuns.map((run) => (_jsx(ActionRunCard, { run: run, isRetrying: retryMutation.isPending, onRetry: () => retryAction(run.id, "retry"), onReplay: () => retryAction(run.id, "replay") }, run.id))) })] })] })] })) })] }));
|
|
46
|
+
}
|
|
47
|
+
function SectionHeader({ icon: Icon, title, description, }) {
|
|
48
|
+
return (_jsxs("div", { className: "border-b border-border px-4 py-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { className: "h-4 w-4 text-primary" }), _jsx("h2", { className: "text-sm font-semibold text-foreground", children: title })] }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: description })] }));
|
|
49
|
+
}
|
|
50
|
+
function MetaGrid({ entries }) {
|
|
51
|
+
return (_jsx("dl", { className: "grid gap-2", children: entries.map(([label, value]) => (_jsxs("div", { className: "rounded-lg bg-muted/40 p-2", children: [_jsx("dt", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }), _jsx("dd", { className: "mt-0.5 break-all text-sm text-foreground", children: value })] }, label))) }));
|
|
52
|
+
}
|
|
53
|
+
function ActionRunCard({ run, isRetrying, onRetry, onReplay, }) {
|
|
54
|
+
const Icon = run.status === "succeeded" ? CheckCircle2 : run.status === "failed" ? XCircle : AlertCircle;
|
|
55
|
+
const tone = run.status === "succeeded" ? "text-emerald-600" : run.status === "failed" ? "text-destructive" : "text-muted-foreground";
|
|
56
|
+
const canRetry = run.status === "failed" || run.status === "skipped";
|
|
57
|
+
return (_jsxs("article", { className: "rounded-xl border border-border bg-background p-3", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { className: `h-4 w-4 ${tone}` }), _jsx("h3", { className: "text-sm font-semibold text-foreground", children: run.actionType })] }), canRetry && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { size: "sm", variant: "outline", type: "button", disabled: isRetrying, onClick: onRetry, children: [_jsx(RotateCcw, { className: "h-3.5 w-3.5" }), "Retry"] }), _jsx(Button, { size: "sm", variant: "secondary", type: "button", disabled: isRetrying, onClick: onReplay, children: "Replay" })] }))] }), _jsx(MetaGrid, { entries: [
|
|
58
|
+
["Status", run.status],
|
|
59
|
+
["Contact ID", run.contactId ?? "—"],
|
|
60
|
+
["Created", new Date(run.createdAt).toLocaleString()],
|
|
61
|
+
["Updated", new Date(run.updatedAt).toLocaleString()],
|
|
62
|
+
] }), run.error && (_jsx("div", { className: "mt-3 rounded-lg bg-destructive/10 p-2 text-xs text-destructive", children: run.error.message })), run.result && (_jsx("pre", { className: "mt-3 max-h-[160px] overflow-auto rounded-lg bg-muted/50 p-2 text-xs text-foreground", children: JSON.stringify(run.result, null, 2) })), run.manualAttempts && run.manualAttempts.length > 0 && (_jsxs("div", { className: "mt-3 rounded-lg border border-border bg-muted/30 p-2", children: [_jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Manual attempts" }), _jsx("div", { className: "mt-2 space-y-2", children: run.manualAttempts.map((attempt) => (_jsxs("div", { className: "rounded-md bg-background p-2 text-xs", children: [_jsxs("p", { className: "font-medium text-foreground", children: [attempt.mode, " \u00B7 ", attempt.idempotencyKeyMode, " idempotency \u00B7 ", new Date(attempt.attemptedAt).toLocaleString()] }), _jsxs("p", { className: "mt-1 text-muted-foreground", children: ["Actor ", attempt.actorUserId, " \u00B7 ", attempt.reason] }), attempt.actionRunId && _jsxs("p", { className: "mt-1 text-muted-foreground", children: ["New run ", attempt.actionRunId] }), attempt.error && _jsx("p", { className: "mt-1 text-destructive", children: attempt.error.message })] }, `${attempt.attemptedAt}-${attempt.actionRunId ?? attempt.mode}`))) })] }))] }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=CaptureSubmissionDetailPage.js.map
|