@burdenoff/microfe-bigconsole 2026.1119.3 → 2026.1119.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +126 -80
- package/dist/bigconsole/components/parser/ParserSelector.js +150 -145
- package/dist/bigconsole/customWidget/CustomWidgetBuilderSheet.js +50 -49
- package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js +223 -201
- package/dist/bigconsole/customWidget/index.d.ts +2 -1
- package/dist/bigconsole/customWidget/index.js +1 -0
- package/dist/bigconsole/customWidget/proposalContract.d.ts +55 -1
- package/dist/bigconsole/customWidget/proposalContract.js +37 -14
- package/dist/bigconsole/customWidget/proposalPreviewData.d.ts +18 -0
- package/dist/bigconsole/customWidget/proposalPreviewData.js +70 -0
- package/dist/bigconsole/customWidget/proposalSource.d.ts +10 -0
- package/dist/bigconsole/customWidget/proposalSource.js +197 -51
- package/dist/bigconsole/graphql/storeTemplates.d.ts +1 -1
- package/dist/bigconsole/graphql/storeTemplates.js +5 -5
- package/dist/bigconsole/hooks/useParserOperations.js +80 -74
- package/dist/bigconsole/hooks/usePublishOwnerOptions.d.ts +10 -0
- package/dist/bigconsole/hooks/usePublishOwnerOptions.js +48 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.d.ts +8 -0
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js +3 -1
- package/dist/bigconsole/pages/ParserBuilderPage.js +540 -518
- package/dist/bigconsole/store/parserScope.d.ts +24 -0
- package/dist/bigconsole/store/parserScope.js +17 -0
- package/dist/bigconsole/store/parserStore.d.ts +3 -0
- package/dist/bigconsole/store/parserStore.js +70 -68
- package/dist/bigconsole/utils/publishOwner.d.ts +100 -0
- package/dist/bigconsole/utils/publishOwner.js +71 -0
- package/dist/generated/global-operations.d.ts +19 -0
- package/dist/generated/global-operations.js +80 -1
- package/dist/generated/wspace-operations.d.ts +10 -0
- package/dist/generated/wspace-operations.js +180 -110
- package/package.json +1 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { Section as e, SectionStack as t } from "../components/common/Section.js";
|
|
2
2
|
import { BigConsoleRenderer as n } from "../renderers/adapters/BigConsoleRenderer.js";
|
|
3
3
|
import { WidgetErrorBoundary as r } from "../components/widgets/WidgetErrorBoundary.js";
|
|
4
|
-
import { PROPOSABLE_WIDGET_TYPES as
|
|
5
|
-
import {
|
|
4
|
+
import { BINDING_NOTICE_CODES as i, PROPOSABLE_WIDGET_TYPES as a, derivePreviewState as ee, isProposableWidgetType as te, mappedFields as o, validateProposal as s, withoutNotices as c } from "./proposalContract.js";
|
|
5
|
+
import { describeProposalPreviewData as ne } from "./proposalPreviewData.js";
|
|
6
|
+
import { changeProposalWidgetType as re, localProposalSource as ie } from "./proposalSource.js";
|
|
6
7
|
import "../components/common/index.js";
|
|
7
|
-
import { memo as l, useCallback as u, useEffect as
|
|
8
|
-
import { AlertTriangle as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useI18n as
|
|
11
|
-
import { Fragment as
|
|
8
|
+
import { memo as l, useCallback as u, useEffect as ae, useMemo as d, useState as f } from "react";
|
|
9
|
+
import { AlertTriangle as oe, Check as se, Loader2 as p, RefreshCw as m, Sparkles as h, X as ce } from "lucide-react";
|
|
10
|
+
import { Button as g, Input as _, Label as v, Textarea as le } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
import { useI18n as ue } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
|
+
import { Fragment as de, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
12
13
|
// src/bigconsole/customWidget/CustomWidgetProposalPanel.tsx
|
|
13
|
-
var
|
|
14
|
+
var fe = "w-full", pe = {
|
|
14
15
|
loading: "neutral",
|
|
15
16
|
valid: "neutral",
|
|
16
17
|
"no-data": "warning",
|
|
17
18
|
"field-mismatch": "warning",
|
|
18
19
|
"access-error": "danger"
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
+
function x(e, t) {
|
|
21
22
|
let n = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
22
23
|
return {
|
|
23
24
|
id: `preview-${e.id}`,
|
|
@@ -29,7 +30,7 @@ function ce(e, t) {
|
|
|
29
30
|
parserId: e.binding.parserId || null,
|
|
30
31
|
config: {
|
|
31
32
|
...e.presentation.config,
|
|
32
|
-
...e.fieldMapping
|
|
33
|
+
...o(e.fieldMapping)
|
|
33
34
|
},
|
|
34
35
|
position: {
|
|
35
36
|
x: 0,
|
|
@@ -45,262 +46,282 @@ function ce(e, t) {
|
|
|
45
46
|
updatedAt: n
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
let t = e.find((e) => e && typeof e == "object");
|
|
51
|
-
return t ? Object.keys(t) : [];
|
|
52
|
-
}
|
|
53
|
-
if (e && typeof e == "object") return Object.keys(e);
|
|
54
|
-
}
|
|
55
|
-
function C(e) {
|
|
56
|
-
if (Array.isArray(e)) return e.length;
|
|
57
|
-
if (e && typeof e == "object") {
|
|
58
|
-
let t = e.cells;
|
|
59
|
-
return Array.isArray(t) ? t.length : Object.keys(e).length;
|
|
60
|
-
}
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E, onClose: D, source: O = c }) {
|
|
64
|
-
let { t: k } = ie(), A = f(() => ({
|
|
49
|
+
var S = l(function({ sinks: o, parsers: l, resolvePreviewData: S, onApprove: C, onClose: w, source: T = ie }) {
|
|
50
|
+
let { t: E } = ue(), D = d(() => ({
|
|
65
51
|
loading: {
|
|
66
|
-
title:
|
|
67
|
-
body:
|
|
52
|
+
title: E("bigconsole.widget.customWidget.preview.loading.title", "Building preview…"),
|
|
53
|
+
body: E("bigconsole.widget.customWidget.preview.loading.body", "Reading the selected data binding.")
|
|
68
54
|
},
|
|
69
55
|
valid: {
|
|
70
|
-
title:
|
|
56
|
+
title: E("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
|
|
71
57
|
body: ""
|
|
72
58
|
},
|
|
73
59
|
"no-data": {
|
|
74
|
-
title:
|
|
75
|
-
body:
|
|
60
|
+
title: E("bigconsole.widget.customWidget.preview.noData.title", "No data returned"),
|
|
61
|
+
body: E("bigconsole.widget.customWidget.preview.noData.body", "The binding is valid but the data source returned no rows. The widget will render empty until the sink has data.")
|
|
76
62
|
},
|
|
77
63
|
"field-mismatch": {
|
|
78
|
-
title:
|
|
79
|
-
body:
|
|
64
|
+
title: E("bigconsole.widget.customWidget.preview.fieldMismatch.title", "Field mismatch"),
|
|
65
|
+
body: E("bigconsole.widget.customWidget.preview.fieldMismatch.body", "Some mapped fields are not present in the parser output. Fix the mapping below before approving.")
|
|
80
66
|
},
|
|
81
67
|
"access-error": {
|
|
82
|
-
title:
|
|
83
|
-
body:
|
|
68
|
+
title: E("bigconsole.widget.customWidget.preview.accessError.title", "Cannot read this data"),
|
|
69
|
+
body: E("bigconsole.widget.customWidget.preview.accessError.body", "You do not have access to the proposed DataSink or parser in this workspace.")
|
|
84
70
|
}
|
|
85
|
-
}), [
|
|
86
|
-
permittedDataSinkIds:
|
|
87
|
-
permittedParserIds:
|
|
88
|
-
availableFields:
|
|
71
|
+
}), [E]), [O, k] = f(""), [A, j] = f(null), [M, N] = f(!1), [P, F] = f(!1), [I, L] = f(null), [R, z] = f(void 0), [B, V] = f(!1), [H, U] = f(!1), W = d(() => o.map((e) => e.id), [o]), G = d(() => l.map((e) => e.id), [l]), K = d(() => A ? ne(A.widgetType, R, A.fieldMapping) : void 0, [A, R]), q = K?.fields, J = d(() => A ? s(A, {
|
|
72
|
+
permittedDataSinkIds: W,
|
|
73
|
+
permittedParserIds: G,
|
|
74
|
+
availableFields: q,
|
|
75
|
+
unresolvedRoles: K?.unresolvedRoles
|
|
89
76
|
}) : {
|
|
90
77
|
issues: [],
|
|
91
78
|
canApprove: !1
|
|
92
79
|
}, [
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
A,
|
|
81
|
+
W,
|
|
82
|
+
G,
|
|
95
83
|
q,
|
|
96
|
-
|
|
97
|
-
]),
|
|
98
|
-
loading:
|
|
99
|
-
accessError:
|
|
100
|
-
rowCount:
|
|
84
|
+
K
|
|
85
|
+
]), Y = d(() => ee(J, {
|
|
86
|
+
loading: B,
|
|
87
|
+
accessError: H,
|
|
88
|
+
rowCount: K?.rowCount ?? 0
|
|
101
89
|
}), [
|
|
102
|
-
|
|
90
|
+
J,
|
|
91
|
+
B,
|
|
103
92
|
H,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
K
|
|
94
|
+
]), X = u((e) => {
|
|
95
|
+
switch (e) {
|
|
96
|
+
case "chart": return E("bigconsole.widget.customWidget.typeOption.chart", "Chart");
|
|
97
|
+
case "funnel_chart": return E("bigconsole.widget.customWidget.typeOption.funnel_chart", "Funnel chart");
|
|
98
|
+
case "heatmap": return E("bigconsole.widget.customWidget.typeOption.heatmap", "Heatmap");
|
|
99
|
+
case "table": return E("bigconsole.widget.customWidget.typeOption.table", "Table");
|
|
100
|
+
case "metric_card": return E("bigconsole.widget.customWidget.typeOption.metric_card", "Metric card");
|
|
101
|
+
case "retention": return E("bigconsole.widget.customWidget.typeOption.retention", "Retention");
|
|
102
|
+
}
|
|
103
|
+
}, [E]), me = u((e) => {
|
|
104
|
+
switch (e.code) {
|
|
105
|
+
case "DATASINK_MATCHED": return e.parserName ? e.parserMatched ? E("bigconsole.widget.customWidget.notice.sinkMatchedWithParser", "Matched DataSink \"{{sink}}\" and parser \"{{parser}}\".", {
|
|
106
|
+
sink: e.sinkName,
|
|
107
|
+
parser: e.parserName
|
|
108
|
+
}) : E("bigconsole.widget.customWidget.notice.sinkMatchedParserDefaulted", "Matched DataSink \"{{sink}}\". No parser matched your prompt — defaulted to \"{{parser}}\". Check it below.", {
|
|
109
|
+
sink: e.sinkName,
|
|
110
|
+
parser: e.parserName
|
|
111
|
+
}) : E("bigconsole.widget.customWidget.notice.sinkMatchedNoParser", "Matched DataSink \"{{sink}}\" (no parser found for this sink).", { sink: e.sinkName });
|
|
112
|
+
case "DATASINK_DEFAULTED": return E("bigconsole.widget.customWidget.notice.sinkDefaulted", "No DataSink matched your prompt — defaulted to \"{{sink}}\". Pick the right one below.", { sink: e.sinkName });
|
|
113
|
+
case "NO_DATASINK": return E("bigconsole.widget.customWidget.notice.noSink", "No DataSink is available in this workspace — create one before saving this widget.");
|
|
114
|
+
case "WIDGET_TYPE_SUBSTITUTED": return E("bigconsole.widget.customWidget.notice.typeSubstituted", "The assistant can't propose {{requested}} widgets yet, so this proposal uses the {{type}} type. Change the type below if another fits better.", {
|
|
115
|
+
requested: e.requestedType,
|
|
116
|
+
type: X(e.widgetType)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}, [E, X]), he = A ? `${A.binding.dataSinkId}|${A.binding.parserId ?? ""}|${A.binding.dataPath ?? ""}` : "";
|
|
120
|
+
ae(() => {
|
|
121
|
+
if (!A || !A.binding.dataSinkId) {
|
|
122
|
+
z(void 0);
|
|
110
123
|
return;
|
|
111
124
|
}
|
|
112
125
|
let e = !1;
|
|
113
|
-
return
|
|
114
|
-
e ||
|
|
126
|
+
return V(!0), U(!1), S(A).then((t) => {
|
|
127
|
+
e || z(t);
|
|
115
128
|
}).catch(() => {
|
|
116
|
-
e || (
|
|
129
|
+
e || (z(void 0), U(!0));
|
|
117
130
|
}).finally(() => {
|
|
118
|
-
e ||
|
|
131
|
+
e || V(!1);
|
|
119
132
|
}), () => {
|
|
120
133
|
e = !0;
|
|
121
134
|
};
|
|
122
|
-
}, [
|
|
123
|
-
let
|
|
124
|
-
if (
|
|
125
|
-
|
|
135
|
+
}, [he, S]);
|
|
136
|
+
let ge = u(async () => {
|
|
137
|
+
if (O.trim()) {
|
|
138
|
+
N(!0), L(null);
|
|
126
139
|
try {
|
|
127
|
-
let e = await
|
|
128
|
-
prompt:
|
|
129
|
-
sinks:
|
|
130
|
-
parsers:
|
|
140
|
+
let e = await T.propose({
|
|
141
|
+
prompt: O.trim(),
|
|
142
|
+
sinks: o,
|
|
143
|
+
parsers: l
|
|
131
144
|
});
|
|
132
|
-
|
|
145
|
+
j(e);
|
|
133
146
|
} finally {
|
|
134
|
-
|
|
147
|
+
N(!1);
|
|
135
148
|
}
|
|
136
149
|
}
|
|
137
150
|
}, [
|
|
138
|
-
j,
|
|
139
151
|
O,
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
T,
|
|
153
|
+
o,
|
|
154
|
+
l
|
|
142
155
|
]), Z = u((e) => {
|
|
143
|
-
|
|
144
|
-
}, []),
|
|
145
|
-
|
|
146
|
-
}, []),
|
|
147
|
-
if (
|
|
148
|
-
|
|
156
|
+
j((t) => t && e(t));
|
|
157
|
+
}, []), _e = u(() => {
|
|
158
|
+
j(null), z(void 0), U(!1), L(null);
|
|
159
|
+
}, []), ve = u(async () => {
|
|
160
|
+
if (A && J.canApprove && !B && !H) {
|
|
161
|
+
F(!0), L(null);
|
|
149
162
|
try {
|
|
150
|
-
await
|
|
163
|
+
await C(A), w();
|
|
151
164
|
} catch (e) {
|
|
152
|
-
|
|
165
|
+
L(e instanceof Error ? e.message : E("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
|
|
153
166
|
} finally {
|
|
154
|
-
|
|
167
|
+
F(!1);
|
|
155
168
|
}
|
|
156
169
|
}
|
|
157
170
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
A,
|
|
172
|
+
J.canApprove,
|
|
173
|
+
B,
|
|
160
174
|
H,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return /* @__PURE__ */ x("section", {
|
|
175
|
+
C,
|
|
176
|
+
w,
|
|
177
|
+
E
|
|
178
|
+
]), Q = J.issues.filter((e) => e.severity === "error"), $ = J.issues.filter((e) => e.severity === "warning");
|
|
179
|
+
return /* @__PURE__ */ y("section", {
|
|
167
180
|
"data-testid": "custom-widget-proposal-panel",
|
|
168
|
-
"aria-label":
|
|
181
|
+
"aria-label": E("bigconsole.widget.customWidget.panel.ariaLabel", "AI custom widget builder"),
|
|
169
182
|
className: "flex h-full w-full min-w-0 flex-col overflow-y-auto p-4",
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
title:
|
|
183
|
+
children: /* @__PURE__ */ b(t, { children: [/* @__PURE__ */ y(e, {
|
|
184
|
+
title: E("bigconsole.widget.customWidget.prompt.label", "Describe the widget you need"),
|
|
172
185
|
description: "Plain English. The assistant proposes a typed widget you can edit before anything is saved.",
|
|
173
|
-
icon: /* @__PURE__ */
|
|
186
|
+
icon: /* @__PURE__ */ y(h, {
|
|
174
187
|
className: "size-4",
|
|
175
188
|
"aria-hidden": "true"
|
|
176
189
|
}),
|
|
177
|
-
actions: /* @__PURE__ */
|
|
190
|
+
actions: /* @__PURE__ */ b("div", {
|
|
178
191
|
className: "flex flex-wrap gap-2",
|
|
179
|
-
children: [/* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ b(g, {
|
|
180
193
|
"data-testid": "custom-widget-generate",
|
|
181
|
-
onClick:
|
|
182
|
-
disabled: !
|
|
183
|
-
children: [
|
|
194
|
+
onClick: ge,
|
|
195
|
+
disabled: !O.trim() || M,
|
|
196
|
+
children: [M ? /* @__PURE__ */ y(p, {
|
|
184
197
|
className: "mr-2 size-4 animate-spin",
|
|
185
198
|
"aria-hidden": "true"
|
|
186
|
-
}) : null,
|
|
187
|
-
}),
|
|
199
|
+
}) : null, A ? E("bigconsole.widget.customWidget.action.regenerate", "Regenerate") : E("bigconsole.widget.customWidget.action.generateProposal", "Generate proposal")]
|
|
200
|
+
}), A ? /* @__PURE__ */ b(g, {
|
|
188
201
|
variant: "outline",
|
|
189
202
|
"data-testid": "custom-widget-reject",
|
|
190
|
-
onClick:
|
|
191
|
-
children: [/* @__PURE__ */
|
|
203
|
+
onClick: _e,
|
|
204
|
+
children: [/* @__PURE__ */ y(ce, {
|
|
192
205
|
className: "mr-1 size-4",
|
|
193
206
|
"aria-hidden": "true"
|
|
194
|
-
}),
|
|
207
|
+
}), E("bigconsole.widget.customWidget.action.reject", "Reject")]
|
|
195
208
|
}) : null]
|
|
196
209
|
}),
|
|
197
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ b("div", {
|
|
198
211
|
className: "flex flex-col gap-2",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ y(v, {
|
|
200
213
|
htmlFor: "custom-widget-prompt",
|
|
201
214
|
children: "What should it show?"
|
|
202
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ y(le, {
|
|
203
216
|
id: "custom-widget-prompt",
|
|
204
217
|
"data-testid": "custom-widget-prompt",
|
|
205
|
-
value:
|
|
206
|
-
onChange: (e) =>
|
|
207
|
-
placeholder:
|
|
218
|
+
value: O,
|
|
219
|
+
onChange: (e) => k(e.target.value),
|
|
220
|
+
placeholder: E("bigconsole.widget.customWidget.prompt.placeholder", "e.g. a funnel of signup conversion stages"),
|
|
208
221
|
rows: 3
|
|
209
222
|
})]
|
|
210
223
|
})
|
|
211
|
-
}),
|
|
212
|
-
/* @__PURE__ */
|
|
224
|
+
}), A ? /* @__PURE__ */ b(de, { children: [
|
|
225
|
+
/* @__PURE__ */ b(e, {
|
|
213
226
|
emphasis: "primary",
|
|
214
|
-
tone:
|
|
215
|
-
title:
|
|
216
|
-
description:
|
|
217
|
-
meta: /* @__PURE__ */
|
|
227
|
+
tone: pe[Y],
|
|
228
|
+
title: D[Y].title,
|
|
229
|
+
description: A.binding.parserId ? E("bigconsole.widget.customWidget.preview.parserDescription", "Rendered using the saved parser output.") : E("bigconsole.widget.customWidget.preview.sourceDescription", "Rendered using up to 50 source rows. Full data may differ."),
|
|
230
|
+
meta: /* @__PURE__ */ y("span", {
|
|
218
231
|
"data-testid": "custom-widget-preview-state",
|
|
219
|
-
"data-state":
|
|
232
|
+
"data-state": Y,
|
|
220
233
|
className: "rounded-pill bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
|
|
221
|
-
children:
|
|
234
|
+
children: Y
|
|
222
235
|
}),
|
|
223
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ y("div", {
|
|
224
237
|
"data-testid": "custom-widget-preview",
|
|
225
238
|
className: "min-h-[220px] min-w-0 rounded-card border border-[var(--color-border-subtle)] bg-bg-surface p-2",
|
|
226
|
-
children:
|
|
239
|
+
children: Y === "loading" ? /* @__PURE__ */ b("div", {
|
|
227
240
|
className: "flex h-[200px] items-center justify-center text-text-secondary",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ y(p, {
|
|
229
242
|
className: "mr-2 size-4 animate-spin",
|
|
230
243
|
"aria-hidden": "true"
|
|
231
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ y("span", {
|
|
232
245
|
className: "text-sm",
|
|
233
|
-
children:
|
|
246
|
+
children: D.loading.body
|
|
234
247
|
})]
|
|
235
|
-
}) :
|
|
248
|
+
}) : Y === "valid" ? /* @__PURE__ */ y("div", {
|
|
236
249
|
className: "h-[200px]",
|
|
237
|
-
children: /* @__PURE__ */
|
|
238
|
-
widgetId: `preview-${
|
|
239
|
-
children: /* @__PURE__ */
|
|
240
|
-
widget:
|
|
241
|
-
data:
|
|
250
|
+
children: /* @__PURE__ */ y(r, {
|
|
251
|
+
widgetId: `preview-${A.id}`,
|
|
252
|
+
children: /* @__PURE__ */ y(n, {
|
|
253
|
+
widget: x(A, E("bigconsole.widget.customWidget.untitledWidget", "Untitled widget")),
|
|
254
|
+
data: R
|
|
242
255
|
})
|
|
243
256
|
})
|
|
244
|
-
}) : /* @__PURE__ */
|
|
257
|
+
}) : /* @__PURE__ */ b("div", {
|
|
245
258
|
className: "flex h-[200px] flex-col items-center justify-center gap-2 px-4 text-center",
|
|
246
259
|
children: [
|
|
247
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ y(oe, {
|
|
248
261
|
className: "size-5 text-[var(--color-status-warning-text)]",
|
|
249
262
|
"aria-hidden": "true"
|
|
250
263
|
}),
|
|
251
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ y("p", {
|
|
252
265
|
className: "text-sm text-text-secondary",
|
|
253
|
-
children:
|
|
266
|
+
children: D[Y].body
|
|
254
267
|
}),
|
|
255
|
-
|
|
268
|
+
Y === "access-error" ? /* @__PURE__ */ b(g, {
|
|
256
269
|
size: "sm",
|
|
257
270
|
variant: "outline",
|
|
258
271
|
onClick: () => Z((e) => ({ ...e })),
|
|
259
|
-
children: [/* @__PURE__ */
|
|
272
|
+
children: [/* @__PURE__ */ y(m, {
|
|
260
273
|
className: "mr-1 size-3.5",
|
|
261
274
|
"aria-hidden": "true"
|
|
262
|
-
}),
|
|
275
|
+
}), E("bigconsole.widget.customWidget.action.retry", "Retry")]
|
|
263
276
|
}) : null
|
|
264
277
|
]
|
|
265
278
|
})
|
|
266
|
-
}),
|
|
279
|
+
}), A.notices?.length ? /* @__PURE__ */ y("ul", {
|
|
280
|
+
className: "mt-2 flex min-w-0 flex-col gap-1",
|
|
281
|
+
"data-testid": "custom-widget-notices",
|
|
282
|
+
children: A.notices.map((e) => /* @__PURE__ */ y("li", {
|
|
283
|
+
"data-notice": e.code,
|
|
284
|
+
className: `break-words text-xs ${e.code === "DATASINK_MATCHED" && (e.parserMatched || !e.parserName) ? "text-text-secondary" : "text-[var(--color-status-warning-text)]"}`,
|
|
285
|
+
children: me(e)
|
|
286
|
+
}, e.code))
|
|
287
|
+
}) : A.rationale ? /* @__PURE__ */ y("p", {
|
|
267
288
|
className: "mt-2 text-xs text-text-secondary",
|
|
268
289
|
"data-testid": "custom-widget-rationale",
|
|
269
|
-
children:
|
|
290
|
+
children: A.rationale
|
|
270
291
|
}) : null]
|
|
271
292
|
}),
|
|
272
|
-
Q.length > 0 || $.length > 0 ? /* @__PURE__ */
|
|
293
|
+
Q.length > 0 || $.length > 0 ? /* @__PURE__ */ y(e, {
|
|
273
294
|
tone: Q.length > 0 ? "danger" : "warning",
|
|
274
295
|
padding: "compact",
|
|
275
296
|
headingLevel: 3,
|
|
276
297
|
title: Q.length > 0 ? `${Q.length} ${Q.length === 1 ? "problem" : "problems"} to fix before approving` : `${$.length} ${$.length === 1 ? "warning" : "warnings"}`,
|
|
277
|
-
children: /* @__PURE__ */
|
|
298
|
+
children: /* @__PURE__ */ y("ul", {
|
|
278
299
|
"data-testid": "custom-widget-issues",
|
|
279
300
|
className: "flex min-w-0 flex-col gap-1",
|
|
280
|
-
children: [...Q, ...$].map((e) => /* @__PURE__ */
|
|
301
|
+
children: [...Q, ...$].map((e) => /* @__PURE__ */ y("li", {
|
|
281
302
|
"data-severity": e.severity,
|
|
282
303
|
className: `break-words text-xs ${e.severity === "error" ? "text-[var(--color-status-error-text)]" : "text-[var(--color-status-warning-text)]"}`,
|
|
283
304
|
children: e.message
|
|
284
305
|
}, `${e.code}-${e.path ?? ""}`))
|
|
285
306
|
})
|
|
286
307
|
}) : null,
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
title:
|
|
308
|
+
/* @__PURE__ */ y(e, {
|
|
309
|
+
title: E("bigconsole.widget.customWidget.proposal.heading", "Proposal"),
|
|
289
310
|
description: "Every field is editable — the assistant proposes, you dispose.",
|
|
290
311
|
"data-testid": "custom-widget-proposal-fields",
|
|
291
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ b("div", {
|
|
292
313
|
className: "flex flex-col gap-3",
|
|
293
314
|
children: [
|
|
294
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ b("div", {
|
|
295
316
|
className: "flex flex-col gap-1",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
317
|
+
children: [/* @__PURE__ */ y(v, {
|
|
297
318
|
htmlFor: "custom-widget-title",
|
|
298
|
-
children:
|
|
299
|
-
}), /* @__PURE__ */
|
|
319
|
+
children: E("bigconsole.widget.customWidget.field.title", "Title")
|
|
320
|
+
}), /* @__PURE__ */ y(_, {
|
|
300
321
|
id: "custom-widget-title",
|
|
301
322
|
"data-testid": "custom-widget-title",
|
|
302
|
-
className:
|
|
303
|
-
value:
|
|
323
|
+
className: fe,
|
|
324
|
+
value: A.presentation.title,
|
|
304
325
|
onChange: (e) => Z((t) => ({
|
|
305
326
|
...t,
|
|
306
327
|
presentation: {
|
|
@@ -310,39 +331,39 @@ var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E,
|
|
|
310
331
|
}))
|
|
311
332
|
})]
|
|
312
333
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ b("div", {
|
|
314
335
|
className: "flex flex-col gap-1",
|
|
315
|
-
children: [/* @__PURE__ */
|
|
336
|
+
children: [/* @__PURE__ */ y(v, {
|
|
316
337
|
htmlFor: "custom-widget-type",
|
|
317
|
-
children:
|
|
318
|
-
}), /* @__PURE__ */
|
|
338
|
+
children: E("bigconsole.widget.customWidget.field.widgetType", "Widget type")
|
|
339
|
+
}), /* @__PURE__ */ y("select", {
|
|
319
340
|
id: "custom-widget-type",
|
|
320
341
|
"data-testid": "custom-widget-type",
|
|
321
|
-
value:
|
|
342
|
+
value: A.widgetType,
|
|
322
343
|
onChange: (e) => {
|
|
323
344
|
let t = e.target.value;
|
|
324
|
-
|
|
345
|
+
te(t) && Z((e) => re(e, t));
|
|
325
346
|
},
|
|
326
347
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
327
|
-
children:
|
|
348
|
+
children: a.map((e) => /* @__PURE__ */ y("option", {
|
|
328
349
|
value: e,
|
|
329
|
-
children: e
|
|
350
|
+
children: X(e)
|
|
330
351
|
}, e))
|
|
331
352
|
})]
|
|
332
353
|
}),
|
|
333
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ b("div", {
|
|
334
355
|
className: "flex flex-col gap-1",
|
|
335
|
-
children: [/* @__PURE__ */
|
|
356
|
+
children: [/* @__PURE__ */ y(v, {
|
|
336
357
|
htmlFor: "custom-widget-sink",
|
|
337
|
-
children:
|
|
338
|
-
}), /* @__PURE__ */
|
|
358
|
+
children: E("bigconsole.widget.customWidget.field.dataSink", "DataSink")
|
|
359
|
+
}), /* @__PURE__ */ b("select", {
|
|
339
360
|
id: "custom-widget-sink",
|
|
340
361
|
"data-testid": "custom-widget-sink",
|
|
341
|
-
value:
|
|
362
|
+
value: A.binding.dataSinkId,
|
|
342
363
|
onChange: (e) => {
|
|
343
|
-
let t =
|
|
364
|
+
let t = o.find((t) => t.id === e.target.value);
|
|
344
365
|
Z((n) => ({
|
|
345
|
-
...n,
|
|
366
|
+
...c(n, i),
|
|
346
367
|
binding: {
|
|
347
368
|
...n.binding,
|
|
348
369
|
dataSinkId: e.target.value,
|
|
@@ -352,28 +373,28 @@ var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E,
|
|
|
352
373
|
}));
|
|
353
374
|
},
|
|
354
375
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
376
|
+
children: [/* @__PURE__ */ y("option", {
|
|
356
377
|
value: "",
|
|
357
|
-
children:
|
|
358
|
-
}),
|
|
378
|
+
children: E("bigconsole.widget.customWidget.field.selectDataSink", "Select a DataSink…")
|
|
379
|
+
}), o.map((e) => /* @__PURE__ */ y("option", {
|
|
359
380
|
value: e.id,
|
|
360
381
|
children: e.name || e.key
|
|
361
382
|
}, e.id))]
|
|
362
383
|
})]
|
|
363
384
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ b("div", {
|
|
365
386
|
className: "flex flex-col gap-1",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
387
|
+
children: [/* @__PURE__ */ y(v, {
|
|
367
388
|
htmlFor: "custom-widget-parser",
|
|
368
|
-
children:
|
|
369
|
-
}), /* @__PURE__ */
|
|
389
|
+
children: E("bigconsole.widget.customWidget.field.parser", "Parser")
|
|
390
|
+
}), /* @__PURE__ */ b("select", {
|
|
370
391
|
id: "custom-widget-parser",
|
|
371
392
|
"data-testid": "custom-widget-parser",
|
|
372
|
-
value:
|
|
393
|
+
value: A.binding.parserId ?? "",
|
|
373
394
|
onChange: (e) => {
|
|
374
|
-
let t =
|
|
395
|
+
let t = l.find((t) => t.id === e.target.value);
|
|
375
396
|
Z((n) => ({
|
|
376
|
-
...n,
|
|
397
|
+
...c(n, i),
|
|
377
398
|
binding: {
|
|
378
399
|
...n.binding,
|
|
379
400
|
parserId: e.target.value || void 0,
|
|
@@ -383,32 +404,33 @@ var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E,
|
|
|
383
404
|
}));
|
|
384
405
|
},
|
|
385
406
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
386
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ y("option", {
|
|
387
408
|
value: "",
|
|
388
|
-
children:
|
|
389
|
-
}),
|
|
409
|
+
children: E("bigconsole.widget.customWidget.field.noParser", "No parser")
|
|
410
|
+
}), l.map((e) => /* @__PURE__ */ y("option", {
|
|
390
411
|
value: e.id,
|
|
391
412
|
children: e.name
|
|
392
413
|
}, e.id))]
|
|
393
414
|
})]
|
|
394
415
|
}),
|
|
395
|
-
Object.keys(
|
|
416
|
+
Object.keys(A.fieldMapping).length > 0 ? /* @__PURE__ */ b("fieldset", {
|
|
396
417
|
className: "flex flex-col gap-2",
|
|
397
418
|
"data-testid": "custom-widget-field-mapping",
|
|
398
419
|
children: [
|
|
399
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ y("legend", {
|
|
400
421
|
className: "text-sm font-medium text-text-primary",
|
|
401
|
-
children:
|
|
422
|
+
children: E("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
|
|
402
423
|
}),
|
|
403
|
-
Object.entries(
|
|
424
|
+
Object.entries(A.fieldMapping).map(([e, t]) => /* @__PURE__ */ b("div", {
|
|
404
425
|
className: "flex flex-col gap-1",
|
|
405
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ y(v, {
|
|
406
427
|
htmlFor: `custom-widget-field-${e}`,
|
|
407
428
|
children: e
|
|
408
|
-
}), /* @__PURE__ */
|
|
429
|
+
}), /* @__PURE__ */ y(_, {
|
|
409
430
|
id: `custom-widget-field-${e}`,
|
|
410
431
|
"data-testid": `custom-widget-field-${e}`,
|
|
411
432
|
value: t,
|
|
433
|
+
placeholder: E("bigconsole.widget.customWidget.fieldMapping.autoDetect", "Auto-detect"),
|
|
412
434
|
onChange: (t) => Z((n) => ({
|
|
413
435
|
...n,
|
|
414
436
|
fieldMapping: {
|
|
@@ -418,58 +440,58 @@ var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E,
|
|
|
418
440
|
}))
|
|
419
441
|
})]
|
|
420
442
|
}, e)),
|
|
421
|
-
|
|
443
|
+
q?.length ? /* @__PURE__ */ y("p", {
|
|
422
444
|
className: "break-words text-xs text-text-secondary",
|
|
423
|
-
children:
|
|
445
|
+
children: E("bigconsole.widget.customWidget.fieldMapping.available", "Available: {{fields}}", { fields: q.join(", ") })
|
|
424
446
|
}) : null
|
|
425
447
|
]
|
|
426
448
|
}) : null
|
|
427
449
|
]
|
|
428
450
|
})
|
|
429
451
|
}),
|
|
430
|
-
|
|
452
|
+
I ? /* @__PURE__ */ y(e, {
|
|
431
453
|
tone: "danger",
|
|
432
454
|
padding: "compact",
|
|
433
455
|
headingLevel: 3,
|
|
434
456
|
title: "Could not add the widget",
|
|
435
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ y("p", {
|
|
436
458
|
role: "alert",
|
|
437
459
|
className: "break-words text-xs text-[var(--color-status-error-text)]",
|
|
438
460
|
"data-testid": "custom-widget-approve-error",
|
|
439
|
-
children:
|
|
461
|
+
children: I
|
|
440
462
|
})
|
|
441
463
|
}) : null,
|
|
442
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ b("div", {
|
|
443
465
|
className: "flex flex-wrap gap-2 border-t border-[var(--color-border-subtle)] pt-3",
|
|
444
|
-
children: [/* @__PURE__ */
|
|
466
|
+
children: [/* @__PURE__ */ b(g, {
|
|
445
467
|
"data-testid": "custom-widget-approve",
|
|
446
|
-
onClick:
|
|
447
|
-
disabled: !
|
|
448
|
-
children: [
|
|
468
|
+
onClick: ve,
|
|
469
|
+
disabled: !J.canApprove || B || H || P,
|
|
470
|
+
children: [P ? /* @__PURE__ */ y(p, {
|
|
449
471
|
className: "mr-2 size-4 animate-spin",
|
|
450
472
|
"aria-hidden": "true"
|
|
451
|
-
}) : /* @__PURE__ */
|
|
473
|
+
}) : /* @__PURE__ */ y(se, {
|
|
452
474
|
className: "mr-1 size-4",
|
|
453
475
|
"aria-hidden": "true"
|
|
454
|
-
}),
|
|
455
|
-
}), /* @__PURE__ */
|
|
476
|
+
}), E("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
|
|
477
|
+
}), /* @__PURE__ */ y(g, {
|
|
456
478
|
variant: "outline",
|
|
457
|
-
onClick:
|
|
479
|
+
onClick: w,
|
|
458
480
|
"data-testid": "custom-widget-cancel",
|
|
459
|
-
children:
|
|
481
|
+
children: E("bigconsole.widget.customWidget.action.cancel", "Cancel")
|
|
460
482
|
})]
|
|
461
483
|
})
|
|
462
|
-
] }) : /* @__PURE__ */
|
|
484
|
+
] }) : /* @__PURE__ */ y(e, {
|
|
463
485
|
emphasis: "muted",
|
|
464
486
|
padding: "compact",
|
|
465
487
|
title: "No proposal yet",
|
|
466
488
|
headingLevel: 3,
|
|
467
|
-
children: /* @__PURE__ */
|
|
489
|
+
children: /* @__PURE__ */ y("p", {
|
|
468
490
|
className: "text-sm text-text-secondary",
|
|
469
491
|
"data-testid": "custom-widget-empty",
|
|
470
|
-
children:
|
|
492
|
+
children: E("bigconsole.widget.customWidget.empty", "No proposal yet. Describe a widget and the assistant will propose one for you to review — nothing is added to the dashboard until you approve it.")
|
|
471
493
|
})
|
|
472
494
|
})] })
|
|
473
495
|
});
|
|
474
496
|
});
|
|
475
|
-
export {
|
|
497
|
+
export { S as CustomWidgetProposalPanel, S as default };
|