@burdenoff/microfe-healthybowl 2026.802.2 → 2026.803.2

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,519 +1,287 @@
1
1
  import { formatDateOnly as e } from "../../utils/helpers.js";
2
2
  import { PageLayout as t } from "../../components/PageLayout.js";
3
- import { StatCard as n } from "../../components/StatCard.js";
4
- import { DataTable as r } from "../../components/DataTable.js";
5
- import { StatusBadge as i } from "../../components/StatusBadge.js";
6
- import { EmptyState as a } from "../../components/EmptyState.js";
7
- import { ErrorState as o } from "../../components/ErrorState.js";
8
- import { ToastContainer as s } from "../../components/Toast.js";
9
- import { useConfirm as ee } from "../../components/ConfirmDialog.js";
3
+ import { DataTable as n } from "../../components/DataTable.js";
4
+ import { StatusBadge as r } from "../../components/StatusBadge.js";
5
+ import { EmptyState as i } from "../../components/EmptyState.js";
6
+ import { ErrorState as a } from "../../components/ErrorState.js";
7
+ import { ToastContainer as o } from "../../components/Toast.js";
8
+ import { useConfirm as s } from "../../components/ConfirmDialog.js";
10
9
  import { Modal as c } from "../../components/Modal.js";
11
- import { useToast as te } from "../../hooks/useToast.js";
10
+ import { useToast as l } from "../../hooks/useToast.js";
12
11
  import "../../components/index.js";
13
- import { HB_WEBHOOK_EVENTS as l, useReportsApi as ne } from "../../hooks/useReportsApi.js";
14
- import { useMemo as re, useState as u } from "react";
15
- import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
16
- import { BarChart3 as d, Code2 as ae, Copy as f, ExternalLink as p, KeyRound as m, Plus as h, Trash2 as g, Webhook as _ } from "lucide-react";
17
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
18
- import { Button as x } from "@burdenoff/fe-libs/ui";
19
- import { getProductUrl as S } from "@burdenoff/fe-libs/shared/config";
12
+ import { HB_WEBHOOK_EVENTS as u, useReportsApi as d } from "../../hooks/useReportsApi.js";
13
+ import { useMemo as f, useState as p } from "react";
14
+ import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { BarChart3 as h, ExternalLink as g, Plus as _, Trash2 as v, Webhook as y } from "lucide-react";
16
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
17
+ import { Button as C } from "@burdenoff/fe-libs/ui";
18
+ import { getProductUrl as w } from "@burdenoff/fe-libs/shared/config";
20
19
  //#region src/healthybowl/pages/reports-api/ReportsApiPage.tsx
