@burdenoff/microfe-bigconsole 2026.1119.3 → 2026.1119.4

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.
@@ -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 ee, derivePreviewState as i, isProposableWidgetType as a, validateProposal as o } from "./proposalContract.js";
5
- import { changeProposalWidgetType as s, localProposalSource as c } from "./proposalSource.js";
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 d, useMemo as f, useState as p } from "react";
8
- import { AlertTriangle as m, Check as h, Loader2 as g, RefreshCw as te, Sparkles as ne, X as _ } from "lucide-react";
9
- import { Button as v, Input as y, Label as b, Textarea as re } from "@burdenoff/fe-libs/ui";
10
- import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
- import { Fragment as ae, jsx as x, jsxs as S } from "react/jsx-runtime";
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 oe = "w-full", se = {
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 ce(e, t) {
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 le(e) {
49
- if (Array.isArray(e)) {
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: k("bigconsole.widget.customWidget.preview.loading.title", "Building preview…"),
67
- body: k("bigconsole.widget.customWidget.preview.loading.body", "Reading the selected data binding.")
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: k("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
56
+ title: E("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
71
57
  body: ""
72
58
  },
73
59
  "no-data": {
74
- title: k("bigconsole.widget.customWidget.preview.noData.title", "No data returned"),
75
- body: k("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.")
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: k("bigconsole.widget.customWidget.preview.fieldMismatch.title", "Field mismatch"),
79
- body: k("bigconsole.widget.customWidget.preview.fieldMismatch.body", "Some mapped fields are not present in the parser output. Fix the mapping below before approving.")
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: k("bigconsole.widget.customWidget.preview.accessError.title", "Cannot read this data"),
83
- body: k("bigconsole.widget.customWidget.preview.accessError.body", "You do not have access to the proposed DataSink or parser in this workspace.")
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
- }), [k]), [j, ue] = p(""), [M, N] = p(null), [P, F] = p(!1), [I, L] = p(!1), [R, z] = p(null), [B, V] = p(void 0), [H, U] = p(!1), [W, G] = p(!1), K = f(() => l.map((e) => e.id), [l]), q = f(() => w.map((e) => e.id), [w]), J = f(() => le(B), [B]), Y = f(() => M ? o(M, {
86
- permittedDataSinkIds: K,
87
- permittedParserIds: q,
88
- availableFields: J
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
- M,
94
- K,
80
+ A,
81
+ W,
82
+ G,
95
83
  q,
96
- J
97
- ]), X = f(() => i(Y, {
98
- loading: H,
99
- accessError: W,
100
- rowCount: C(B)
84
+ K
85
+ ]), Y = d(() => ee(J, {
86
+ loading: B,
87
+ accessError: H,
88
+ rowCount: K?.rowCount ?? 0
101
89
  }), [
102
- Y,
90
+ J,
91
+ B,
103
92
  H,
104
- W,
105
- B
106
- ]), de = M ? `${M.binding.dataSinkId}|${M.binding.parserId ?? ""}|${M.binding.dataPath ?? ""}` : "";
107
- d(() => {
108
- if (!M || !M.binding.dataSinkId) {
109
- V(void 0);
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 U(!0), G(!1), T(M).then((t) => {
114
- e || V(t);
126
+ return V(!0), U(!1), S(A).then((t) => {
127
+ e || z(t);
115
128
  }).catch(() => {
116
- e || (V(void 0), G(!0));
129
+ e || (z(void 0), U(!0));
117
130
  }).finally(() => {
118
- e || U(!1);
131
+ e || V(!1);
119
132
  }), () => {
120
133
  e = !0;
121
134
  };
122
- }, [de, T]);
123
- let fe = u(async () => {
124
- if (j.trim()) {
125
- F(!0), z(null);
135
+ }, [he, S]);
136
+ let ge = u(async () => {
137
+ if (O.trim()) {
138
+ N(!0), L(null);
126
139
  try {
127
- let e = await O.propose({
128
- prompt: j.trim(),
129
- sinks: l,
130
- parsers: w
140
+ let e = await T.propose({
141
+ prompt: O.trim(),
142
+ sinks: o,
143
+ parsers: l
131
144
  });
132
- N(e);
145
+ j(e);
133
146
  } finally {
134
- F(!1);
147
+ N(!1);
135
148
  }
136
149
  }
137
150
  }, [
138
- j,
139
151
  O,
140
- l,
141
- w
152
+ T,
153
+ o,
154
+ l
142
155
  ]), Z = u((e) => {
143
- N((t) => t && e(t));
144
- }, []), pe = u(() => {
145
- N(null), V(void 0), G(!1), z(null);
146
- }, []), me = u(async () => {
147
- if (M && Y.canApprove && !H && !W) {
148
- L(!0), z(null);
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 E(M), D();
163
+ await C(A), w();
151
164
  } catch (e) {
152
- z(e instanceof Error ? e.message : k("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
165
+ L(e instanceof Error ? e.message : E("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
153
166
  } finally {
154
- L(!1);
167
+ F(!1);
155
168
  }
156
169
  }
157
170
  }, [
158
- M,
159
- Y.canApprove,
171
+ A,
172
+ J.canApprove,
173
+ B,
160
174
  H,
161
- W,
162
- E,
163
- D,
164
- k
165
- ]), Q = Y.issues.filter((e) => e.severity === "error"), $ = Y.issues.filter((e) => e.severity === "warning");
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": k("bigconsole.widget.customWidget.panel.ariaLabel", "AI custom widget builder"),
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__ */ S(t, { children: [/* @__PURE__ */ x(e, {
171
- title: k("bigconsole.widget.customWidget.prompt.label", "Describe the widget you need"),
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__ */ x(ne, {
186
+ icon: /* @__PURE__ */ y(h, {
174
187
  className: "size-4",
175
188
  "aria-hidden": "true"
176
189
  }),
177
- actions: /* @__PURE__ */ S("div", {
190
+ actions: /* @__PURE__ */ b("div", {
178
191
  className: "flex flex-wrap gap-2",
179
- children: [/* @__PURE__ */ S(v, {
192
+ children: [/* @__PURE__ */ b(g, {
180
193
  "data-testid": "custom-widget-generate",
181
- onClick: fe,
182
- disabled: !j.trim() || P,
183
- children: [P ? /* @__PURE__ */ x(g, {
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, M ? k("bigconsole.widget.customWidget.action.regenerate", "Regenerate") : k("bigconsole.widget.customWidget.action.generateProposal", "Generate proposal")]
187
- }), M ? /* @__PURE__ */ S(v, {
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: pe,
191
- children: [/* @__PURE__ */ x(_, {
203
+ onClick: _e,
204
+ children: [/* @__PURE__ */ y(ce, {
192
205
  className: "mr-1 size-4",
193
206
  "aria-hidden": "true"
194
- }), k("bigconsole.widget.customWidget.action.reject", "Reject")]
207
+ }), E("bigconsole.widget.customWidget.action.reject", "Reject")]
195
208
  }) : null]
196
209
  }),
197
- children: /* @__PURE__ */ S("div", {
210
+ children: /* @__PURE__ */ b("div", {
198
211
  className: "flex flex-col gap-2",
199
- children: [/* @__PURE__ */ x(b, {
212
+ children: [/* @__PURE__ */ y(v, {
200
213
  htmlFor: "custom-widget-prompt",
201
214
  children: "What should it show?"
202
- }), /* @__PURE__ */ x(re, {
215
+ }), /* @__PURE__ */ y(le, {
203
216
  id: "custom-widget-prompt",
204
217
  "data-testid": "custom-widget-prompt",
205
- value: j,
206
- onChange: (e) => ue(e.target.value),
207
- placeholder: k("bigconsole.widget.customWidget.prompt.placeholder", "e.g. a funnel of signup conversion stages"),
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
- }), M ? /* @__PURE__ */ S(ae, { children: [
212
- /* @__PURE__ */ S(e, {
224
+ }), A ? /* @__PURE__ */ b(de, { children: [
225
+ /* @__PURE__ */ b(e, {
213
226
  emphasis: "primary",
214
- tone: se[X],
215
- title: A[X].title,
216
- description: M.binding.parserId ? k("bigconsole.widget.customWidget.preview.parserDescription", "Rendered using the saved parser output.") : k("bigconsole.widget.customWidget.preview.sourceDescription", "Rendered using up to 50 source rows. Full data may differ."),
217
- meta: /* @__PURE__ */ x("span", {
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": X,
232
+ "data-state": Y,
220
233
  className: "rounded-pill bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
221
- children: X
234
+ children: Y
222
235
  }),
223
- children: [/* @__PURE__ */ x("div", {
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: X === "loading" ? /* @__PURE__ */ S("div", {
239
+ children: Y === "loading" ? /* @__PURE__ */ b("div", {
227
240
  className: "flex h-[200px] items-center justify-center text-text-secondary",
228
- children: [/* @__PURE__ */ x(g, {
241
+ children: [/* @__PURE__ */ y(p, {
229
242
  className: "mr-2 size-4 animate-spin",
230
243
  "aria-hidden": "true"
231
- }), /* @__PURE__ */ x("span", {
244
+ }), /* @__PURE__ */ y("span", {
232
245
  className: "text-sm",
233
- children: A.loading.body
246
+ children: D.loading.body
234
247
  })]
235
- }) : X === "valid" ? /* @__PURE__ */ x("div", {
248
+ }) : Y === "valid" ? /* @__PURE__ */ y("div", {
236
249
  className: "h-[200px]",
237
- children: /* @__PURE__ */ x(r, {
238
- widgetId: `preview-${M.id}`,
239
- children: /* @__PURE__ */ x(n, {
240
- widget: ce(M, k("bigconsole.widget.customWidget.untitledWidget", "Untitled widget")),
241
- data: B
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__ */ S("div", {
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__ */ x(m, {
260
+ /* @__PURE__ */ y(oe, {
248
261
  className: "size-5 text-[var(--color-status-warning-text)]",
249
262
  "aria-hidden": "true"
250
263
  }),
251
- /* @__PURE__ */ x("p", {
264
+ /* @__PURE__ */ y("p", {
252
265
  className: "text-sm text-text-secondary",
253
- children: A[X].body
266
+ children: D[Y].body
254
267
  }),
255
- X === "access-error" ? /* @__PURE__ */ S(v, {
268
+ Y === "access-error" ? /* @__PURE__ */ b(g, {
256
269
  size: "sm",
257
270
  variant: "outline",
258
271
  onClick: () => Z((e) => ({ ...e })),
259
- children: [/* @__PURE__ */ x(te, {
272
+ children: [/* @__PURE__ */ y(m, {
260
273
  className: "mr-1 size-3.5",
261
274
  "aria-hidden": "true"
262
- }), k("bigconsole.widget.customWidget.action.retry", "Retry")]
275
+ }), E("bigconsole.widget.customWidget.action.retry", "Retry")]
263
276
  }) : null
264
277
  ]
265
278
  })
266
- }), M.rationale ? /* @__PURE__ */ x("p", {
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: M.rationale
290
+ children: A.rationale
270
291
  }) : null]
271
292
  }),
272
- Q.length > 0 || $.length > 0 ? /* @__PURE__ */ x(e, {
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__ */ x("ul", {
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__ */ x("li", {
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__ */ x(e, {
288
- title: k("bigconsole.widget.customWidget.proposal.heading", "Proposal"),
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__ */ S("div", {
312
+ children: /* @__PURE__ */ b("div", {
292
313
  className: "flex flex-col gap-3",
293
314
  children: [
294
- /* @__PURE__ */ S("div", {
315
+ /* @__PURE__ */ b("div", {
295
316
  className: "flex flex-col gap-1",
296
- children: [/* @__PURE__ */ x(b, {
317
+ children: [/* @__PURE__ */ y(v, {
297
318
  htmlFor: "custom-widget-title",
298
- children: k("bigconsole.widget.customWidget.field.title", "Title")
299
- }), /* @__PURE__ */ x(y, {
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: oe,
303
- value: M.presentation.title,
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__ */ S("div", {
334
+ /* @__PURE__ */ b("div", {
314
335
  className: "flex flex-col gap-1",
315
- children: [/* @__PURE__ */ x(b, {
336
+ children: [/* @__PURE__ */ y(v, {
316
337
  htmlFor: "custom-widget-type",
317
- children: k("bigconsole.widget.customWidget.field.widgetType", "Widget type")
318
- }), /* @__PURE__ */ x("select", {
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: M.widgetType,
342
+ value: A.widgetType,
322
343
  onChange: (e) => {
323
344
  let t = e.target.value;
324
- a(t) && Z((e) => s(e, t));
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: ee.map((e) => /* @__PURE__ */ x("option", {
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__ */ S("div", {
354
+ /* @__PURE__ */ b("div", {
334
355
  className: "flex flex-col gap-1",
335
- children: [/* @__PURE__ */ x(b, {
356
+ children: [/* @__PURE__ */ y(v, {
336
357
  htmlFor: "custom-widget-sink",
337
- children: k("bigconsole.widget.customWidget.field.dataSink", "DataSink")
338
- }), /* @__PURE__ */ S("select", {
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: M.binding.dataSinkId,
362
+ value: A.binding.dataSinkId,
342
363
  onChange: (e) => {
343
- let t = l.find((t) => t.id === e.target.value);
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__ */ x("option", {
376
+ children: [/* @__PURE__ */ y("option", {
356
377
  value: "",
357
- children: k("bigconsole.widget.customWidget.field.selectDataSink", "Select a DataSink…")
358
- }), l.map((e) => /* @__PURE__ */ x("option", {
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__ */ S("div", {
385
+ /* @__PURE__ */ b("div", {
365
386
  className: "flex flex-col gap-1",
366
- children: [/* @__PURE__ */ x(b, {
387
+ children: [/* @__PURE__ */ y(v, {
367
388
  htmlFor: "custom-widget-parser",
368
- children: k("bigconsole.widget.customWidget.field.parser", "Parser")
369
- }), /* @__PURE__ */ S("select", {
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: M.binding.parserId ?? "",
393
+ value: A.binding.parserId ?? "",
373
394
  onChange: (e) => {
374
- let t = w.find((t) => t.id === e.target.value);
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__ */ x("option", {
407
+ children: [/* @__PURE__ */ y("option", {
387
408
  value: "",
388
- children: k("bigconsole.widget.customWidget.field.noParser", "No parser")
389
- }), w.map((e) => /* @__PURE__ */ x("option", {
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(M.fieldMapping).length > 0 ? /* @__PURE__ */ S("fieldset", {
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__ */ x("legend", {
420
+ /* @__PURE__ */ y("legend", {
400
421
  className: "text-sm font-medium text-text-primary",
401
- children: k("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
422
+ children: E("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
402
423
  }),
403
- Object.entries(M.fieldMapping).map(([e, t]) => /* @__PURE__ */ S("div", {
424
+ Object.entries(A.fieldMapping).map(([e, t]) => /* @__PURE__ */ b("div", {
404
425
  className: "flex flex-col gap-1",
405
- children: [/* @__PURE__ */ x(b, {
426
+ children: [/* @__PURE__ */ y(v, {
406
427
  htmlFor: `custom-widget-field-${e}`,
407
428
  children: e
408
- }), /* @__PURE__ */ x(y, {
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
- J?.length ? /* @__PURE__ */ x("p", {
443
+ q?.length ? /* @__PURE__ */ y("p", {
422
444
  className: "break-words text-xs text-text-secondary",
423
- children: k("bigconsole.widget.customWidget.fieldMapping.available", "Available: {{fields}}", { fields: J.join(", ") })
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
- R ? /* @__PURE__ */ x(e, {
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__ */ x("p", {
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: R
461
+ children: I
440
462
  })
441
463
  }) : null,
442
- /* @__PURE__ */ S("div", {
464
+ /* @__PURE__ */ b("div", {
443
465
  className: "flex flex-wrap gap-2 border-t border-[var(--color-border-subtle)] pt-3",
444
- children: [/* @__PURE__ */ S(v, {
466
+ children: [/* @__PURE__ */ b(g, {
445
467
  "data-testid": "custom-widget-approve",
446
- onClick: me,
447
- disabled: !Y.canApprove || H || W || I,
448
- children: [I ? /* @__PURE__ */ x(g, {
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__ */ x(h, {
473
+ }) : /* @__PURE__ */ y(se, {
452
474
  className: "mr-1 size-4",
453
475
  "aria-hidden": "true"
454
- }), k("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
455
- }), /* @__PURE__ */ x(v, {
476
+ }), E("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
477
+ }), /* @__PURE__ */ y(g, {
456
478
  variant: "outline",
457
- onClick: D,
479
+ onClick: w,
458
480
  "data-testid": "custom-widget-cancel",
459
- children: k("bigconsole.widget.customWidget.action.cancel", "Cancel")
481
+ children: E("bigconsole.widget.customWidget.action.cancel", "Cancel")
460
482
  })]
461
483
  })
462
- ] }) : /* @__PURE__ */ x(e, {
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__ */ x("p", {
489
+ children: /* @__PURE__ */ y("p", {
468
490
  className: "text-sm text-text-secondary",
469
491
  "data-testid": "custom-widget-empty",
470
- children: k("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.")
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 { w as CustomWidgetProposalPanel, w as default };
497
+ export { S as CustomWidgetProposalPanel, S as default };