@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.
- package/dist/healthybowl/hooks/useReportsApi.js +26 -63
- package/dist/healthybowl/hooks/useReportsApi.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +9 -16
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/reports-api/ReportsApiPage.js +152 -384
- package/dist/healthybowl/pages/reports-api/ReportsApiPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
10
|
+
import { useToast as l } from "../../hooks/useToast.js";
|
|
12
11
|
import "../../components/index.js";
|
|
13
|
-
import { HB_WEBHOOK_EVENTS as
|
|
14
|
-
import { useMemo as
|
|
15
|
-
import { useI18n as
|
|
16
|
-
import { BarChart3 as
|
|
17
|
-
import { Fragment as
|
|
18
|
-
import { Button as
|
|
19
|
-
import { getProductUrl as
|
|
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
|
|
22
|
-
function
|
|
23
|
-
|
|
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
|
|
24
|
+
return w("bigconsole");
|
|
29
25
|
} catch {
|
|
30
26
|
return "https://app.bigconsole.com/";
|
|
31
27
|
}
|
|
32
|
-
}, []),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
37
|
+
J(!0);
|
|
83
38
|
try {
|
|
84
|
-
await
|
|
85
|
-
name: `HealthyBowl · ${
|
|
86
|
-
url:
|
|
87
|
-
events: [
|
|
88
|
-
}),
|
|
89
|
-
title:
|
|
90
|
-
description:
|
|
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
|
-
|
|
95
|
-
title:
|
|
96
|
-
description: e instanceof Error ? e.message :
|
|
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
|
-
|
|
55
|
+
J(!1);
|
|
101
56
|
}
|
|
102
|
-
},
|
|
103
|
-
if (await
|
|
104
|
-
await
|
|
105
|
-
title:
|
|
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
|
-
|
|
110
|
-
title:
|
|
111
|
-
description: e instanceof Error ? e.message :
|
|
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
|
-
},
|
|
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:
|
|
185
|
-
render: (e) => /* @__PURE__ */
|
|
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:
|
|
193
|
-
render: (e) => /* @__PURE__ */
|
|
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:
|
|
201
|
-
render: (e) => e.isActive ? e.lastError ? /* @__PURE__ */
|
|
202
|
-
label:
|
|
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__ */
|
|
206
|
-
label:
|
|
94
|
+
}) : /* @__PURE__ */ x(r, {
|
|
95
|
+
label: E("healthybowl.reportsApi.active", "Active"),
|
|
207
96
|
variant: "success",
|
|
208
97
|
dot: !0
|
|
209
|
-
}) : /* @__PURE__ */
|
|
210
|
-
label:
|
|
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:
|
|
217
|
-
render: (t) => t.lastDelivery ? e(t.lastDelivery) :
|
|
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__ */
|
|
111
|
+
render: (e) => /* @__PURE__ */ S(C, {
|
|
223
112
|
variant: "ghost",
|
|
224
113
|
size: "sm",
|
|
225
|
-
onClick: () =>
|
|
226
|
-
children: [/* @__PURE__ */
|
|
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
|
-
],
|
|
118
|
+
], $ = [
|
|
230
119
|
{
|
|
231
120
|
key: "name",
|
|
232
|
-
header:
|
|
121
|
+
header: E("healthybowl.reportsApi.reports.col.name", "Dashboard"),
|
|
233
122
|
sortable: !0
|
|
234
123
|
},
|
|
235
124
|
{
|
|
236
125
|
key: "category",
|
|
237
|
-
header:
|
|
238
|
-
render: (e) => /* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
252
|
-
href: `${
|
|
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: [
|
|
145
|
+
children: [E("healthybowl.reportsApi.reports.open", "Open"), /* @__PURE__ */ x(g, { className: "h-3.5 w-3.5" })]
|
|
257
146
|
})
|
|
258
147
|
}
|
|
259
|
-
],
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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:
|
|
281
|
-
helpPrompt:
|
|
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__ */
|
|
164
|
+
/* @__PURE__ */ x("div", {
|
|
284
165
|
className: "mb-6 flex flex-wrap gap-1 border-b border-border-subtle",
|
|
285
|
-
children:
|
|
166
|
+
children: ee.map((e) => /* @__PURE__ */ S("button", {
|
|
286
167
|
type: "button",
|
|
287
|
-
onClick: () =>
|
|
288
|
-
className: `flex items-center gap-2 border-b-2 px-4 py-2 text-sm font-medium transition-colors ${
|
|
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
|
-
|
|
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__ */
|
|
175
|
+
children: [/* @__PURE__ */ S("div", {
|
|
350
176
|
className: "flex items-center justify-between",
|
|
351
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ x("p", {
|
|
352
178
|
className: "text-sm text-text-secondary",
|
|
353
|
-
children:
|
|
354
|
-
}), /* @__PURE__ */
|
|
355
|
-
onClick: () =>
|
|
356
|
-
children: [/* @__PURE__ */
|
|
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
|
-
}),
|
|
359
|
-
title:
|
|
360
|
-
description:
|
|
361
|
-
}) : j.length === 0 && !
|
|
362
|
-
icon: /* @__PURE__ */ y
|
|
363
|
-
title:
|
|
364
|
-
description:
|
|
365
|
-
}) : /* @__PURE__ */
|
|
366
|
-
columns:
|
|
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
|
-
|
|
197
|
+
z === "reports" && /* @__PURE__ */ S("div", {
|
|
372
198
|
className: "space-y-6",
|
|
373
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ S("div", {
|
|
374
200
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-5",
|
|
375
201
|
children: [
|
|
376
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ S("div", {
|
|
377
203
|
className: "mb-1 flex items-center gap-2 text-base font-semibold text-text-primary",
|
|
378
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ x(h, { className: "h-5 w-5" }), E("healthybowl.reportsApi.reports.builder.title", "Build a custom dashboard")]
|
|
379
205
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ x("p", {
|
|
381
207
|
className: "mb-4 max-w-2xl text-sm text-text-secondary",
|
|
382
|
-
children:
|
|
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__ */
|
|
385
|
-
href:
|
|
210
|
+
/* @__PURE__ */ x("a", {
|
|
211
|
+
href: Y,
|
|
386
212
|
target: "_blank",
|
|
387
213
|
rel: "noopener noreferrer",
|
|
388
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
217
|
+
}), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h3", {
|
|
392
218
|
className: "mb-3 text-sm font-semibold text-text-primary",
|
|
393
|
-
children:
|
|
394
|
-
}),
|
|
395
|
-
title:
|
|
396
|
-
description:
|
|
397
|
-
}) :
|
|
398
|
-
icon: /* @__PURE__ */
|
|
399
|
-
title:
|
|
400
|
-
description:
|
|
401
|
-
}) : /* @__PURE__ */
|
|
402
|
-
columns:
|
|
403
|
-
data:
|
|
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__ */
|
|
408
|
-
open:
|
|
409
|
-
onClose: () =>
|
|
410
|
-
title:
|
|
411
|
-
description:
|
|
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
|
|
239
|
+
footer: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
|
|
472
240
|
variant: "outline",
|
|
473
|
-
onClick: () =>
|
|
474
|
-
children:
|
|
475
|
-
}), /* @__PURE__ */
|
|
476
|
-
onClick:
|
|
477
|
-
disabled:
|
|
478
|
-
children:
|
|
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__ */
|
|
248
|
+
children: /* @__PURE__ */ S("div", {
|
|
481
249
|
className: "space-y-4",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
486
|
-
}), /* @__PURE__ */
|
|
253
|
+
children: E("healthybowl.reportsApi.webhooks.form.event", "Event")
|
|
254
|
+
}), /* @__PURE__ */ x("select", {
|
|
487
255
|
id: "hook-event",
|
|
488
|
-
value:
|
|
489
|
-
onChange: (e) =>
|
|
490
|
-
className:
|
|
491
|
-
children:
|
|
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__ */
|
|
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:
|
|
499
|
-
}), /* @__PURE__ */
|
|
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:
|
|
503
|
-
onChange: (e) =>
|
|
270
|
+
value: U,
|
|
271
|
+
onChange: (e) => W(e.target.value),
|
|
504
272
|
placeholder: "https://hooks.zapier.com/…",
|
|
505
|
-
className:
|
|
273
|
+
className: T
|
|
506
274
|
})] })]
|
|
507
275
|
})
|
|
508
276
|
}),
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
toasts:
|
|
511
|
-
onDismiss:
|
|
277
|
+
/* @__PURE__ */ x(o, {
|
|
278
|
+
toasts: O,
|
|
279
|
+
onDismiss: A
|
|
512
280
|
})
|
|
513
281
|
]
|
|
514
282
|
});
|
|
515
283
|
}
|
|
516
284
|
//#endregion
|
|
517
|
-
export {
|
|
285
|
+
export { E as ReportsApiPage };
|
|
518
286
|
|
|
519
287
|
//# sourceMappingURL=ReportsApiPage.js.map
|