@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.
@@ -5,50 +5,50 @@ import "../../contexts/index.js";
5
5
  import { ParserTypeBadge as r } from "./ParserTypeBadge.js";
6
6
  import { ParserStatusBadge as i } from "./ParserStatusBadge.js";
7
7
  import "../common/index.js";
8
- import { Fragment as a, memo as o, useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
9
- import { Plus as d } from "lucide-react";
10
- import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ import { Fragment as a, memo as o, useCallback as s, useEffect as c, useId as l, useMemo as u, useState as d } from "react";
9
+ import { Plus as f } from "lucide-react";
10
+ import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
12
  // src/bigconsole/components/parser/ParserSelector.tsx
13
- var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y border-[var(--color-border-default)]", _ = "text-xs font-semibold uppercase tracking-wide text-text-secondary", v = ({ className: e }) => /* @__PURE__ */ p("svg", {
13
+ var g = "default", _ = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y border-[var(--color-border-default)]", v = "text-xs font-semibold uppercase tracking-wide text-text-secondary", y = ({ className: e }) => /* @__PURE__ */ m("svg", {
14
14
  className: e,
15
15
  fill: "none",
16
16
  stroke: "currentColor",
17
17
  viewBox: "0 0 24 24",
18
- children: /* @__PURE__ */ p("path", {
18
+ children: /* @__PURE__ */ m("path", {
19
19
  strokeLinecap: "round",
20
20
  strokeLinejoin: "round",
21
21
  strokeWidth: 2,
22
22
  d: "M19 9l-7 7-7-7"
23
23
  })
24
- }), y = ({ className: e }) => /* @__PURE__ */ m("svg", {
24
+ }), b = ({ className: e }) => /* @__PURE__ */ h("svg", {
25
25
  className: e,
26
26
  fill: "none",
27
27
  stroke: "currentColor",
28
28
  viewBox: "0 0 24 24",
29
29
  children: [
30
- /* @__PURE__ */ p("path", {
30
+ /* @__PURE__ */ m("path", {
31
31
  strokeLinecap: "round",
32
32
  strokeLinejoin: "round",
33
33
  strokeWidth: 2,
34
34
  d: "M12 21a9 9 0 100-18 9 9 0 000 18z"
35
35
  }),
36
- /* @__PURE__ */ p("path", {
36
+ /* @__PURE__ */ m("path", {
37
37
  strokeLinecap: "round",
38
38
  strokeLinejoin: "round",
39
39
  strokeWidth: 2,
40
40
  d: "M3.6 9h16.8M3.6 15h16.8"
41
41
  }),
42
- /* @__PURE__ */ p("path", {
42
+ /* @__PURE__ */ m("path", {
43
43
  strokeLinecap: "round",
44
44
  strokeLinejoin: "round",
45
45
  strokeWidth: 2,
46
46
  d: "M12 3a15 15 0 014 9 15 15 0 01-4 9 15 15 0 01-4-9 15 15 0 014-9z"
47
47
  })
48
48
  ]
49
- }), b = o(function({ parser: e, isSelected: t, onSelect: a, isGlobal: o = !1 }) {
50
- let { t: s } = f();
51
- return /* @__PURE__ */ p("button", {
49
+ }), x = o(function({ parser: e, isSelected: t, onSelect: a, isGlobal: o = !1 }) {
50
+ let { t: s } = p();
51
+ return /* @__PURE__ */ m("button", {
52
52
  type: "button",
53
53
  onClick: () => a(e.id),
54
54
  className: `
@@ -60,35 +60,35 @@ var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y bor
60
60
  ${n}
61
61
  ${t ? "bg-action-primary-bg/10" : ""}
62
62
  `,
63
- children: /* @__PURE__ */ m("div", {
63
+ children: /* @__PURE__ */ h("div", {
64
64
  className: "flex items-start justify-between gap-2",
65
- children: [/* @__PURE__ */ m("div", {
65
+ children: [/* @__PURE__ */ h("div", {
66
66
  className: "flex-1 min-w-0",
67
67
  children: [
68
- /* @__PURE__ */ m("div", {
68
+ /* @__PURE__ */ h("div", {
69
69
  className: "flex items-center gap-2 mb-1",
70
70
  children: [
71
- /* @__PURE__ */ p(r, {
71
+ /* @__PURE__ */ m(r, {
72
72
  type: e.type,
73
73
  size: "sm"
74
74
  }),
75
- /* @__PURE__ */ p("span", {
75
+ /* @__PURE__ */ m("span", {
76
76
  className: "text-sm font-medium text-text-primary truncate",
77
77
  children: e.name
78
78
  }),
79
- o && /* @__PURE__ */ m("span", {
79
+ o && /* @__PURE__ */ h("span", {
80
80
  className: "inline-flex items-center gap-1 px-1.5 py-0.5 text-xs bg-bg-sunken text-text-secondary rounded",
81
- children: [/* @__PURE__ */ p(y, { className: "w-3 h-3" }), s("bigconsole.parsers.selector.globalBadge", "Global")]
81
+ children: [/* @__PURE__ */ m(b, { className: "w-3 h-3" }), s("bigconsole.parsers.selector.globalBadge", "Global")]
82
82
  })
83
83
  ]
84
84
  }),
85
- e.description && /* @__PURE__ */ p("p", {
85
+ e.description && /* @__PURE__ */ m("p", {
86
86
  className: "text-xs text-text-secondary line-clamp-1 mb-1",
87
87
  children: e.description
88
88
  }),
89
- /* @__PURE__ */ p("div", {
89
+ /* @__PURE__ */ m("div", {
90
90
  className: "flex min-w-0 items-center gap-2 text-xs text-text-muted",
91
- children: /* @__PURE__ */ m("span", {
91
+ children: /* @__PURE__ */ h("span", {
92
92
  className: "truncate font-mono",
93
93
  children: [
94
94
  e.inputSinkKey,
@@ -98,9 +98,9 @@ var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y bor
98
98
  })
99
99
  })
100
100
  ]
101
- }), /* @__PURE__ */ p("div", {
101
+ }), /* @__PURE__ */ m("div", {
102
102
  className: "shrink-0",
103
- children: /* @__PURE__ */ p(i, {
103
+ children: /* @__PURE__ */ m(i, {
104
104
  status: e.status,
105
105
  size: "sm",
106
106
  showIcon: !1
@@ -108,95 +108,95 @@ var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y bor
108
108
  })]
109
109
  })
110
110
  });
111
- }), x = o(function({ consoleId: i, value: o, resolvedParser: y, onChange: x, filterType: S, filterStatus: C = "active", filterInputSinkKey: w, placeholder: T, disabled: E = !1, error: D = !1, errorMessage: O }) {
112
- let { t: k } = f(), [A, j] = u(!1), [M, N] = u(""), P = T ?? k("bigconsole.parsers.selector.placeholder", "Select a parser..."), F = e(), I = i === h, { parsers: L, loading: R, fetchParsers: z } = t({
111
+ }), S = o(function({ consoleId: i, value: o, resolvedParser: b, onChange: S, filterType: C, filterStatus: w = "active", filterInputSinkKey: T, placeholder: E, disabled: D = !1, error: O = !1, errorMessage: k }) {
112
+ let { t: A } = p(), [j, M] = d(!1), [N, P] = d(""), F = E ?? A("bigconsole.parsers.selector.placeholder", "Select a parser..."), I = e(), L = l(), R = i === g, { parsers: z, loading: B, fetchParsers: V } = t({
113
113
  consoleId: i,
114
- skipFetch: I
115
- }), { parsers: B, loading: V, fetchParsers: H } = t({
116
- consoleId: h,
117
- skipFetch: I
118
- }), U = l(() => {
119
- if (I) return L;
120
- let e = new Set(L.map((e) => e.id)), t = B.filter((t) => !e.has(t.id));
121
- return [...L, ...t];
114
+ skipFetch: R
115
+ }), { parsers: H, loading: U, fetchParsers: W } = t({
116
+ consoleId: g,
117
+ skipFetch: R
118
+ }), G = u(() => {
119
+ if (R) return z;
120
+ let e = new Set(z.map((e) => e.id)), t = H.filter((t) => !e.has(t.id));
121
+ return [...z, ...t];
122
122
  }, [
123
- L,
124
- B,
125
- I
126
- ]), W = R || V, G = l(() => U.filter((e) => {
127
- if (S && e.type !== S || C && e.status !== C || w && e.inputSinkKey !== w) return !1;
128
- if (M) {
129
- let t = M.toLowerCase();
123
+ z,
124
+ H,
125
+ R
126
+ ]), K = B || U, q = u(() => G.filter((e) => {
127
+ if (C && e.type !== C || w && e.status !== w || T && e.inputSinkKey !== T) return !1;
128
+ if (N) {
129
+ let t = N.toLowerCase();
130
130
  return e.name.toLowerCase().includes(t) || e.description?.toLowerCase().includes(t) || e.inputSinkKey.toLowerCase().includes(t) || e.outputKey.toLowerCase().includes(t);
131
131
  }
132
132
  return !0;
133
133
  }), [
134
- U,
135
- S,
134
+ G,
136
135
  C,
137
136
  w,
138
- M
139
- ]), { dashboardScopedParsers: K, globalScopedParsers: q } = l(() => ({
140
- dashboardScopedParsers: G.filter((e) => e.consoleId !== h),
141
- globalScopedParsers: G.filter((e) => e.consoleId === h)
142
- }), [G]), J = U.find((e) => e.id === o) ?? (y?.id === o ? y : void 0);
137
+ T,
138
+ N
139
+ ]), { dashboardScopedParsers: J, globalScopedParsers: Y } = u(() => ({
140
+ dashboardScopedParsers: q.filter((e) => e.consoleId !== g),
141
+ globalScopedParsers: q.filter((e) => e.consoleId === g)
142
+ }), [q]), X = G.find((e) => e.id === o) ?? (b?.id === o ? b : void 0);
143
143
  c(() => {
144
- i && (z({
145
- type: S,
146
- status: C ?? void 0
147
- }), I || H({
148
- type: S,
149
- status: C ?? void 0
144
+ i && (V({
145
+ type: C,
146
+ status: w ?? void 0
147
+ }), R || W({
148
+ type: C,
149
+ status: w ?? void 0
150
150
  }));
151
151
  }, [
152
152
  i,
153
- S,
154
153
  C,
155
154
  w,
156
- z,
157
- H,
158
- I
155
+ T,
156
+ V,
157
+ W,
158
+ R
159
159
  ]);
160
- let Y = s((e) => {
161
- x(e), j(!1), N("");
162
- }, [x]), X = s(() => {
163
- if (E) return;
164
- let e = !A;
165
- e && (z({
166
- type: S,
167
- status: C ?? void 0
168
- }), I || H({
169
- type: S,
170
- status: C ?? void 0
171
- })), j(e);
160
+ let Z = s((e) => {
161
+ S(e), M(!1), P("");
162
+ }, [S]), Q = s(() => {
163
+ if (D) return;
164
+ let e = !j;
165
+ e && (V({
166
+ type: C,
167
+ status: w ?? void 0
168
+ }), R || W({
169
+ type: C,
170
+ status: w ?? void 0
171
+ })), M(e);
172
172
  }, [
173
- E,
174
- A,
175
- z,
176
- H,
177
- S,
173
+ D,
174
+ j,
175
+ V,
176
+ W,
178
177
  C,
179
- I
180
- ]), Z = s(() => {
181
- j(!1);
182
- }, []), Q = s(() => {
183
- j(!1);
184
- let e = I ? "/parsers/new" : `/dashboards/${i}/parsers/new`;
185
- window.open(F(e), "_blank", "noopener,noreferrer");
178
+ w,
179
+ R
180
+ ]), $ = s(() => {
181
+ M(!1);
182
+ }, []), ee = s(() => {
183
+ M(!1);
184
+ let e = R ? "/parsers/new" : `/dashboards/${i}/parsers/new`;
185
+ window.open(I(e), "_blank", "noopener,noreferrer");
186
186
  }, [
187
- F,
187
+ I,
188
188
  i,
189
- I
189
+ R
190
190
  ]);
191
- return /* @__PURE__ */ m("div", {
191
+ return /* @__PURE__ */ h("div", {
192
192
  className: "relative",
193
193
  children: [
194
- /* @__PURE__ */ m("button", {
194
+ /* @__PURE__ */ h("button", {
195
195
  type: "button",
196
- onClick: X,
197
- disabled: E,
196
+ onClick: Q,
197
+ disabled: D,
198
198
  "aria-haspopup": "listbox",
199
- "aria-expanded": A,
199
+ "aria-expanded": j,
200
200
  className: `
201
201
  w-full min-w-0 min-h-control-md
202
202
  px-3 py-2
@@ -206,63 +206,63 @@ var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y bor
206
206
  flex items-center justify-between gap-2
207
207
  motion-safe:transition-colors
208
208
  ${n}
209
- ${E ? "opacity-50 cursor-not-allowed" : "hover:border-action-primary-bg cursor-pointer"}
210
- ${D ? "border-status-error-border" : "border-[var(--color-border-default)]"}
211
- ${A ? "border-action-primary-bg ring-2 ring-action-primary-bg/20" : ""}
209
+ ${D ? "opacity-50 cursor-not-allowed" : "hover:border-action-primary-bg cursor-pointer"}
210
+ ${O ? "border-status-error-border" : "border-[var(--color-border-default)]"}
211
+ ${j ? "border-action-primary-bg ring-2 ring-action-primary-bg/20" : ""}
212
212
  `,
213
- children: [/* @__PURE__ */ p("div", {
213
+ children: [/* @__PURE__ */ m("div", {
214
214
  className: "flex-1 min-w-0",
215
- children: J ? /* @__PURE__ */ m("div", {
215
+ children: X ? /* @__PURE__ */ h("div", {
216
216
  className: "flex min-w-0 items-center gap-2",
217
- children: [/* @__PURE__ */ p(r, {
218
- type: J.type,
217
+ children: [/* @__PURE__ */ m(r, {
218
+ type: X.type,
219
219
  size: "sm"
220
- }), /* @__PURE__ */ p("span", {
220
+ }), /* @__PURE__ */ m("span", {
221
221
  className: "text-sm text-text-primary truncate",
222
- children: J.name
222
+ children: X.name
223
223
  })]
224
- }) : /* @__PURE__ */ p("span", {
224
+ }) : /* @__PURE__ */ m("span", {
225
225
  className: "text-sm text-text-muted",
226
- children: P
226
+ children: F
227
227
  })
228
- }), /* @__PURE__ */ p(v, {
228
+ }), /* @__PURE__ */ m(y, {
229
229
  "aria-hidden": "true",
230
- className: `w-4 h-4 shrink-0 text-text-secondary motion-safe:transition-transform ${A ? "transform rotate-180" : ""}`
230
+ className: `w-4 h-4 shrink-0 text-text-secondary motion-safe:transition-transform ${j ? "transform rotate-180" : ""}`
231
231
  })]
232
232
  }),
233
- D && O && /* @__PURE__ */ p("p", {
233
+ O && k && /* @__PURE__ */ m("p", {
234
234
  className: "mt-1 text-xs text-status-error-text",
235
- children: O
235
+ children: k
236
236
  }),
237
- A && /* @__PURE__ */ m(a, { children: [/* @__PURE__ */ p("div", {
237
+ j && /* @__PURE__ */ h(a, { children: [/* @__PURE__ */ m("div", {
238
238
  className: "fixed inset-0 z-10",
239
- onClick: Z
240
- }), /* @__PURE__ */ m("div", {
241
- className: "absolute left-0 right-0 top-full mt-1 z-20 bg-bg-surface border border-[var(--color-border-default)] rounded-md shadow-lg max-h-80 flex flex-col overflow-hidden",
239
+ onClick: $
240
+ }), /* @__PURE__ */ h("div", {
241
+ className: `absolute left-0 right-0 top-full mt-1 z-20 bg-bg-surface border border-[var(--color-border-default)] rounded-md shadow-lg ${R ? "max-h-80" : "max-h-[21rem]"} flex flex-col overflow-hidden`,
242
242
  children: [
243
- /* @__PURE__ */ p("div", {
243
+ /* @__PURE__ */ m("div", {
244
244
  className: "p-2 border-b border-[var(--color-border-default)]",
245
- children: /* @__PURE__ */ p("input", {
245
+ children: /* @__PURE__ */ m("input", {
246
246
  type: "text",
247
- "aria-label": k("bigconsole.parsers.selector.searchPlaceholder", "Search parsers..."),
248
- placeholder: k("bigconsole.parsers.selector.searchPlaceholder", "Search parsers..."),
249
- value: M,
250
- onChange: (e) => N(e.target.value),
247
+ "aria-label": A("bigconsole.parsers.selector.searchPlaceholder", "Search parsers..."),
248
+ placeholder: A("bigconsole.parsers.selector.searchPlaceholder", "Search parsers..."),
249
+ value: N,
250
+ onChange: (e) => P(e.target.value),
251
251
  className: "\n w-full min-w-0 min-h-control-md px-3 py-2\n bg-bg-sunken\n border border-[var(--color-border-default)]\n rounded-md\n text-sm text-text-primary\n placeholder:text-text-muted\n focus:outline-none\n focus:border-action-primary-bg\n focus:ring-2\n focus:ring-action-primary-bg/20\n "
252
252
  })
253
253
  }),
254
- /* @__PURE__ */ p("div", {
254
+ /* @__PURE__ */ m("div", {
255
255
  className: "overflow-y-auto flex-1",
256
- children: W ? /* @__PURE__ */ p("div", {
256
+ children: K ? /* @__PURE__ */ m("div", {
257
257
  className: "p-4 text-center text-sm text-text-secondary",
258
- children: k("bigconsole.parsers.selector.loading", "Loading parsers...")
259
- }) : G.length === 0 ? /* @__PURE__ */ p("div", {
258
+ children: A("bigconsole.parsers.selector.loading", "Loading parsers...")
259
+ }) : q.length === 0 ? /* @__PURE__ */ m("div", {
260
260
  className: "p-4 text-center text-sm text-text-secondary",
261
- children: k("bigconsole.parsers.selector.empty", "No parsers found")
262
- }) : /* @__PURE__ */ m(a, { children: [
263
- /* @__PURE__ */ p("button", {
261
+ children: A("bigconsole.parsers.selector.empty", "No parsers found")
262
+ }) : /* @__PURE__ */ h(a, { children: [
263
+ /* @__PURE__ */ m("button", {
264
264
  type: "button",
265
- onClick: () => Y(null),
265
+ onClick: () => Z(null),
266
266
  className: `
267
267
  w-full min-h-control-md px-3 py-2
268
268
  text-left text-sm
@@ -271,48 +271,53 @@ var h = "default", g = "sticky top-0 z-[1] bg-bg-sunken px-3 py-1.5 border-y bor
271
271
  focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface
272
272
  ${o === null ? "bg-action-primary-bg/10 text-action-primary-bg" : "text-text-secondary"}
273
273
  `,
274
- children: /* @__PURE__ */ p("span", {
274
+ children: /* @__PURE__ */ m("span", {
275
275
  className: "italic",
276
- children: k("bigconsole.parsers.selector.none", "None")
276
+ children: A("bigconsole.parsers.selector.none", "None")
277
277
  })
278
278
  }),
279
- K.length > 0 && /* @__PURE__ */ m(a, { children: [/* @__PURE__ */ p("div", {
280
- className: g,
281
- children: /* @__PURE__ */ p("span", {
282
- className: _,
283
- children: k("bigconsole.parsers.selector.dashboardParsers", "Dashboard Parsers")
279
+ J.length > 0 && /* @__PURE__ */ h(a, { children: [/* @__PURE__ */ m("div", {
280
+ className: _,
281
+ children: /* @__PURE__ */ m("span", {
282
+ className: v,
283
+ children: A("bigconsole.parsers.selector.dashboardParsers", "Dashboard Parsers")
284
284
  })
285
- }), K.map((e) => /* @__PURE__ */ p(b, {
285
+ }), J.map((e) => /* @__PURE__ */ m(x, {
286
286
  parser: e,
287
287
  isSelected: o === e.id,
288
- onSelect: Y
288
+ onSelect: Z
289
289
  }, e.id))] }),
290
- q.length > 0 && /* @__PURE__ */ m(a, { children: [/* @__PURE__ */ p("div", {
291
- className: g,
292
- children: /* @__PURE__ */ p("span", {
293
- className: _,
294
- children: k("bigconsole.parsers.selector.globalParsers", "Global Parsers")
290
+ Y.length > 0 && /* @__PURE__ */ h(a, { children: [/* @__PURE__ */ m("div", {
291
+ className: _,
292
+ children: /* @__PURE__ */ m("span", {
293
+ className: v,
294
+ children: A("bigconsole.parsers.selector.globalParsers", "Global Parsers")
295
295
  })
296
- }), q.map((e) => /* @__PURE__ */ p(b, {
296
+ }), Y.map((e) => /* @__PURE__ */ m(x, {
297
297
  parser: e,
298
298
  isSelected: o === e.id,
299
- onSelect: Y,
299
+ onSelect: Z,
300
300
  isGlobal: !0
301
301
  }, e.id))] })
302
302
  ] })
303
303
  }),
304
- /* @__PURE__ */ p("div", {
304
+ /* @__PURE__ */ h("div", {
305
305
  className: "p-2 border-t border-border-default",
306
- children: /* @__PURE__ */ m("button", {
306
+ children: [/* @__PURE__ */ h("button", {
307
307
  type: "button",
308
- onClick: Q,
308
+ onClick: ee,
309
+ "aria-describedby": R ? void 0 : L,
309
310
  className: "\n w-full flex items-center gap-2\n px-3 py-2\n text-sm font-medium text-action-primary-bg\n rounded-md\n hover:bg-action-primary-bg/10\n transition-colors\n ",
310
- children: [/* @__PURE__ */ p(d, { className: "w-4 h-4" }), k("bigconsole.parsers.selector.createNew", "Create new parser")]
311
- })
311
+ children: [/* @__PURE__ */ m(f, { className: "w-4 h-4" }), R ? A("bigconsole.parsers.selector.createNew", "Create new parser") : A("bigconsole.parsers.selector.createNewForDashboard", "Create new parser for this dashboard")]
312
+ }), !R && /* @__PURE__ */ m("p", {
313
+ id: L,
314
+ className: "m-0 px-3 text-xs leading-4 text-text-muted",
315
+ children: A("bigconsole.parsers.selector.createNewDashboardHint", "Only this dashboard can use it.")
316
+ })]
312
317
  })
313
318
  ]
314
319
  })] })
315
320
  ]
316
321
  });
317
322
  });
318
- export { x as ParserSelector, x as default };
323
+ export { S as ParserSelector, S as default };
@@ -6,46 +6,47 @@ import r from "../hooks/useParserOperations.js";
6
6
  import "../hooks/index.js";
7
7
  import { CustomWidgetProposalPanel as i } from "./CustomWidgetProposalPanel.js";
8
8
  import { loadDirectProposalPreview as a } from "./proposalPreview.js";
9
- import { selectActiveProposalSinks as o } from "./proposalSource.js";
10
- import { memo as s, useCallback as c, useMemo as l } from "react";
11
- import { Sheet as u, SheetContent as d, SheetDescription as f, SheetHeader as p, SheetTitle as m } from "@burdenoff/fe-libs/ui";
12
- import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
- import { useApolloClient as g } from "@apollo/client/react";
14
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
9
+ import { mappedFields as o } from "./proposalContract.js";
10
+ import { selectActiveProposalSinks as s } from "./proposalSource.js";
11
+ import { memo as c, useCallback as l, useMemo as u } from "react";
12
+ import { Sheet as d, SheetContent as f, SheetDescription as p, SheetHeader as m, SheetTitle as h } from "@burdenoff/fe-libs/ui";
13
+ import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
+ import { useApolloClient as _ } from "@apollo/client/react";
15
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
15
16
  // src/bigconsole/customWidget/CustomWidgetBuilderSheet.tsx
16
- var y = {
17
+ var b = {
17
18
  x: 0,
18
19
  y: 0,
19
20
  width: 6,
20
21
  height: 4
21
- }, b = "default", x = s(function({ isOpen: s, onClose: x, dashboardId: S, pageId: C, source: w }) {
22
- let { t: T } = h(), E = g(), { workspaceId: D } = e(), { dataSinks: O } = n({ skipFetch: !s }), { createWidget: k } = t(C, S, { skipFetch: !0 }), A = S === b, { parsers: j, executeParser: M } = r({
23
- consoleId: S,
24
- skipFetch: !s
25
- }), { parsers: N } = r({
26
- consoleId: b,
27
- skipFetch: !s || A
28
- }), P = l(() => o(O), [O]), F = l(() => {
29
- let e = new Set(j.map((e) => e.id));
30
- return [...j, ...N.filter((t) => !e.has(t.id))].map((e) => ({
22
+ }, x = "default", S = c(function({ isOpen: c, onClose: S, dashboardId: C, pageId: w, source: T }) {
23
+ let { t: E } = g(), D = _(), { workspaceId: O } = e(), { dataSinks: k } = n({ skipFetch: !c }), { createWidget: A } = t(w, C, { skipFetch: !0 }), j = C === x, { parsers: M, executeParser: N } = r({
24
+ consoleId: C,
25
+ skipFetch: !c
26
+ }), { parsers: P } = r({
27
+ consoleId: x,
28
+ skipFetch: !c || j
29
+ }), F = u(() => s(k), [k]), I = u(() => {
30
+ let e = new Set(M.map((e) => e.id));
31
+ return [...M, ...P.filter((t) => !e.has(t.id))].map((e) => ({
31
32
  id: e.id,
32
33
  name: e.name,
33
34
  inputSinkKey: e.inputSinkKey
34
35
  }));
35
- }, [j, N]), I = c(async (e) => {
36
- if (!e.binding.parserId) return a(E, e.binding, D);
37
- let t = await M(e.binding.parserId);
38
- if (!t || !t.success) throw Error(t?.error || T("bigconsole.widget.customWidget.error.couldNotResolveBinding", "Could not resolve the binding."));
36
+ }, [M, P]), L = l(async (e) => {
37
+ if (!e.binding.parserId) return a(D, e.binding, O);
38
+ let t = await N(e.binding.parserId);
39
+ if (!t || !t.success) throw Error(t?.error || E("bigconsole.widget.customWidget.error.couldNotResolveBinding", "Could not resolve the binding."));
39
40
  return t.output;
40
41
  }, [
42
+ D,
43
+ N,
41
44
  E,
42
- M,
43
- T,
44
- D
45
- ]), L = c(async (e) => {
46
- if (!await k({
47
- pageId: C,
48
- dashboardId: S,
45
+ O
46
+ ]), R = l(async (e) => {
47
+ if (!await A({
48
+ pageId: w,
49
+ dashboardId: C,
49
50
  type: e.widgetType,
50
51
  title: e.presentation.title,
51
52
  description: e.presentation.description,
@@ -53,23 +54,23 @@ var y = {
53
54
  parserId: e.binding.parserId,
54
55
  config: {
55
56
  ...e.presentation.config,
56
- ...e.fieldMapping,
57
+ ...o(e.fieldMapping),
57
58
  generatedBy: e.generatedBy,
58
59
  sourcePrompt: e.sourcePrompt,
59
60
  proposalVersion: e.version
60
61
  },
61
- position: { ...y }
62
- })) throw Error(T("bigconsole.widget.customWidget.error.widgetNotCreated", "The widget could not be created."));
62
+ position: { ...b }
63
+ })) throw Error(E("bigconsole.widget.customWidget.error.widgetNotCreated", "The widget could not be created."));
63
64
  }, [
64
- k,
65
+ A,
66
+ w,
65
67
  C,
66
- S,
67
- T
68
+ E
68
69
  ]);
69
- return /* @__PURE__ */ _(u, {
70
- open: s,
71
- onOpenChange: (e) => !e && x(),
72
- children: /* @__PURE__ */ v(d, {
70
+ return /* @__PURE__ */ v(d, {
71
+ open: c,
72
+ onOpenChange: (e) => !e && S(),
73
+ children: /* @__PURE__ */ y(f, {
73
74
  style: {
74
75
  width: "min(480px, 100vw)",
75
76
  maxWidth: "100vw",
@@ -77,29 +78,29 @@ var y = {
77
78
  display: "flex",
78
79
  flexDirection: "column"
79
80
  },
80
- children: [/* @__PURE__ */ v(p, {
81
+ children: [/* @__PURE__ */ y(m, {
81
82
  style: {
82
83
  padding: "var(--space-cardPadding)",
83
84
  borderBottom: "1px solid var(--color-border-subtle)",
84
85
  backgroundColor: "var(--color-bg-surface)",
85
86
  flexShrink: 0
86
87
  },
87
- children: [/* @__PURE__ */ _(m, { children: T("bigconsole.widget.customWidget.sheet.title", "AI custom widget") }), /* @__PURE__ */ _(f, { children: T("bigconsole.widget.customWidget.sheet.description", "Describe a widget, review the proposal, then approve it onto the dashboard.") })]
88
- }), /* @__PURE__ */ _("div", {
88
+ children: [/* @__PURE__ */ v(h, { children: E("bigconsole.widget.customWidget.sheet.title", "AI custom widget") }), /* @__PURE__ */ v(p, { children: E("bigconsole.widget.customWidget.sheet.description", "Describe a widget, review the proposal, then approve it onto the dashboard.") })]
89
+ }), /* @__PURE__ */ v("div", {
89
90
  style: {
90
91
  flex: 1,
91
92
  minHeight: 0
92
93
  },
93
- children: /* @__PURE__ */ _(i, {
94
- sinks: P,
95
- parsers: F,
96
- resolvePreviewData: I,
97
- onApprove: L,
98
- onClose: x,
99
- source: w
94
+ children: /* @__PURE__ */ v(i, {
95
+ sinks: F,
96
+ parsers: I,
97
+ resolvePreviewData: L,
98
+ onApprove: R,
99
+ onClose: S,
100
+ source: T
100
101
  })
101
102
  })]
102
103
  })
103
104
  });
104
105
  });
105
- export { x as CustomWidgetBuilderSheet, x as default };
106
+ export { S as CustomWidgetBuilderSheet, S as default };