21
- var C = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", w = "https://api.gethealthybowl.com/v1";
22
- function oe(e) {
23
- return !e || e.length <= 10 ? "••••••••" : `${e.slice(0, 6)}…${e.slice(-4)}`;
24
- }
25
- function T() {
26
- let { t: T } = ie(), E = ee(), { toasts: D, toast: O, dismiss: se } = te(), { apiKeys: k, apiKeysLoading: ce, apiKeysError: A, createApiKey: le, revokeApiKey: ue, webhooks: j, webhooksLoading: de, webhooksError: M, createWebhook: fe, deleteWebhook: pe, dashboards: N, dashboardsLoading: me, dashboardsError: P } = ne(), [F, I] = u("keys"), [L, R] = u(!1), [z, B] = u(""), [V, H] = u(!1), [U, W] = u(!1), [G, K] = u(null), [he, q] = u(!1), [J, Y] = u(""), [X, ge] = u(l[0].value), [Z, Q] = u(!1), $ = re(() => {
20
+ var T = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]";
21
+ function E() {
22
+ let { t: E } = m(), D = s(), { toasts: O, toast: k, dismiss: A } = l(), { webhooks: j, webhooksLoading: M, webhooksError: N, createWebhook: P, deleteWebhook: F, dashboards: I, dashboardsLoading: L, dashboardsError: R } = d(), [z, B] = p("webhooks"), [V, H] = p(!1), [U, W] = p(""), [G, K] = p(u[0].value), [q, J] = p(!1), Y = f(() => {
27
23
  try {
28
- return S("bigconsole");
24
+ return w("bigconsole");
29
25
  } catch {
30
26
  return "https://app.bigconsole.com/";
31
27
  }
32
- }, []), _e = () => {
33
- B(""), H(!1), K(null), R(!0);
34
- }, ve = async () => {
35
- if (!z.trim()) {
36
- O({
37
- title: T("healthybowl.reportsApi.keys.nameRequired.title", "Name required"),
38
- description: T("healthybowl.reportsApi.keys.nameRequired.desc", "Give the key a recognizable name."),
39
- variant: "warning"
40
- });
41
- return;
42
- }
43
- W(!0);
44
- try {
45
- let e = V ? ["read", "write"] : ["read"], t = await le(z.trim(), e);
46
- t && (K(t), O({
47
- title: T("healthybowl.reportsApi.keys.created.title", "API key generated"),
48
- description: T("healthybowl.reportsApi.keys.created.desc", "Copy it now — it is shown only once."),
49
- variant: "success"
50
- }));
51
- } catch (e) {
52
- O({
53
- title: T("healthybowl.reportsApi.keys.createError.title", "Could not generate key"),
54
- description: e instanceof Error ? e.message : T("healthybowl.common.error", "Something went wrong."),
55
- variant: "error"
56
- });
57
- } finally {
58
- W(!1);
59
- }
60
- }, ye = async (e) => {
61
- if (await E({ message: T("healthybowl.reportsApi.keys.confirmRevoke", "Revoke \"{{name}}\"? Apps using it will stop working.", { name: e.name }) })) try {
62
- await ue(e.id), O({
63
- title: T("healthybowl.reportsApi.keys.revoked.title", "API key revoked"),
64
- variant: "success"
65
- });
66
- } catch (e) {
67
- O({
68
- title: T("healthybowl.reportsApi.keys.revokeError.title", "Could not revoke key"),
69
- description: e instanceof Error ? e.message : T("healthybowl.common.error", "Something went wrong."),
70
- variant: "error"
71
- });
72
- }
73
- }, be = async () => {
74
- if (!J.trim() || !/^https?:\/\//i.test(J.trim())) {
75
- O({
76
- title: T("healthybowl.reportsApi.webhooks.urlRequired.title", "Valid URL required"),
77
- description: T("healthybowl.reportsApi.webhooks.urlRequired.desc", "Enter the https URL to POST events to."),
28
+ }, []), X = async () => {
29
+ if (!U.trim() || !/^https?:\/\//i.test(U.trim())) {
30
+ k({
31
+ title: E("healthybowl.reportsApi.webhooks.urlRequired.title", "Valid URL required"),
32
+ description: E("healthybowl.reportsApi.webhooks.urlRequired.desc", "Enter the https URL to POST events to."),
78
33
  variant: "warning"
79
34
  });
80
35
  return;
81
36
  }
82
- Q(!0);
37
+ J(!0);
83
38
  try {
84
- await fe({
85
- name: `HealthyBowl · ${l.find((e) => e.value === X)?.label ?? X}`,
86
- url: J.trim(),
87
- events: [X]
88
- }), q(!1), Y(""), O({
89
- title: T("healthybowl.reportsApi.webhooks.added.title", "Webhook added"),
90
- description: T("healthybowl.reportsApi.webhooks.added.desc", "It will POST when the event fires."),
39
+ await P({
40
+ name: `HealthyBowl · ${u.find((e) => e.value === G)?.label ?? G}`,
41
+ url: U.trim(),
42
+ events: [G]
43
+ }), H(!1), W(""), k({
44
+ title: E("healthybowl.reportsApi.webhooks.added.title", "Webhook added"),
45
+ description: E("healthybowl.reportsApi.webhooks.added.desc", "It will POST when the event fires."),
91
46
  variant: "success"
92
47
  });
93
48
  } catch (e) {
94
- O({
95
- title: T("healthybowl.reportsApi.webhooks.addError.title", "Could not add webhook"),
96
- description: e instanceof Error ? e.message : T("healthybowl.common.error", "Something went wrong."),
49
+ k({
50
+ title: E("healthybowl.reportsApi.webhooks.addError.title", "Could not add webhook"),
51
+ description: e instanceof Error ? e.message : E("healthybowl.common.error", "Something went wrong."),
97
52
  variant: "error"
98
53
  });
99
54
  } finally {
100
- Q(!1);
55
+ J(!1);
101
56
  }
102
- }, xe = async (e) => {
103
- if (await E({ message: T("healthybowl.reportsApi.webhooks.confirmDelete", "Delete this webhook subscription?") })) try {
104
- await pe(e.id), O({
105
- title: T("healthybowl.reportsApi.webhooks.deleted.title", "Webhook deleted"),
57
+ }, Z = async (e) => {
58
+ if (await D({ message: E("healthybowl.reportsApi.webhooks.confirmDelete", "Delete this webhook subscription?") })) try {
59
+ await F(e.id), k({
60
+ title: E("healthybowl.reportsApi.webhooks.deleted.title", "Webhook deleted"),
106
61
  variant: "success"
107
62
  });
108
63
  } catch (e) {
109
- O({
110
- title: T("healthybowl.reportsApi.webhooks.deleteError.title", "Could not delete webhook"),
111
- description: e instanceof Error ? e.message : T("healthybowl.common.error", "Something went wrong."),
64
+ k({
65
+ title: E("healthybowl.reportsApi.webhooks.deleteError.title", "Could not delete webhook"),
66
+ description: e instanceof Error ? e.message : E("healthybowl.common.error", "Something went wrong."),
112
67
  variant: "error"
113
68
  });
114
69
  }
115
- }, Se = async (e) => {
116
- try {
117
- await navigator.clipboard.writeText(e), O({
118
- title: T("healthybowl.reportsApi.copied", "Copied to clipboard"),
119
- variant: "success"
120
- });
121
- } catch {
122
- O({
123
- title: T("healthybowl.reportsApi.copyFailed", "Copy failed"),
124
- variant: "error"
125
- });
126
- }
127
- }, Ce = [
128
- {
129
- key: "name",
130
- header: T("healthybowl.reportsApi.keys.col.name", "Name"),
131
- sortable: !0
132
- },
133
- {
134
- key: "key",
135
- header: T("healthybowl.reportsApi.keys.col.key", "Key"),
136
- render: (e) => /* @__PURE__ */ y("span", {
137
- className: "font-mono text-xs text-text-secondary",
138
- children: oe(e.key)
139
- })
140
- },
141
- {
142
- key: "permissions",
143
- header: T("healthybowl.reportsApi.keys.col.scope", "Scope"),
144
- render: (e) => /* @__PURE__ */ y("span", {
145
- className: "text-xs text-text-secondary",
146
- children: e.permissions.join(", ") || "—"
147
- })
148
- },
149
- {
150
- key: "createdAt",
151
- header: T("healthybowl.reportsApi.keys.col.created", "Created"),
152
- render: (t) => e(t.createdAt)
153
- },
154
- {
155
- key: "lastUsedAt",
156
- header: T("healthybowl.reportsApi.keys.col.lastUsed", "Last used"),
157
- render: (t) => t.lastUsedAt ? e(t.lastUsedAt) : T("healthybowl.reportsApi.never", "Never")
158
- },
159
- {
160
- key: "status",
161
- header: T("healthybowl.reportsApi.keys.col.status", "Status"),
162
- render: (e) => e.isActive ? /* @__PURE__ */ y(i, {
163
- label: T("healthybowl.reportsApi.active", "Active"),
164
- variant: "success",
165
- dot: !0
166
- }) : /* @__PURE__ */ y(i, {
167
- label: T("healthybowl.reportsApi.revoked", "Revoked"),
168
- variant: "muted"
169
- })
170
- },
171
- {
172
- key: "actions",
173
- header: "",
174
- render: (e) => e.isActive ? /* @__PURE__ */ b(x, {
175
- variant: "ghost",
176
- size: "sm",
177
- onClick: () => ye(e),
178
- children: [/* @__PURE__ */ y(g, { className: "mr-1 h-4 w-4" }), T("healthybowl.reportsApi.keys.revoke", "Revoke")]
179
- }) : null
180
- }
181
- ], we = [
70
+ }, Q = [
182
71
  {
183
72
  key: "events",
184
- header: T("healthybowl.reportsApi.webhooks.col.event", "Event"),
185
- render: (e) => /* @__PURE__ */ y("span", {
73
+ header: E("healthybowl.reportsApi.webhooks.col.event", "Event"),
74
+ render: (e) => /* @__PURE__ */ x("span", {
186
75
  className: "font-mono text-xs",
187
76
  children: e.events.join(", ")
188
77
  })
189
78
  },
190
79
  {
191
80
  key: "url",
192
- header: T("healthybowl.reportsApi.webhooks.col.url", "Target URL"),
193
- render: (e) => /* @__PURE__ */ y("span", {
81
+ header: E("healthybowl.reportsApi.webhooks.col.url", "Target URL"),
82
+ render: (e) => /* @__PURE__ */ x("span", {
194
83
  className: "max-w-[22rem] truncate font-mono text-xs text-text-secondary",
195
84
  children: e.url
196
85
  })
197
86
  },
198
87
  {
199
88
  key: "status",
200
- header: T("healthybowl.reportsApi.webhooks.col.status", "Status"),
201
- render: (e) => e.isActive ? e.lastError ? /* @__PURE__ */ y(i, {
202
- label: T("healthybowl.reportsApi.failed", "Failed"),
89
+ header: E("healthybowl.reportsApi.webhooks.col.status", "Status"),
90
+ render: (e) => e.isActive ? e.lastError ? /* @__PURE__ */ x(r, {
91
+ label: E("healthybowl.reportsApi.failed", "Failed"),
203
92
  variant: "error",
204
93
  dot: !0
205
- }) : /* @__PURE__ */ y(i, {
206
- label: T("healthybowl.reportsApi.active", "Active"),
94
+ }) : /* @__PURE__ */ x(r, {
95
+ label: E("healthybowl.reportsApi.active", "Active"),
207
96
  variant: "success",
208
97
  dot: !0
209
- }) : /* @__PURE__ */ y(i, {
210
- label: T("healthybowl.reportsApi.paused", "Paused"),
98
+ }) : /* @__PURE__ */ x(r, {
99
+ label: E("healthybowl.reportsApi.paused", "Paused"),
211
100
  variant: "muted"
212
101
  })
213
102
  },
214
103
  {
215
104
  key: "lastDelivery",
216
- header: T("healthybowl.reportsApi.webhooks.col.lastDelivery", "Last delivery"),
217
- render: (t) => t.lastDelivery ? e(t.lastDelivery) : T("healthybowl.reportsApi.never", "Never")
105
+ header: E("healthybowl.reportsApi.webhooks.col.lastDelivery", "Last delivery"),
106
+ render: (t) => t.lastDelivery ? e(t.lastDelivery) : E("healthybowl.reportsApi.never", "Never")
218
107
  },
219
108
  {
220
109
  key: "actions",
221
110
  header: "",
222
- render: (e) => /* @__PURE__ */ b(x, {
111
+ render: (e) => /* @__PURE__ */ S(C, {
223
112
  variant: "ghost",
224
113
  size: "sm",
225
- onClick: () => xe(e),
226
- children: [/* @__PURE__ */ y(g, { className: "mr-1 h-4 w-4" }), T("healthybowl.common.delete", "Delete")]
114
+ onClick: () => Z(e),
115
+ children: [/* @__PURE__ */ x(v, { className: "mr-1 h-4 w-4" }), E("healthybowl.common.delete", "Delete")]
227
116
  })
228
117
  }
229
- ], Te = [
118
+ ], $ = [
230
119
  {
231
120
  key: "name",
232
- header: T("healthybowl.reportsApi.reports.col.name", "Dashboard"),
121
+ header: E("healthybowl.reportsApi.reports.col.name", "Dashboard"),
233
122
  sortable: !0
234
123
  },
235
124
  {
236
125
  key: "category",
237
- header: T("healthybowl.reportsApi.reports.col.category", "Category"),
238
- render: (e) => /* @__PURE__ */ y("span", {
126
+ header: E("healthybowl.reportsApi.reports.col.category", "Category"),
127
+ render: (e) => /* @__PURE__ */ x("span", {
239
128
  className: "text-xs text-text-secondary",
240
129
  children: e.category
241
130
  })
242
131
  },
243
132
  {
244
133
  key: "updatedAt",
245
- header: T("healthybowl.reportsApi.reports.col.updated", "Updated"),
134
+ header: E("healthybowl.reportsApi.reports.col.updated", "Updated"),
246
135
  render: (t) => e(t.updatedAt)
247
136
  },
248
137
  {
249
138
  key: "actions",
250
139
  header: "",
251
- render: (e) => /* @__PURE__ */ b("a", {
252
- href: `${$}${$.endsWith("/") ? "" : "/"}dashboards/${e.id}`,
140
+ render: (e) => /* @__PURE__ */ S("a", {
141
+ href: `${Y}${Y.endsWith("/") ? "" : "/"}dashboards/${e.id}`,
253
142
  target: "_blank",
254
143
  rel: "noopener noreferrer",
255
144
  className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",
256
- children: [T("healthybowl.reportsApi.reports.open", "Open"), /* @__PURE__ */ y(p, { className: "h-3.5 w-3.5" })]
145
+ children: [E("healthybowl.reportsApi.reports.open", "Open"), /* @__PURE__ */ x(g, { className: "h-3.5 w-3.5" })]
257
146
  })
258
147
  }
259
- ], Ee = [
260
- {
261
- id: "keys",
262
- label: T("healthybowl.reportsApi.tab.keys", "API Keys"),
263
- icon: /* @__PURE__ */ y(m, { className: "h-4 w-4" })
264
- },
265
- {
266
- id: "webhooks",
267
- label: T("healthybowl.reportsApi.tab.webhooks", "Webhooks"),
268
- icon: /* @__PURE__ */ y(_, { className: "h-4 w-4" })
269
- },
270
- {
271
- id: "reports",
272
- label: T("healthybowl.reportsApi.tab.reports", "Reports & Dashboards"),
273
- icon: /* @__PURE__ */ y(d, { className: "h-4 w-4" })
274
- }
275
- ], De = k.filter((e) => e.isActive).length;
276
- return /* @__PURE__ */ b(t, {
277
- title: T("healthybowl.reportsApi.title", "Reports & API"),
278
- titleAccent: T("healthybowl.reportsApi.titleAccent", "API"),
148
+ ], ee = [{
149
+ id: "webhooks",
150
+ label: E("healthybowl.reportsApi.tab.webhooks", "Webhooks"),
151
+ icon: /* @__PURE__ */ x(y, { className: "h-4 w-4" })
152
+ }, {
153
+ id: "reports",
154
+ label: E("healthybowl.reportsApi.tab.reports", "Reports & Dashboards"),
155
+ icon: /* @__PURE__ */ x(h, { className: "h-4 w-4" })
156
+ }];
157
+ return /* @__PURE__ */ S(t, {
158
+ title: E("healthybowl.reportsApi.title", "Reports & API"),
159
+ titleAccent: E("healthybowl.reportsApi.titleAccent", "API"),
279
160
  hero: !0,
280
- description: T("healthybowl.reportsApi.description", "Build custom dashboards, issue developer API keys, and subscribe webhooks — one place to connect HealthyBowl to your other tools."),
281
- helpPrompt: T("healthybowl.reportsApi.help", "How do I use the HealthyBowl API keys, webhooks and custom dashboards?"),
161
+ description: E("healthybowl.reportsApi.description", "Build custom dashboards and subscribe webhooks — one place to connect HealthyBowl to your other tools."),
162
+ helpPrompt: E("healthybowl.reportsApi.help", "How do I use HealthyBowl webhooks and custom dashboards?"),
282
163
  children: [
283
- /* @__PURE__ */ y("div", {
164
+ /* @__PURE__ */ x("div", {
284
165
  className: "mb-6 flex flex-wrap gap-1 border-b border-border-subtle",
285
- children: Ee.map((e) => /* @__PURE__ */ b("button", {
166
+ children: ee.map((e) => /* @__PURE__ */ S("button", {
286
167
  type: "button",
287
- onClick: () => I(e.id),
288
- className: `flex items-center gap-2 border-b-2 px-4 py-2 text-sm font-medium transition-colors ${F === e.id ? "border-primary text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"}`,
168
+ onClick: () => B(e.id),
169
+ className: `flex items-center gap-2 border-b-2 px-4 py-2 text-sm font-medium transition-colors ${z === e.id ? "border-primary text-text-primary" : "border-transparent text-text-secondary hover:text-text-primary"}`,
289
170
  children: [e.icon, e.label]
290
171
  }, e.id))
291
172
  }),
292
- F === "keys" && /* @__PURE__ */ b("div", {
293
- className: "space-y-6",
294
- children: [
295
- /* @__PURE__ */ b("div", {
296
- className: "grid grid-cols-2 gap-4 sm:max-w-md",
297
- children: [/* @__PURE__ */ y(n, {
298
- label: T("healthybowl.reportsApi.keys.stat.total", "Total keys"),
299
- value: k.length,
300
- icon: /* @__PURE__ */ y(m, {})
301
- }), /* @__PURE__ */ y(n, {
302
- label: T("healthybowl.reportsApi.keys.stat.active", "Active"),
303
- value: De
304
- })]
305
- }),
306
- /* @__PURE__ */ b("div", {
307
- className: "flex items-center justify-between",
308
- children: [/* @__PURE__ */ y("p", {
309
- className: "text-sm text-text-secondary",
310
- children: T("healthybowl.reportsApi.keys.blurb", "Keys authenticate a third party reading THIS workspace’s data. Read-first, with role-based access control.")
311
- }), /* @__PURE__ */ b(x, {
312
- onClick: _e,
313
- children: [/* @__PURE__ */ y(h, { className: "mr-1 h-4 w-4" }), T("healthybowl.reportsApi.keys.generate", "Generate key")]
314
- })]
315
- }),
316
- /* @__PURE__ */ b("div", {
317
- className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
318
- children: [
319
- /* @__PURE__ */ b("div", {
320
- className: "mb-2 flex items-center gap-2 text-sm font-medium text-text-primary",
321
- children: [/* @__PURE__ */ y(ae, { className: "h-4 w-4" }), T("healthybowl.reportsApi.keys.endpoint.title", "Public API endpoint")]
322
- }),
323
- /* @__PURE__ */ y("pre", {
324
- className: "overflow-x-auto rounded-md bg-bg-muted p-3 font-mono text-xs text-text-secondary",
325
- children: `curl -H "Authorization: Bearer ak_…" \\\n ${w}/harvests`
326
- }),
327
- /* @__PURE__ */ y("p", {
328
- className: "mt-2 text-xs text-text-secondary",
329
- children: T("healthybowl.reportsApi.keys.endpoint.note", "Read endpoints (harvests, orders, crops) are scoped to your workspace with role-based access control. Send the key as a Bearer token.")
330
- })
331
- ]
332
- }),
333
- A ? /* @__PURE__ */ y(o, {
334
- title: T("healthybowl.reportsApi.keys.error", "Could not load API keys"),
335
- description: A
336
- }) : k.length === 0 && !ce ? /* @__PURE__ */ y(a, {
337
- icon: /* @__PURE__ */ y(m, {}),
338
- title: T("healthybowl.reportsApi.keys.empty.title", "No API keys yet"),
339
- description: T("healthybowl.reportsApi.keys.empty.desc", "Generate a key to let an external tool read your farm data.")
340
- }) : /* @__PURE__ */ y(r, {
341
- columns: Ce,
342
- data: k,
343
- keyField: "id"
344
- })
345
- ]
346
- }),
347
- F === "webhooks" && /* @__PURE__ */ b("div", {
173
+ z === "webhooks" && /* @__PURE__ */ S("div", {
348
174
  className: "space-y-6",
349
- children: [/* @__PURE__ */ b("div", {
175
+ children: [/* @__PURE__ */ S("div", {
350
176
  className: "flex items-center justify-between",
351
- children: [/* @__PURE__ */ y("p", {
177
+ children: [/* @__PURE__ */ x("p", {
352
178
  className: "text-sm text-text-secondary",
353
- children: T("healthybowl.reportsApi.webhooks.blurb", "POST an HB event to any URL or a Zapier hook when it fires — e.g. push every new harvest into a buyer’s system.")
354
- }), /* @__PURE__ */ b(x, {
355
- onClick: () => q(!0),
356
- children: [/* @__PURE__ */ y(h, { className: "mr-1 h-4 w-4" }), T("healthybowl.reportsApi.webhooks.add", "Add webhook")]
179
+ children: E("healthybowl.reportsApi.webhooks.blurb", "POST an HB event to any URL or a Zapier hook when it fires — e.g. push every new harvest into a buyer’s system.")
180
+ }), /* @__PURE__ */ S(C, {
181
+ onClick: () => H(!0),
182
+ children: [/* @__PURE__ */ x(_, { className: "mr-1 h-4 w-4" }), E("healthybowl.reportsApi.webhooks.add", "Add webhook")]
357
183
  })]
358
- }), M ? /* @__PURE__ */ y(o, {
359
- title: T("healthybowl.reportsApi.webhooks.error", "Could not load webhooks"),
360
- description: M
361
- }) : j.length === 0 && !de ? /* @__PURE__ */ y(a, {
362
- icon: /* @__PURE__ */ y(_, {}),
363
- title: T("healthybowl.reportsApi.webhooks.empty.title", "No webhooks yet"),
364
- description: T("healthybowl.reportsApi.webhooks.empty.desc", "Subscribe harvest.created or order.paid to an outbound URL.")
365
- }) : /* @__PURE__ */ y(r, {
366
- columns: we,
184
+ }), N ? /* @__PURE__ */ x(a, {
185
+ title: E("healthybowl.reportsApi.webhooks.error", "Could not load webhooks"),
186
+ description: N
187
+ }) : j.length === 0 && !M ? /* @__PURE__ */ x(i, {
188
+ icon: /* @__PURE__ */ x(y, {}),
189
+ title: E("healthybowl.reportsApi.webhooks.empty.title", "No webhooks yet"),
190
+ description: E("healthybowl.reportsApi.webhooks.empty.desc", "Subscribe harvest.created or order.paid to an outbound URL.")
191
+ }) : /* @__PURE__ */ x(n, {
192
+ columns: Q,
367
193
  data: j,
368
194
  keyField: "id"
369
195
  })]
370
196
  }),
371
- F === "reports" && /* @__PURE__ */ b("div", {
197
+ z === "reports" && /* @__PURE__ */ S("div", {
372
198
  className: "space-y-6",
373
- children: [/* @__PURE__ */ b("div", {
199
+ children: [/* @__PURE__ */ S("div", {
374
200
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
375
201
  children: [
376
- /* @__PURE__ */ b("div", {
202
+ /* @__PURE__ */ S("div", {
377
203
  className: "mb-1 flex items-center gap-2 text-base font-semibold text-text-primary",
378
- children: [/* @__PURE__ */ y(d, { className: "h-5 w-5" }), T("healthybowl.reportsApi.reports.builder.title", "Build a custom dashboard")]
204
+ children: [/* @__PURE__ */ x(h, { className: "h-5 w-5" }), E("healthybowl.reportsApi.reports.builder.title", "Build a custom dashboard")]
379
205
  }),
380
- /* @__PURE__ */ y("p", {
206
+ /* @__PURE__ */ x("p", {
381
207
  className: "mb-4 max-w-2xl text-sm text-text-secondary",
382
- children: T("healthybowl.reportsApi.reports.builder.desc", "Drag HealthyBowl data fields (crop yield, revenue, livestock count, compliance) onto a canvas and pick charts, KPI cards and tables — no engineering needed. Custom dashboards export to CSV/PDF and can be emailed on a schedule, all in BigConsole.")
208
+ children: E("healthybowl.reportsApi.reports.builder.desc", "Drag HealthyBowl data fields (crop yield, revenue, livestock count, compliance) onto a canvas and pick charts, KPI cards and tables — no engineering needed. Custom dashboards export to CSV/PDF and can be emailed on a schedule, all in BigConsole.")
383
209
  }),
384
- /* @__PURE__ */ y("a", {
385
- href: $,
210
+ /* @__PURE__ */ x("a", {
211
+ href: Y,
386
212
  target: "_blank",
387
213
  rel: "noopener noreferrer",
388
- children: /* @__PURE__ */ b(x, { children: [T("healthybowl.reportsApi.reports.builder.cta", "Open the dashboard builder"), /* @__PURE__ */ y(p, { className: "ml-1 h-4 w-4" })] })
214
+ children: /* @__PURE__ */ S(C, { children: [E("healthybowl.reportsApi.reports.builder.cta", "Open the dashboard builder"), /* @__PURE__ */ x(g, { className: "ml-1 h-4 w-4" })] })
389
215
  })
390
216
  ]
391
- }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h3", {
217
+ }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h3", {
392
218
  className: "mb-3 text-sm font-semibold text-text-primary",
393
- children: T("healthybowl.reportsApi.reports.saved.title", "Saved dashboards")
394
- }), P ? /* @__PURE__ */ y(o, {
395
- title: T("healthybowl.reportsApi.reports.error", "Could not load dashboards"),
396
- description: P
397
- }) : N.length === 0 && !me ? /* @__PURE__ */ y(a, {
398
- icon: /* @__PURE__ */ y(d, {}),
399
- title: T("healthybowl.reportsApi.reports.empty.title", "No custom dashboards yet"),
400
- description: T("healthybowl.reportsApi.reports.empty.desc", "Dashboards you build in BigConsole appear here.")
401
- }) : /* @__PURE__ */ y(r, {
402
- columns: Te,
403
- data: N,
219
+ children: E("healthybowl.reportsApi.reports.saved.title", "Saved dashboards")
220
+ }), R ? /* @__PURE__ */ x(a, {
221
+ title: E("healthybowl.reportsApi.reports.error", "Could not load dashboards"),
222
+ description: R
223
+ }) : I.length === 0 && !L ? /* @__PURE__ */ x(i, {
224
+ icon: /* @__PURE__ */ x(h, {}),
225
+ title: E("healthybowl.reportsApi.reports.empty.title", "No custom dashboards yet"),
226
+ description: E("healthybowl.reportsApi.reports.empty.desc", "Dashboards you build in BigConsole appear here.")
227
+ }) : /* @__PURE__ */ x(n, {
228
+ columns: $,
229
+ data: I,
404
230
  keyField: "id"
405
231
  })] })]
406
232
  }),
407
- /* @__PURE__ */ y(c, {
408
- open: L,
409
- onClose: () => R(!1),
410
- title: G ? T("healthybowl.reportsApi.keys.modal.createdTitle", "API key created") : T("healthybowl.reportsApi.keys.modal.title", "Generate API key"),
411
- description: G ? T("healthybowl.reportsApi.keys.modal.createdDesc", "Copy this key now — it will not be shown again.") : T("healthybowl.reportsApi.keys.modal.desc", "Name the key and choose its scope."),
412
- size: "md",
413
- footer: G ? /* @__PURE__ */ y(x, {
414
- onClick: () => R(!1),
415
- children: T("healthybowl.common.done", "Done")
416
- }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(x, {
417
- variant: "outline",
418
- onClick: () => R(!1),
419
- children: T("healthybowl.common.cancel", "Cancel")
420
- }), /* @__PURE__ */ y(x, {
421
- onClick: ve,
422
- disabled: U,
423
- children: U ? T("healthybowl.reportsApi.keys.generating", "Generating…") : T("healthybowl.reportsApi.keys.generate", "Generate key")
424
- })] }),
425
- children: G ? /* @__PURE__ */ b("div", {
426
- className: "space-y-3",
427
- children: [/* @__PURE__ */ b("div", {
428
- className: "flex items-center gap-2",
429
- children: [/* @__PURE__ */ y("code", {
430
- className: "flex-1 overflow-x-auto rounded-md border border-border-subtle bg-bg-muted p-3 font-mono text-xs text-text-primary",
431
- children: G.key
432
- }), /* @__PURE__ */ b(x, {
433
- variant: "outline",
434
- size: "sm",
435
- onClick: () => Se(G.key),
436
- children: [/* @__PURE__ */ y(f, { className: "mr-1 h-4 w-4" }), T("healthybowl.common.copy", "Copy")]
437
- })]
438
- }), /* @__PURE__ */ y("p", {
439
- className: "text-xs text-text-secondary",
440
- children: T("healthybowl.reportsApi.keys.modal.storeSafe", "Store it in your secrets manager. If you lose it, revoke and generate a new one.")
441
- })]
442
- }) : /* @__PURE__ */ b("div", {
443
- className: "space-y-4",
444
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
445
- htmlFor: "key-name",
446
- className: "mb-1 block text-sm font-medium text-text-primary",
447
- children: T("healthybowl.reportsApi.keys.form.name", "Key name *")
448
- }), /* @__PURE__ */ y("input", {
449
- id: "key-name",
450
- type: "text",
451
- value: z,
452
- onChange: (e) => B(e.target.value),
453
- placeholder: T("healthybowl.reportsApi.keys.form.namePlaceholder", "e.g., Buyer integration"),
454
- className: C
455
- })] }), /* @__PURE__ */ b("label", {
456
- className: "flex items-center gap-2 text-sm text-text-primary",
457
- children: [/* @__PURE__ */ y("input", {
458
- type: "checkbox",
459
- checked: V,
460
- onChange: (e) => H(e.target.checked)
461
- }), T("healthybowl.reportsApi.keys.form.allowWrite", "Allow write access (default is read-only)")]
462
- })]
463
- })
464
- }),
465
- /* @__PURE__ */ y(c, {
466
- open: he,
467
- onClose: () => q(!1),
468
- title: T("healthybowl.reportsApi.webhooks.modal.title", "Add webhook"),
469
- description: T("healthybowl.reportsApi.webhooks.modal.desc", "Pick an event and the URL to POST it to."),
233
+ /* @__PURE__ */ x(c, {
234
+ open: V,
235
+ onClose: () => H(!1),
236
+ title: E("healthybowl.reportsApi.webhooks.modal.title", "Add webhook"),
237
+ description: E("healthybowl.reportsApi.webhooks.modal.desc", "Pick an event and the URL to POST it to."),
470
238
  size: "md",
471
- footer: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(x, {
239
+ footer: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
472
240
  variant: "outline",
473
- onClick: () => q(!1),
474
- children: T("healthybowl.common.cancel", "Cancel")
475
- }), /* @__PURE__ */ y(x, {
476
- onClick: be,
477
- disabled: Z,
478
- children: Z ? T("healthybowl.reportsApi.webhooks.adding", "Adding…") : T("healthybowl.reportsApi.webhooks.add", "Add webhook")
241
+ onClick: () => H(!1),
242
+ children: E("healthybowl.common.cancel", "Cancel")
243
+ }), /* @__PURE__ */ x(C, {
244
+ onClick: X,
245
+ disabled: q,
246
+ children: q ? E("healthybowl.reportsApi.webhooks.adding", "Adding…") : E("healthybowl.reportsApi.webhooks.add", "Add webhook")
479
247
  })] }),
480
- children: /* @__PURE__ */ b("div", {
248
+ children: /* @__PURE__ */ S("div", {
481
249
  className: "space-y-4",
482
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
250
+ children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
483
251
  htmlFor: "hook-event",
484
252
  className: "mb-1 block text-sm font-medium text-text-primary",
485
- children: T("healthybowl.reportsApi.webhooks.form.event", "Event")
486
- }), /* @__PURE__ */ y("select", {
253
+ children: E("healthybowl.reportsApi.webhooks.form.event", "Event")
254
+ }), /* @__PURE__ */ x("select", {
487
255
  id: "hook-event",
488
- value: X,
489
- onChange: (e) => ge(e.target.value),
490
- className: C,
491
- children: l.map((e) => /* @__PURE__ */ y("option", {
256
+ value: G,
257
+ onChange: (e) => K(e.target.value),
258
+ className: T,
259
+ children: u.map((e) => /* @__PURE__ */ x("option", {
492
260
  value: e.value,
493
261
  children: e.label
494
262
  }, e.value))
495
- })] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
263
+ })] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
496
264
  htmlFor: "hook-url",
497
265
  className: "mb-1 block text-sm font-medium text-text-primary",
498
- children: T("healthybowl.reportsApi.webhooks.form.url", "Target URL *")
499
- }), /* @__PURE__ */ y("input", {
266
+ children: E("healthybowl.reportsApi.webhooks.form.url", "Target URL *")
267
+ }), /* @__PURE__ */ x("input", {
500
268
  id: "hook-url",
501
269
  type: "url",
502
- value: J,
503
- onChange: (e) => Y(e.target.value),
270
+ value: U,
271
+ onChange: (e) => W(e.target.value),
504
272
  placeholder: "https://hooks.zapier.com/…",
505
- className: C
273
+ className: T
506
274
  })] })]
507
275
  })
508
276
  }),
509
- /* @__PURE__ */ y(s, {
510
- toasts: D,
511
- onDismiss: se
277
+ /* @__PURE__ */ x(o, {
278
+ toasts: O,
279
+ onDismiss: A
512
280
  })
513
281
  ]
514
282
  });
515
283
  }
516
284
  //#endregion
517
- export { T as ReportsApiPage };
285
+ export { E as ReportsApiPage };
518
286
 
519
287
  //# sourceMappingURL=ReportsApiPage.js.map