@burdenoff/microfe-bigconsole 2026.1121.2 → 2026.1121.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,72 +3,72 @@ import { useBigConsole as t } from "../../context/BigConsoleContext.js";
3
3
  import "../../context/index.js";
4
4
  import { CreateQueryWidget as n } from "../explore/CreateQueryWidget.js";
5
5
  import { reportBigConsoleQuotaError as r } from "../../utils/quota.js";
6
- import { exploreErrorMessage as i } from "../explore/exploreErrors.js";
7
- import { workspaceRequest as a } from "../explore/useExploreRun.js";
8
- import { useOptionalTr as o } from "../../../shared/hooks/useTr.js";
9
- import { STATUS_HEADING as s, barWidths as c, defaultWidgetTitle as l, toRows as u } from "./askAnswer.js";
10
- import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
11
- import { useApolloClient as h } from "@apollo/client/react";
12
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
6
+ import { workspaceRequest as i } from "../explore/useExploreRun.js";
7
+ import { exploreErrorMessage as a, withoutError as o } from "../explore/exploreErrors.js";
8
+ import { useOptionalTr as s } from "../../../shared/hooks/useTr.js";
9
+ import { STATUS_HEADING as c, barWidths as l, defaultWidgetTitle as u, toRows as d } from "./askAnswer.js";
10
+ import { useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
11
+ import { useApolloClient as g } from "@apollo/client/react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
13
  // src/bigconsole/components/ask/AskYourData.tsx
14
- var v = 500;
15
- function y({ answer: e, workspaceId: t }) {
16
- let r = u(e.rows, e.columns.length), [i, a] = m(!1), o = e.chart, s = o ? e.columns.indexOf(o.categoryColumn) : -1, d = o ? e.columns.indexOf(o.valueColumn) : -1, f = o && d >= 0 ? c(r.map((e) => e[d] ?? null)) : [], p = e.provenance;
17
- return /* @__PURE__ */ _("div", {
14
+ var y = 500;
15
+ function b({ answer: e, workspaceId: t }) {
16
+ let r = d(e.rows, e.columns.length), [i, a] = h(!1), o = e.chart, s = o ? e.columns.indexOf(o.categoryColumn) : -1, c = o ? e.columns.indexOf(o.valueColumn) : -1, f = o && c >= 0 ? l(r.map((e) => e[c] ?? null)) : [], p = e.provenance;
17
+ return /* @__PURE__ */ v("div", {
18
18
  className: "space-y-3",
19
19
  children: [
20
- /* @__PURE__ */ g("p", {
20
+ /* @__PURE__ */ _("p", {
21
21
  className: "text-base font-medium text-text-primary",
22
22
  children: e.headline
23
23
  }),
24
- o && s >= 0 && d >= 0 && /* @__PURE__ */ g("ul", {
24
+ o && s >= 0 && c >= 0 && /* @__PURE__ */ _("ul", {
25
25
  "aria-label": `${o.valueColumn} by ${o.categoryColumn}`,
26
26
  className: "space-y-1",
27
- children: r.map((e, t) => /* @__PURE__ */ _("li", {
27
+ children: r.map((e, t) => /* @__PURE__ */ v("li", {
28
28
  className: "grid grid-cols-[8rem_1fr_6rem] items-center gap-2 text-sm",
29
29
  children: [
30
- /* @__PURE__ */ g("span", {
30
+ /* @__PURE__ */ _("span", {
31
31
  className: "truncate",
32
32
  children: String(e[s])
33
33
  }),
34
- /* @__PURE__ */ g("span", {
34
+ /* @__PURE__ */ _("span", {
35
35
  className: "h-3 rounded bg-bg-surface",
36
36
  "aria-hidden": "true",
37
- children: /* @__PURE__ */ g("span", {
37
+ children: /* @__PURE__ */ _("span", {
38
38
  className: "block h-3 rounded bg-action-primary-bg",
39
39
  style: { width: `${f[t] ?? 0}%` }
40
40
  })
41
41
  }),
42
- /* @__PURE__ */ g("span", {
42
+ /* @__PURE__ */ _("span", {
43
43
  className: "text-right tabular-nums",
44
- children: String(e[d])
44
+ children: String(e[c])
45
45
  })
46
46
  ]
47
47
  }, t))
48
48
  }),
49
- e.truncated && /* @__PURE__ */ g("p", {
49
+ e.truncated && /* @__PURE__ */ _("p", {
50
50
  role: "status",
51
51
  className: "text-sm font-medium text-text-primary",
52
52
  children: "Only part of the result is shown; the service limit was reached, so treat these rows as incomplete."
53
53
  }),
54
- r.length > 0 && /* @__PURE__ */ g("div", {
54
+ r.length > 0 && /* @__PURE__ */ _("div", {
55
55
  className: "max-h-72 overflow-auto rounded border border-border-default",
56
56
  tabIndex: 0,
57
57
  "aria-label": "Answer data",
58
- children: /* @__PURE__ */ _("table", {
58
+ children: /* @__PURE__ */ v("table", {
59
59
  className: "w-full text-left text-sm",
60
- children: [/* @__PURE__ */ g("thead", {
60
+ children: [/* @__PURE__ */ _("thead", {
61
61
  className: "sticky top-0 bg-bg-surface",
62
- children: /* @__PURE__ */ g("tr", { children: e.columns.map((e) => /* @__PURE__ */ g("th", {
62
+ children: /* @__PURE__ */ _("tr", { children: e.columns.map((e) => /* @__PURE__ */ _("th", {
63
63
  scope: "col",
64
64
  className: "px-3 py-2",
65
65
  children: e
66
66
  }, e)) })
67
- }), /* @__PURE__ */ g("tbody", { children: r.map((e, t) => /* @__PURE__ */ g("tr", {
67
+ }), /* @__PURE__ */ _("tbody", { children: r.map((e, t) => /* @__PURE__ */ _("tr", {
68
68
  className: "border-t border-border-default",
69
- children: e.map((e, t) => /* @__PURE__ */ g("td", {
69
+ children: e.map((e, t) => /* @__PURE__ */ _("td", {
70
70
  className: "px-3 py-1.5",
71
- children: e === null ? /* @__PURE__ */ g("i", {
71
+ children: e === null ? /* @__PURE__ */ _("i", {
72
72
  className: "text-text-secondary",
73
73
  children: "NULL"
74
74
  }) : String(e)
@@ -76,25 +76,25 @@ function y({ answer: e, workspaceId: t }) {
76
76
  }, t)) })]
77
77
  })
78
78
  }),
79
- p && /* @__PURE__ */ _("details", {
79
+ p && /* @__PURE__ */ v("details", {
80
80
  className: "rounded border border-border-default p-3 text-sm",
81
81
  children: [
82
- /* @__PURE__ */ g("summary", {
82
+ /* @__PURE__ */ _("summary", {
83
83
  className: "cursor-pointer font-medium",
84
84
  children: "How I got this"
85
85
  }),
86
- /* @__PURE__ */ _("dl", {
86
+ /* @__PURE__ */ v("dl", {
87
87
  className: "mt-2 space-y-1",
88
88
  children: [
89
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
89
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
90
90
  className: "inline font-medium",
91
91
  children: "Data source: "
92
- }), /* @__PURE__ */ _("dd", {
92
+ }), /* @__PURE__ */ v("dd", {
93
93
  className: "inline",
94
94
  children: [
95
95
  p.sourceName,
96
96
  " ",
97
- /* @__PURE__ */ _("span", {
97
+ /* @__PURE__ */ v("span", {
98
98
  className: "text-text-secondary",
99
99
  children: [
100
100
  "(",
@@ -104,74 +104,74 @@ function y({ answer: e, workspaceId: t }) {
104
104
  })
105
105
  ]
106
106
  })] }),
107
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
107
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
108
108
  className: "inline font-medium",
109
109
  children: "Parser: "
110
- }), /* @__PURE__ */ g("dd", {
110
+ }), /* @__PURE__ */ _("dd", {
111
111
  className: "inline",
112
112
  children: p.parser
113
113
  })] }),
114
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
114
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
115
115
  className: "inline font-medium",
116
116
  children: "Fields: "
117
- }), /* @__PURE__ */ g("dd", {
117
+ }), /* @__PURE__ */ _("dd", {
118
118
  className: "inline",
119
119
  children: p.fieldsUsed.map((e) => `${e.name} (${e.type})`).join(", ")
120
120
  })] }),
121
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
121
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
122
122
  className: "inline font-medium",
123
123
  children: "Aggregation: "
124
- }), /* @__PURE__ */ g("dd", {
124
+ }), /* @__PURE__ */ _("dd", {
125
125
  className: "inline",
126
126
  children: p.aggregations.join(", ")
127
127
  })] }),
128
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
128
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
129
129
  className: "inline font-medium",
130
130
  children: "Grouped by: "
131
- }), /* @__PURE__ */ g("dd", {
131
+ }), /* @__PURE__ */ _("dd", {
132
132
  className: "inline",
133
133
  children: p.grouping.length ? p.grouping.join(", ") : "nothing"
134
134
  })] }),
135
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
135
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
136
136
  className: "inline font-medium",
137
137
  children: "Filters: "
138
- }), /* @__PURE__ */ g("dd", {
138
+ }), /* @__PURE__ */ _("dd", {
139
139
  className: "inline",
140
140
  children: p.filters.length ? p.filters.join("; ") : "none"
141
141
  })] }),
142
- p.timeRange && /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
142
+ p.timeRange && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
143
143
  className: "inline font-medium",
144
144
  children: "Time range: "
145
- }), /* @__PURE__ */ g("dd", {
145
+ }), /* @__PURE__ */ _("dd", {
146
146
  className: "inline",
147
147
  children: p.timeRange
148
148
  })] }),
149
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
149
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
150
150
  className: "inline font-medium",
151
151
  children: "Metric: "
152
- }), /* @__PURE__ */ g("dd", {
152
+ }), /* @__PURE__ */ _("dd", {
153
153
  className: "inline",
154
154
  children: p.metricDefinition
155
155
  })] }),
156
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("dt", {
156
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
157
157
  className: "inline font-medium",
158
158
  children: "Query: "
159
- }), /* @__PURE__ */ g("dd", {
159
+ }), /* @__PURE__ */ _("dd", {
160
160
  className: "inline",
161
- children: /* @__PURE__ */ g("code", {
161
+ children: /* @__PURE__ */ _("code", {
162
162
  className: "break-all",
163
163
  children: p.query
164
164
  })
165
165
  })] })
166
166
  ]
167
167
  }),
168
- p.limitations.length > 0 && /* @__PURE__ */ g("ul", {
168
+ p.limitations.length > 0 && /* @__PURE__ */ _("ul", {
169
169
  className: "mt-2 list-disc pl-5 text-text-secondary",
170
- children: p.limitations.map((e) => /* @__PURE__ */ g("li", { children: e }, e))
170
+ children: p.limitations.map((e) => /* @__PURE__ */ _("li", { children: e }, e))
171
171
  })
172
172
  ]
173
173
  }),
174
- e.usage && /* @__PURE__ */ _("p", {
174
+ e.usage && /* @__PURE__ */ v("p", {
175
175
  className: "text-xs text-text-secondary",
176
176
  children: [
177
177
  e.usage.model,
@@ -183,11 +183,11 @@ function y({ answer: e, workspaceId: t }) {
183
183
  e.usage.credits == null ? "" : ` · ${e.usage.credits} AI credits`
184
184
  ]
185
185
  }),
186
- e.spec != null && (i ? /* @__PURE__ */ g(n, {
186
+ e.spec != null && (i ? /* @__PURE__ */ _(n, {
187
187
  askSpec: e.spec,
188
- name: l(e),
188
+ name: u(e),
189
189
  workspaceId: t
190
- }) : /* @__PURE__ */ g("button", {
190
+ }) : /* @__PURE__ */ _("button", {
191
191
  type: "button",
192
192
  className: "rounded border border-border-default px-3 py-1.5 text-sm",
193
193
  onClick: () => a(!0),
@@ -196,128 +196,128 @@ function y({ answer: e, workspaceId: t }) {
196
196
  ]
197
197
  });
198
198
  }
199
- function b() {
200
- let n = h(), c = o(), { workspaceId: l, currentUser: u } = t(), b = u?.id ?? "", [x, S] = m(""), [C, w] = m(null), [T, E] = m(""), [D, O] = m(!1), [k, A] = m(""), j = p(0);
201
- f(() => () => {
202
- j.current += 1;
199
+ function x() {
200
+ let n = g(), l = s(), { workspaceId: u, currentUser: d } = t(), x = d?.id ?? "", [S, C] = h(""), [w, T] = h(null), [E, D] = h(""), [O, k] = h(!1), [A, j] = h(""), M = m(0);
201
+ p(() => () => {
202
+ M.current += 1;
203
203
  }, []);
204
- let M = d(async (t) => {
205
- let o = t.trim();
206
- if (!o || o.length > v || !l) return;
207
- let s = ++j.current;
208
- O(!0), A(""), w(null), E(o);
204
+ let N = f(async (t) => {
205
+ let s = t.trim();
206
+ if (!s || s.length > y || !u) return;
207
+ let c = ++M.current;
208
+ k(!0), j(""), T(null), D(s);
209
209
  try {
210
- let { data: t } = await n.query({
210
+ let { data: t } = o(await n.query({
211
211
  query: e,
212
- variables: { question: o },
212
+ variables: { question: s },
213
213
  fetchPolicy: "network-only",
214
- context: a(l)
215
- });
216
- if (s !== j.current) return;
214
+ context: i(u)
215
+ }));
216
+ if (c !== M.current) return;
217
217
  if (!t?.bigconsoleAsk) throw Error("Missing answer");
218
- w(t.bigconsoleAsk);
218
+ T(t.bigconsoleAsk);
219
219
  } catch (e) {
220
- if (s !== j.current || r(e, "command")) return;
221
- A(i(e, c));
220
+ if (c !== M.current || r(e, "command")) return;
221
+ j(a(e, l));
222
222
  } finally {
223
- s === j.current && O(!1);
223
+ c === M.current && k(!1);
224
224
  }
225
225
  }, [
226
226
  n,
227
- l,
228
- b,
229
- c
227
+ u,
228
+ x,
229
+ l
230
230
  ]);
231
- return /* @__PURE__ */ _("section", {
231
+ return /* @__PURE__ */ v("section", {
232
232
  "aria-labelledby": "ask-heading",
233
233
  className: "space-y-3 rounded border border-border-default bg-bg-surface p-4",
234
234
  children: [
235
- /* @__PURE__ */ g("h2", {
235
+ /* @__PURE__ */ _("h2", {
236
236
  id: "ask-heading",
237
237
  className: "m-0 text-lg font-semibold text-text-primary",
238
238
  children: "Ask your data"
239
239
  }),
240
- /* @__PURE__ */ g("p", {
240
+ /* @__PURE__ */ _("p", {
241
241
  className: "m-0 text-sm text-text-secondary",
242
242
  children: "Ask a question about data already in your workspace. Answers come from a verified query over the data you may see; nothing is changed."
243
243
  }),
244
- /* @__PURE__ */ _("form", {
244
+ /* @__PURE__ */ v("form", {
245
245
  onSubmit: (e) => {
246
- e.preventDefault(), M(x);
246
+ e.preventDefault(), N(S);
247
247
  },
248
248
  className: "flex flex-wrap items-end gap-2",
249
- children: [/* @__PURE__ */ _("label", {
249
+ children: [/* @__PURE__ */ v("label", {
250
250
  className: "flex min-w-[16rem] flex-1 flex-col gap-1 text-sm",
251
251
  htmlFor: "ask-input",
252
- children: ["Your question", /* @__PURE__ */ g("input", {
252
+ children: ["Your question", /* @__PURE__ */ _("input", {
253
253
  id: "ask-input",
254
254
  className: "rounded border border-border-default bg-bg-surface px-3 py-2",
255
- value: x,
256
- maxLength: v,
255
+ value: S,
256
+ maxLength: y,
257
257
  placeholder: "e.g. Which region had the most revenue in August?",
258
- onChange: (e) => S(e.target.value)
258
+ onChange: (e) => C(e.target.value)
259
259
  })]
260
- }), /* @__PURE__ */ g("button", {
260
+ }), /* @__PURE__ */ _("button", {
261
261
  type: "submit",
262
- disabled: D || !x.trim() || !l,
262
+ disabled: O || !S.trim() || !u,
263
263
  className: "rounded bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-fg disabled:opacity-60",
264
- children: D ? "Asking…" : "Ask"
264
+ children: O ? "Asking…" : "Ask"
265
265
  })]
266
266
  }),
267
- !l && /* @__PURE__ */ g("p", {
267
+ !u && /* @__PURE__ */ _("p", {
268
268
  role: "status",
269
269
  className: "m-0 text-sm text-text-secondary",
270
270
  children: "Select a workspace to ask a question."
271
271
  }),
272
- /* @__PURE__ */ _("div", {
272
+ /* @__PURE__ */ v("div", {
273
273
  "aria-live": "polite",
274
274
  children: [
275
- D && /* @__PURE__ */ g("p", {
275
+ O && /* @__PURE__ */ _("p", {
276
276
  role: "status",
277
277
  children: "Finding the answer in your data…"
278
278
  }),
279
- k && /* @__PURE__ */ g("p", {
279
+ A && /* @__PURE__ */ _("p", {
280
280
  role: "alert",
281
- children: k
281
+ children: A
282
282
  }),
283
- C && /* @__PURE__ */ _("p", {
283
+ w && /* @__PURE__ */ v("p", {
284
284
  className: "m-0 text-sm text-text-secondary",
285
285
  "data-testid": "ask-asked",
286
- children: ["Answer to: ", /* @__PURE__ */ g("q", { children: T })]
286
+ children: ["Answer to: ", /* @__PURE__ */ _("q", { children: E })]
287
287
  }),
288
- C?.status === "VERIFIED" && /* @__PURE__ */ g(y, {
289
- answer: C,
290
- workspaceId: l ?? ""
291
- }, T + C.headline),
292
- C && C.status !== "VERIFIED" && /* @__PURE__ */ _("div", {
288
+ w?.status === "VERIFIED" && /* @__PURE__ */ _(b, {
289
+ answer: w,
290
+ workspaceId: u ?? ""
291
+ }, E + w.headline),
292
+ w && w.status !== "VERIFIED" && /* @__PURE__ */ v("div", {
293
293
  className: "space-y-2",
294
- "data-status": C.status,
294
+ "data-status": w.status,
295
295
  children: [
296
- /* @__PURE__ */ g("h3", {
296
+ /* @__PURE__ */ _("h3", {
297
297
  className: "m-0 text-base font-medium",
298
- children: s[C.status]
298
+ children: c[w.status]
299
299
  }),
300
- C.message && /* @__PURE__ */ g("p", {
300
+ w.message && /* @__PURE__ */ _("p", {
301
301
  className: "m-0 text-sm",
302
- children: C.message
302
+ children: w.message
303
303
  }),
304
- C.clarificationOptions.length > 0 && /* @__PURE__ */ g("div", {
304
+ w.clarificationOptions.length > 0 && /* @__PURE__ */ _("div", {
305
305
  className: "flex flex-wrap gap-2",
306
306
  role: "group",
307
307
  "aria-label": "Choose a data source",
308
- children: C.clarificationOptions.map((e) => /* @__PURE__ */ g("button", {
308
+ children: w.clarificationOptions.map((e) => /* @__PURE__ */ _("button", {
309
309
  type: "button",
310
310
  className: "rounded border border-border-default px-3 py-1 text-sm",
311
311
  onClick: () => {
312
- let t = ` (use ${e.name})`, n = T.slice(0, Math.max(0, v - t.length)) + t;
313
- S(n), M(n);
312
+ let t = ` (use ${e.name})`, n = E.slice(0, Math.max(0, y - t.length)) + t;
313
+ C(n), N(n);
314
314
  },
315
315
  children: e.name
316
316
  }, e.id))
317
317
  }),
318
- C.provenance && /* @__PURE__ */ _("p", {
318
+ w.provenance && /* @__PURE__ */ v("p", {
319
319
  className: "m-0 text-xs text-text-secondary",
320
- children: ["Looked at: ", C.provenance.sourceName]
320
+ children: ["Looked at: ", w.provenance.sourceName]
321
321
  })
322
322
  ]
323
323
  })
@@ -326,8 +326,8 @@ function b() {
326
326
  ]
327
327
  });
328
328
  }
329
- function x() {
329
+ function S() {
330
330
  let { workspaceId: e, currentUser: n } = t();
331
- return /* @__PURE__ */ g(b, {}, `${e ?? ""}|${n?.id ?? ""}`);
331
+ return /* @__PURE__ */ _(x, {}, `${e ?? ""}|${n?.id ?? ""}`);
332
332
  }
333
- export { x as AskYourData };
333
+ export { S as AskYourData };