@burdenoff/microfe-ecoimpacthub 2026.1202.1 → 2026.1203.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.
@@ -5,67 +5,67 @@ import { ErrorView as ee, LoadingView as te, Section as ne } from "../../compone
5
5
  import { EmptyState as re } from "../../components/EmptyState.js";
6
6
  import { EvidenceUpload as ie } from "../../components/EvidenceUpload.js";
7
7
  import { FileLink as ae } from "../../components/FileLink.js";
8
- import { useEcoAddReportLineItem as oe, useEcoPublishReport as r, useEcoReport as i } from "../../hooks/useEcoImpactHubApi.js";
9
- import { useActiveEcoEntity as a } from "../../hooks/useActiveEcoEntity.js";
10
- import { useEcoAiDraftReportLineItems as o, useEcoAiReportReadiness as se } from "../../hooks/useEcoAiOperations.js";
11
- import { EcoDiscussion as ce } from "../../components/EcoDiscussion.js";
8
+ import { useEcoAddReportLineItem as oe, useEcoPublishReport as se, useEcoRejectReport as ce, useEcoReport as le, useEcoSubmitReportForApproval as ue } from "../../hooks/useEcoImpactHubApi.js";
9
+ import { useActiveEcoEntity as de } from "../../hooks/useActiveEcoEntity.js";
10
+ import { useEcoAiDraftReportLineItems as fe, useEcoAiReportReadiness as pe } from "../../hooks/useEcoAiOperations.js";
11
+ import { EcoDiscussion as me } from "../../components/EcoDiscussion.js";
12
12
  import "../../context/index.js";
13
13
  import "../../hooks/index.js";
14
- import { formatDate as s, formatNumber as c } from "../../utils/formatters.js";
15
- import { FrameworkBadge as l } from "../badges.js";
16
- import { useMemo as u, useState as d } from "react";
17
- import { AlertTriangle as le, ArrowLeft as ue, CheckCircle2 as de, ExternalLink as f, ListPlus as p, Send as fe, ShieldAlert as pe, Sparkles as m } from "lucide-react";
18
- import { useParams as h } from "react-router";
19
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
20
- import { Button as y, GlassCard as b, Input as x, Label as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O } from "@burdenoff/fe-libs/ui";
14
+ import { formatDate as r, formatNumber as he } from "../../utils/formatters.js";
15
+ import { FrameworkBadge as i } from "../badges.js";
16
+ import { useMemo as a, useState as o } from "react";
17
+ import { AlertTriangle as ge, ArrowLeft as _e, CheckCircle2 as ve, ExternalLink as s, ListPlus as c, Send as l, ShieldAlert as ye, Sparkles as u } from "lucide-react";
18
+ import { useParams as be } from "react-router";
19
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
20
+ import { Button as m, GlassCard as h, Input as g, Label as _, ResponsiveDialog as v, ResponsiveDialogContent as y, ResponsiveDialogDescription as b, ResponsiveDialogFooter as x, ResponsiveDialogHeader as S, ResponsiveDialogTitle as C } from "@burdenoff/fe-libs/ui";
21
21
  // src/ecoimpacthub/pages/reports/ReportDetailPage.tsx
22
- function k({ label: e, children: t }) {
23
- return /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
22
+ function w({ label: e, children: t }) {
23
+ return /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("dt", {
24
24
  className: "text-xs text-text-tertiary",
25
25
  children: e
26
- }), /* @__PURE__ */ _("dd", {
26
+ }), /* @__PURE__ */ f("dd", {
27
27
  className: "mt-1 text-sm text-text-primary",
28
28
  children: t
29
29
  })] });
30
30
  }
31
- function A() {
32
- let { id: A } = h(), { navigateTo: j } = e(), { data: M, isLoading: me, isError: N, refetch: P } = i(A);
33
- a(M?.id, M?.title);
34
- let F = oe(), I = r(), L = o(), R = se(A), [he, z] = d(!1), [ge, B] = d(!1), [V, H] = d(null), [U, W] = d({
31
+ function T() {
32
+ let { id: T } = be(), { navigateTo: E } = e(), { data: D, isLoading: xe, isError: Se, refetch: O } = le(T);
33
+ de(D?.id, D?.title);
34
+ let k = oe(), A = ue(), j = se(), M = ce(), N = fe(), P = pe(T), [Ce, F] = o(!1), [we, I] = o(!1), [Te, L] = o(!1), [R, z] = o(""), [B, V] = o(null), [H, U] = o({
35
35
  label: "",
36
36
  value: "",
37
37
  unit: "",
38
38
  category: "",
39
39
  carbonEntryId: ""
40
- }), [G, K] = d(null), [q, J] = d(null), Y = u(() => M?.lineItems ?? [], [M]), _e = u(() => Y.reduce((e, t) => e + t.value, 0), [Y]), X = u(() => {
41
- let e = new Set(Y.map((e) => e.unit));
40
+ }), [W, G] = o(null), [K, q] = o(null), J = a(() => D?.lineItems ?? [], [D]), Ee = a(() => J.reduce((e, t) => e + t.value, 0), [J]), Y = a(() => {
41
+ let e = new Set(J.map((e) => e.unit));
42
42
  return e.size === 1 ? [...e][0] : null;
43
- }, [Y]);
44
- if (me) return /* @__PURE__ */ _(t, {
43
+ }, [J]);
44
+ if (xe) return /* @__PURE__ */ f(t, {
45
45
  title: "Report",
46
- children: /* @__PURE__ */ _(te, {})
46
+ children: /* @__PURE__ */ f(te, {})
47
47
  });
48
- if (N || !M) return /* @__PURE__ */ _(t, {
48
+ if (Se || !D) return /* @__PURE__ */ f(t, {
49
49
  title: "Report",
50
- children: /* @__PURE__ */ _(ee, {
50
+ children: /* @__PURE__ */ f(ee, {
51
51
  message: "This report could not be loaded.",
52
- onRetry: () => P()
52
+ onRetry: () => O()
53
53
  })
54
54
  });
55
- let Z = M.status === "PUBLISHED", Q = async () => {
56
- if (A) {
57
- if (!U.label.trim() || !U.value || !U.unit.trim()) K("Label, value and unit are required.");
55
+ let De = D.status === "PUBLISHED", X = D.status === "DRAFT", Oe = D.status === "IN_REVIEW", Z = !!D.submissionPending, Q = X && !Z, ke = async () => {
56
+ if (T) {
57
+ if (!H.label.trim() || !H.value || !H.unit.trim()) G("Label, value and unit are required.");
58
58
  else {
59
- K(null);
59
+ G(null);
60
60
  try {
61
- await F.mutateAsync({
62
- reportId: A,
63
- label: U.label.trim(),
64
- value: Number(U.value),
65
- unit: U.unit.trim(),
66
- category: U.category.trim() || null,
67
- carbonEntryId: U.carbonEntryId.trim() || null
68
- }), z(!1), W({
61
+ await k.mutateAsync({
62
+ reportId: T,
63
+ label: H.label.trim(),
64
+ value: Number(H.value),
65
+ unit: H.unit.trim(),
66
+ category: H.category.trim() || null,
67
+ carbonEntryId: H.carbonEntryId.trim() || null
68
+ }), F(!1), U({
69
69
  label: "",
70
70
  value: "",
71
71
  unit: "",
@@ -73,164 +73,207 @@ function A() {
73
73
  carbonEntryId: ""
74
74
  });
75
75
  } catch (e) {
76
- K(e instanceof Error ? e.message : "Failed to add line item.");
76
+ G(e instanceof Error ? e.message : "Failed to add line item.");
77
77
  }
78
78
  }
79
79
  }
80
- }, ve = async () => {
81
- if (A) {
82
- K(null);
80
+ }, Ae = async () => {
81
+ if (T) {
82
+ G(null);
83
83
  try {
84
- await I.mutateAsync({
85
- id: A,
86
- fileId: q?.fileId ?? null
87
- }), J(null), B(!1);
84
+ await A.mutateAsync(T);
88
85
  } catch (e) {
89
- K(e instanceof Error ? e.message : "Failed to publish report.");
86
+ G(e instanceof Error ? e.message : "Failed to submit report for approval.");
90
87
  }
91
88
  }
92
- }, ye = async () => {
93
- if (A) {
94
- K(null), H(null);
89
+ }, je = async () => {
90
+ if (T) {
91
+ G(null);
95
92
  try {
96
- let e = await L.mutateAsync(A);
97
- H(e.draftedCount > 0 ? `Drafted ${e.draftedCount} cited ${e.framework} line item(s) (AgentRun ${e.agentRunId}). Verify source links before publishing.` : `No new line items drafted (${e.skippedDisclosures.length} disclosure(s) already covered or missing workspace source data).`), await P(), await R.refetch();
93
+ await j.mutateAsync({
94
+ id: T,
95
+ fileId: K?.fileId ?? null
96
+ }), q(null), I(!1);
98
97
  } catch (e) {
99
- K(e instanceof Error ? e.message : "Failed to draft line items with AI.");
98
+ G(e instanceof Error ? e.message : "Failed to publish report.");
100
99
  }
101
100
  }
102
- }, $ = R.data, be = Y.some((e) => e.aiDrafted);
103
- return /* @__PURE__ */ v(t, {
104
- title: /* @__PURE__ */ v("span", {
101
+ }, Me = async () => {
102
+ if (!T || !R.trim()) G("A rejection reason is required.");
103
+ else {
104
+ G(null);
105
+ try {
106
+ await M.mutateAsync({
107
+ reportId: T,
108
+ reason: R.trim()
109
+ }), z(""), L(!1);
110
+ } catch (e) {
111
+ G(e instanceof Error ? e.message : "Failed to reject report.");
112
+ }
113
+ }
114
+ }, Ne = async () => {
115
+ if (T) {
116
+ G(null), V(null);
117
+ try {
118
+ let e = await N.mutateAsync(T);
119
+ V(e.draftedCount > 0 ? `Drafted ${e.draftedCount} cited ${e.framework} line item(s) (AgentRun ${e.agentRunId}). Verify source links before publishing.` : `No new line items drafted (${e.skippedDisclosures.length} disclosure(s) already covered or missing workspace source data).`), await O(), await P.refetch();
120
+ } catch (e) {
121
+ G(e instanceof Error ? e.message : "Failed to draft line items with AI.");
122
+ }
123
+ }
124
+ }, $ = P.data, Pe = J.some((e) => e.aiDrafted);
125
+ return /* @__PURE__ */ p(t, {
126
+ title: /* @__PURE__ */ p("span", {
105
127
  className: "flex flex-wrap items-center gap-x-3 gap-y-2",
106
- children: [/* @__PURE__ */ _("span", {
128
+ children: [/* @__PURE__ */ f("span", {
107
129
  className: "text-text-primary",
108
- children: M.title
109
- }), /* @__PURE__ */ _(l, { framework: M.framework })]
130
+ children: D.title
131
+ }), /* @__PURE__ */ f(i, { framework: D.framework })]
110
132
  }),
111
- description: `Reporting period ${s(M.periodStart)} – ${s(M.periodEnd)}`,
112
- actions: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(n, { status: M.status }), /* @__PURE__ */ v(y, {
133
+ description: `Reporting period ${r(D.periodStart)} – ${r(D.periodEnd)}`,
134
+ actions: /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(n, { status: D.status }), /* @__PURE__ */ p(m, {
113
135
  variant: "ghost",
114
- onClick: () => j("reports"),
115
- children: [/* @__PURE__ */ _(ue, { className: "me-1.5 h-4 w-4" }), " Back"]
136
+ onClick: () => E("reports"),
137
+ children: [/* @__PURE__ */ f(_e, { className: "me-1.5 h-4 w-4" }), " Back"]
116
138
  })] }),
117
139
  children: [
118
- /* @__PURE__ */ v("div", {
140
+ /* @__PURE__ */ p("div", {
119
141
  className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
120
- children: [/* @__PURE__ */ v(b, {
142
+ children: [/* @__PURE__ */ p(h, {
121
143
  treatment: "glass",
122
144
  className: "p-6 lg:col-span-2",
123
- children: [/* @__PURE__ */ v("dl", {
145
+ children: [/* @__PURE__ */ p("dl", {
124
146
  className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
125
147
  children: [
126
- /* @__PURE__ */ _(k, {
148
+ /* @__PURE__ */ f(w, {
127
149
  label: "Framework",
128
- children: /* @__PURE__ */ _(l, { framework: M.framework })
150
+ children: /* @__PURE__ */ f(i, { framework: D.framework })
129
151
  }),
130
- /* @__PURE__ */ _(k, {
152
+ /* @__PURE__ */ f(w, {
131
153
  label: "Status",
132
- children: /* @__PURE__ */ _(n, { status: M.status })
154
+ children: /* @__PURE__ */ f(n, { status: D.status })
133
155
  }),
134
- /* @__PURE__ */ _(k, {
156
+ /* @__PURE__ */ f(w, {
135
157
  label: "Period",
136
- children: /* @__PURE__ */ v("span", {
158
+ children: /* @__PURE__ */ p("span", {
137
159
  className: "tabular-nums",
138
160
  children: [
139
- s(M.periodStart),
161
+ r(D.periodStart),
140
162
  " – ",
141
- s(M.periodEnd)
163
+ r(D.periodEnd)
142
164
  ]
143
165
  })
144
166
  }),
145
- /* @__PURE__ */ _(k, {
167
+ /* @__PURE__ */ f(w, {
146
168
  label: "Published",
147
- children: s(M.publishedAt)
169
+ children: r(D.publishedAt)
148
170
  }),
149
- /* @__PURE__ */ _(k, {
171
+ /* @__PURE__ */ f(w, {
150
172
  label: "Line items",
151
- children: /* @__PURE__ */ _("span", {
173
+ children: /* @__PURE__ */ f("span", {
152
174
  className: "tabular-nums",
153
- children: Y.length
175
+ children: J.length
154
176
  })
155
177
  }),
156
- /* @__PURE__ */ _(k, {
178
+ /* @__PURE__ */ f(w, {
157
179
  label: "Attachment",
158
- children: M.file?.id ? /* @__PURE__ */ _(ae, { fileId: M.file.id }) : /* @__PURE__ */ _("span", {
180
+ children: D.file?.id ? /* @__PURE__ */ f(ae, { fileId: D.file.id }) : /* @__PURE__ */ f("span", {
159
181
  className: "text-text-tertiary",
160
182
  children: "—"
161
183
  })
162
184
  })
163
185
  ]
164
- }), M.summary && /* @__PURE__ */ _("p", {
186
+ }), D.summary && /* @__PURE__ */ f("p", {
165
187
  className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
166
- children: M.summary
188
+ children: D.summary
167
189
  })]
168
- }), /* @__PURE__ */ v(b, {
190
+ }), /* @__PURE__ */ p(h, {
169
191
  treatment: "glass",
170
192
  className: "flex flex-col gap-3 p-6",
171
193
  children: [
172
- /* @__PURE__ */ _("p", {
194
+ /* @__PURE__ */ f("p", {
173
195
  className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
174
196
  children: "Actions"
175
197
  }),
176
- /* @__PURE__ */ v(y, {
177
- onClick: () => z(!0),
178
- children: [/* @__PURE__ */ _(p, { className: "me-1.5 h-4 w-4" }), " Add line item"]
198
+ /* @__PURE__ */ p(m, {
199
+ onClick: () => F(!0),
200
+ disabled: !Q,
201
+ children: [/* @__PURE__ */ f(c, { className: "me-1.5 h-4 w-4" }), " Add line item"]
179
202
  }),
180
- !Z && /* @__PURE__ */ v(y, {
203
+ Q && /* @__PURE__ */ p(m, {
181
204
  variant: "outline",
182
205
  "data-testid": "eco-report-draft-ai",
183
- onClick: ye,
184
- disabled: L.isPending,
185
- children: [/* @__PURE__ */ _(m, { className: "me-1.5 h-4 w-4" }), L.isPending ? "Drafting with AI…" : "Draft line items with AI"]
206
+ onClick: Ne,
207
+ disabled: N.isPending,
208
+ children: [/* @__PURE__ */ f(u, { className: "me-1.5 h-4 w-4" }), N.isPending ? "Drafting with AI…" : "Draft line items with AI"]
186
209
  }),
187
- Z ? /* @__PURE__ */ v("p", {
210
+ De ? /* @__PURE__ */ p("p", {
188
211
  className: "mt-1 text-sm text-text-secondary",
189
212
  children: [
190
213
  "Published ",
191
- s(M.publishedAt),
214
+ r(D.publishedAt),
192
215
  ". This disclosure is finalised."
193
216
  ]
194
- }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(ie, {
195
- id: "reportAttachment",
196
- label: "Attach file (optional)",
197
- value: q,
198
- onChange: J,
199
- hint: "Attach the signed report PDF or supporting document, then publish."
200
- }), /* @__PURE__ */ v(y, {
217
+ }) : Z ? /* @__PURE__ */ f("p", {
218
+ className: "mt-1 text-sm text-status-warning-text",
219
+ children: "Sign-off submission is being confirmed. Editing and repeat submission are locked until workflow reconciliation finishes."
220
+ }) : X ? /* @__PURE__ */ p(m, {
201
221
  variant: "outline",
202
- onClick: () => B(!0),
203
- disabled: I.isPending,
204
- children: [/* @__PURE__ */ _(fe, { className: "me-1.5 h-4 w-4" }), I.isPending ? "Publishing…" : "Publish report"]
205
- })] })
222
+ onClick: Ae,
223
+ disabled: A.isPending,
224
+ children: [/* @__PURE__ */ f(l, { className: "me-1.5 h-4 w-4" }), A.isPending ? "Submitting…" : "Submit for approval"]
225
+ }) : Oe ? /* @__PURE__ */ p(d, { children: [
226
+ /* @__PURE__ */ f(ie, {
227
+ id: "reportAttachment",
228
+ label: "Attach file (optional)",
229
+ value: K,
230
+ onChange: q,
231
+ hint: "Attach the signed report PDF or supporting document, then approve and publish."
232
+ }),
233
+ /* @__PURE__ */ p(m, {
234
+ variant: "outline",
235
+ onClick: () => I(!0),
236
+ disabled: j.isPending,
237
+ children: [/* @__PURE__ */ f(l, { className: "me-1.5 h-4 w-4" }), j.isPending ? "Publishing…" : "Approve & publish"]
238
+ }),
239
+ /* @__PURE__ */ f(m, {
240
+ variant: "ghost",
241
+ onClick: () => L(!0),
242
+ disabled: M.isPending,
243
+ children: "Return to draft"
244
+ })
245
+ ] }) : /* @__PURE__ */ f("p", {
246
+ className: "mt-1 text-sm text-text-secondary",
247
+ children: "This report is archived and cannot be edited or published."
248
+ })
206
249
  ]
207
250
  })]
208
251
  }),
209
- G && /* @__PURE__ */ _("p", {
252
+ W && /* @__PURE__ */ f("p", {
210
253
  className: "mt-4 text-sm text-status-error-text",
211
- children: G
254
+ children: W
212
255
  }),
213
- V && /* @__PURE__ */ _("p", {
256
+ B && /* @__PURE__ */ f("p", {
214
257
  role: "status",
215
258
  className: "mt-4 text-sm text-status-success-text",
216
- children: V
259
+ children: B
217
260
  }),
218
- $ && /* @__PURE__ */ v(b, {
261
+ $ && /* @__PURE__ */ p(h, {
219
262
  treatment: "glass",
220
263
  className: "mt-6 space-y-3 p-5",
221
264
  "data-testid": "eco-report-readiness-card",
222
265
  children: [
223
- /* @__PURE__ */ v("div", {
266
+ /* @__PURE__ */ p("div", {
224
267
  className: "flex flex-wrap items-center justify-between gap-2",
225
- children: [/* @__PURE__ */ v("div", {
268
+ children: [/* @__PURE__ */ p("div", {
226
269
  className: "flex items-center gap-2",
227
- children: [$.readyToPublish ? /* @__PURE__ */ _(de, {
270
+ children: [$.readyToPublish ? /* @__PURE__ */ f(ve, {
228
271
  className: "h-4 w-4 text-status-success-text",
229
272
  "aria-hidden": "true"
230
- }) : /* @__PURE__ */ _(le, {
273
+ }) : /* @__PURE__ */ f(ge, {
231
274
  className: "h-4 w-4 text-status-warning-text",
232
275
  "aria-hidden": "true"
233
- }), /* @__PURE__ */ v("h2", {
276
+ }), /* @__PURE__ */ p("h2", {
234
277
  className: "text-sm font-semibold text-text-primary",
235
278
  children: [
236
279
  $.framework,
@@ -243,169 +286,169 @@ function A() {
243
286
  ")"
244
287
  ]
245
288
  })]
246
- }), /* @__PURE__ */ _(n, { status: $.readyToPublish ? "READY" : "IN_REVIEW" })]
289
+ }), /* @__PURE__ */ f(n, { status: $.readyToPublish ? "READY" : "IN_REVIEW" })]
247
290
  }),
248
- $.draftCarbonWarnings.length > 0 && /* @__PURE__ */ _("div", {
291
+ $.draftCarbonWarnings.length > 0 && /* @__PURE__ */ f("div", {
249
292
  className: "rounded-lg border border-border-seam bg-status-warning-bg-subtle px-3 py-2 text-xs text-status-warning-text",
250
- children: $.draftCarbonWarnings.map((e, t) => /* @__PURE__ */ _("p", { children: e }, t))
293
+ children: $.draftCarbonWarnings.map((e, t) => /* @__PURE__ */ f("p", { children: e }, t))
251
294
  }),
252
- /* @__PURE__ */ _("div", {
295
+ /* @__PURE__ */ f("div", {
253
296
  className: "grid gap-2 sm:grid-cols-2",
254
- children: $.disclosures.map((e) => /* @__PURE__ */ v("div", {
297
+ children: $.disclosures.map((e) => /* @__PURE__ */ p("div", {
255
298
  className: "flex items-start justify-between gap-2 rounded-md border border-border-seam bg-bg-sunken/40 px-3 py-2 text-xs",
256
- children: [/* @__PURE__ */ v("div", {
299
+ children: [/* @__PURE__ */ p("div", {
257
300
  className: "min-w-0",
258
- children: [/* @__PURE__ */ v("p", {
301
+ children: [/* @__PURE__ */ p("p", {
259
302
  className: "font-medium text-text-primary",
260
303
  children: [
261
304
  e.disclosureCode,
262
305
  " · ",
263
306
  e.label
264
307
  ]
265
- }), e.gapReason && /* @__PURE__ */ _("p", {
308
+ }), e.gapReason && /* @__PURE__ */ f("p", {
266
309
  className: "text-text-tertiary",
267
310
  children: e.gapReason
268
311
  })]
269
- }), /* @__PURE__ */ _(n, { status: e.covered ? "VERIFIED" : "DRAFT" })]
312
+ }), /* @__PURE__ */ f(n, { status: e.covered ? "VERIFIED" : "DRAFT" })]
270
313
  }, e.disclosureCode))
271
314
  })
272
315
  ]
273
316
  }),
274
- be && /* @__PURE__ */ v("div", {
317
+ Pe && /* @__PURE__ */ p("div", {
275
318
  role: "note",
276
319
  "data-testid": "eco-report-ai-disclaimer",
277
320
  className: "mt-4 flex items-start gap-2 rounded-lg border border-border-seam bg-status-warning-bg-subtle px-4 py-3 text-xs text-status-warning-text",
278
- children: [/* @__PURE__ */ _(pe, {
321
+ children: [/* @__PURE__ */ f(ye, {
279
322
  className: "mt-0.5 h-4 w-4 shrink-0",
280
323
  "aria-hidden": "true"
281
- }), /* @__PURE__ */ _("p", { children: "AI-drafted disclosures are assembled from workspace records and carry mandatory source citations. Review every cited record before human publication." })]
324
+ }), /* @__PURE__ */ f("p", { children: "AI-drafted disclosures are assembled from workspace records and carry mandatory source citations. Review every cited record before human publication." })]
282
325
  }),
283
- /* @__PURE__ */ _(ne, {
326
+ /* @__PURE__ */ f(ne, {
284
327
  title: "Line items",
285
328
  description: "Quantified disclosures that make up this report.",
286
- action: /* @__PURE__ */ v(y, {
329
+ action: /* @__PURE__ */ p(m, {
287
330
  size: "sm",
288
- onClick: () => z(!0),
289
- children: [/* @__PURE__ */ _(p, { className: "me-1.5 h-4 w-4" }), " Add line item"]
331
+ onClick: () => F(!0),
332
+ children: [/* @__PURE__ */ f(c, { className: "me-1.5 h-4 w-4" }), " Add line item"]
290
333
  }),
291
- children: Y.length === 0 ? /* @__PURE__ */ _(re, {
334
+ children: J.length === 0 ? /* @__PURE__ */ f(re, {
292
335
  illustration: "empty-data",
293
336
  title: "No line items",
294
337
  description: "Add a line item to record a quantified disclosure for this report.",
295
- action: /* @__PURE__ */ v(y, {
338
+ action: /* @__PURE__ */ p(m, {
296
339
  size: "sm",
297
- onClick: () => z(!0),
298
- children: [/* @__PURE__ */ _(p, { className: "me-1.5 h-4 w-4" }), " Add line item"]
340
+ onClick: () => F(!0),
341
+ children: [/* @__PURE__ */ f(c, { className: "me-1.5 h-4 w-4" }), " Add line item"]
299
342
  })
300
- }) : /* @__PURE__ */ _(b, {
343
+ }) : /* @__PURE__ */ f(h, {
301
344
  treatment: "plain",
302
345
  className: "overflow-hidden",
303
- children: /* @__PURE__ */ _("div", {
346
+ children: /* @__PURE__ */ f("div", {
304
347
  className: "overflow-x-auto",
305
- children: /* @__PURE__ */ v("table", {
348
+ children: /* @__PURE__ */ p("table", {
306
349
  className: "w-full border-collapse text-sm",
307
350
  children: [
308
- /* @__PURE__ */ _("thead", { children: /* @__PURE__ */ v("tr", {
351
+ /* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", {
309
352
  className: "border-b border-border-seam text-start",
310
353
  children: [
311
- /* @__PURE__ */ _("th", {
354
+ /* @__PURE__ */ f("th", {
312
355
  className: "px-4 py-3 font-medium text-text-secondary",
313
356
  children: "Line item"
314
357
  }),
315
- /* @__PURE__ */ _("th", {
358
+ /* @__PURE__ */ f("th", {
316
359
  className: "hidden px-4 py-3 font-medium text-text-secondary md:table-cell",
317
360
  children: "Category"
318
361
  }),
319
- /* @__PURE__ */ _("th", {
362
+ /* @__PURE__ */ f("th", {
320
363
  className: "px-4 py-3 font-medium text-text-secondary",
321
364
  children: "Source citation"
322
365
  }),
323
- /* @__PURE__ */ _("th", {
366
+ /* @__PURE__ */ f("th", {
324
367
  className: "px-4 py-3 text-end font-medium text-text-secondary",
325
368
  children: "Value"
326
369
  })
327
370
  ]
328
371
  }) }),
329
- /* @__PURE__ */ _("tbody", { children: Y.map((e) => /* @__PURE__ */ v("tr", {
372
+ /* @__PURE__ */ f("tbody", { children: J.map((e) => /* @__PURE__ */ p("tr", {
330
373
  className: "border-b border-border-seam/60",
331
374
  children: [
332
- /* @__PURE__ */ v("td", {
375
+ /* @__PURE__ */ p("td", {
333
376
  className: "px-4 py-3 font-medium text-text-primary",
334
- children: [/* @__PURE__ */ v("div", {
377
+ children: [/* @__PURE__ */ p("div", {
335
378
  className: "flex flex-wrap items-center gap-2",
336
379
  children: [
337
- /* @__PURE__ */ _("span", { children: e.label }),
338
- e.disclosureCode && /* @__PURE__ */ _("span", {
380
+ /* @__PURE__ */ f("span", { children: e.label }),
381
+ e.disclosureCode && /* @__PURE__ */ f("span", {
339
382
  className: "rounded bg-bg-sunken px-1.5 py-0.5 font-mono text-xs text-text-secondary",
340
383
  children: e.disclosureCode
341
384
  }),
342
- e.aiDrafted && /* @__PURE__ */ v("span", {
385
+ e.aiDrafted && /* @__PURE__ */ p("span", {
343
386
  className: "inline-flex items-center gap-1 rounded bg-status-warning-bg-subtle px-1.5 py-0.5 text-xs font-medium text-status-warning-text",
344
- children: [/* @__PURE__ */ _(m, {
387
+ children: [/* @__PURE__ */ f(u, {
345
388
  className: "h-3 w-3",
346
389
  "aria-hidden": "true"
347
390
  }), " AI-drafted"]
348
391
  })
349
392
  ]
350
- }), e.aiRationale && /* @__PURE__ */ _("p", {
393
+ }), e.aiRationale && /* @__PURE__ */ f("p", {
351
394
  className: "mt-1 text-xs font-normal text-text-tertiary",
352
395
  children: e.aiRationale
353
396
  })]
354
397
  }),
355
- /* @__PURE__ */ _("td", {
398
+ /* @__PURE__ */ f("td", {
356
399
  className: "hidden px-4 py-3 text-text-secondary md:table-cell",
357
400
  children: e.category ?? "—"
358
401
  }),
359
- /* @__PURE__ */ _("td", {
402
+ /* @__PURE__ */ f("td", {
360
403
  className: "px-4 py-3 text-xs",
361
- children: e.carbonEntryId ? /* @__PURE__ */ v("button", {
404
+ children: e.carbonEntryId ? /* @__PURE__ */ p("button", {
362
405
  type: "button",
363
- onClick: () => j(`carbon?highlight=${e.carbonEntryId}`),
406
+ onClick: () => E(`carbon?highlight=${e.carbonEntryId}`),
364
407
  className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
365
- children: [/* @__PURE__ */ _(f, {
408
+ children: [/* @__PURE__ */ f(s, {
366
409
  className: "h-3 w-3",
367
410
  "aria-hidden": "true"
368
411
  }), " Carbon entry"]
369
- }) : e.sourceMeasurementId ? /* @__PURE__ */ v("button", {
412
+ }) : e.sourceMeasurementId ? /* @__PURE__ */ p("button", {
370
413
  type: "button",
371
- onClick: () => j("monitoring"),
414
+ onClick: () => E("monitoring"),
372
415
  className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
373
- children: [/* @__PURE__ */ _(f, {
416
+ children: [/* @__PURE__ */ f(s, {
374
417
  className: "h-3 w-3",
375
418
  "aria-hidden": "true"
376
419
  }), " Monitoring"]
377
- }) : e.sourceMetricId ? /* @__PURE__ */ v("button", {
420
+ }) : e.sourceMetricId ? /* @__PURE__ */ p("button", {
378
421
  type: "button",
379
- onClick: () => j("metrics"),
422
+ onClick: () => E("metrics"),
380
423
  className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
381
- children: [/* @__PURE__ */ _(f, {
424
+ children: [/* @__PURE__ */ f(s, {
382
425
  className: "h-3 w-3",
383
426
  "aria-hidden": "true"
384
427
  }), " ESG metric"]
385
- }) : /* @__PURE__ */ _("span", {
428
+ }) : /* @__PURE__ */ f("span", {
386
429
  className: "text-text-tertiary",
387
430
  children: "Manual entry"
388
431
  })
389
432
  }),
390
- /* @__PURE__ */ v("td", {
433
+ /* @__PURE__ */ p("td", {
391
434
  className: "px-4 py-3 text-end text-text-primary tabular-nums",
392
435
  children: [
393
- c(e.value),
436
+ he(e.value),
394
437
  " ",
395
438
  e.unit
396
439
  ]
397
440
  })
398
441
  ]
399
442
  }, e.id)) }),
400
- /* @__PURE__ */ _("tfoot", { children: /* @__PURE__ */ v("tr", {
443
+ /* @__PURE__ */ f("tfoot", { children: /* @__PURE__ */ p("tr", {
401
444
  className: "border-t-2 border-border-seam bg-bg-sunken/40",
402
- children: [/* @__PURE__ */ _("td", {
445
+ children: [/* @__PURE__ */ f("td", {
403
446
  className: "px-4 py-3 text-sm font-semibold text-text-primary",
404
447
  colSpan: 3,
405
448
  children: "Total"
406
- }), /* @__PURE__ */ v("td", {
449
+ }), /* @__PURE__ */ p("td", {
407
450
  className: "px-4 py-3 text-end text-base font-bold text-text-primary tabular-nums",
408
- children: [c(_e), X ? ` ${X}` : ""]
451
+ children: [he(Ee), Y ? ` ${Y}` : ""]
409
452
  })]
410
453
  }) })
411
454
  ]
@@ -413,116 +456,148 @@ function A() {
413
456
  })
414
457
  })
415
458
  }),
416
- /* @__PURE__ */ _(C, {
417
- open: ge,
418
- onOpenChange: B,
419
- children: /* @__PURE__ */ v(w, { children: [/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Confirm publishing ESG report" }), /* @__PURE__ */ v(T, { children: [
459
+ /* @__PURE__ */ f(v, {
460
+ open: we,
461
+ onOpenChange: I,
462
+ children: /* @__PURE__ */ p(y, { children: [/* @__PURE__ */ p(S, { children: [/* @__PURE__ */ f(C, { children: "Confirm publishing ESG report" }), /* @__PURE__ */ p(b, { children: [
420
463
  "Publishing finalises ",
421
- M.title,
464
+ D.title,
422
465
  " (",
423
- M.framework,
466
+ D.framework,
424
467
  ") and prevents further AI drafting. Confirm you have reviewed all cited disclosures."
425
- ] })] }), /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
468
+ ] })] }), /* @__PURE__ */ p(x, { children: [/* @__PURE__ */ f(m, {
426
469
  variant: "ghost",
427
- onClick: () => B(!1),
470
+ onClick: () => I(!1),
428
471
  children: "Cancel"
429
- }), /* @__PURE__ */ _(y, {
430
- onClick: ve,
431
- disabled: I.isPending,
432
- children: I.isPending ? "Publishing…" : "Confirm publish"
472
+ }), /* @__PURE__ */ f(m, {
473
+ onClick: je,
474
+ disabled: j.isPending,
475
+ children: j.isPending ? "Publishing…" : "Confirm publish"
433
476
  })] })] })
434
477
  }),
435
- /* @__PURE__ */ _(ce, {
478
+ /* @__PURE__ */ f(v, {
479
+ open: Te,
480
+ onOpenChange: L,
481
+ children: /* @__PURE__ */ p(y, { children: [
482
+ /* @__PURE__ */ p(S, { children: [/* @__PURE__ */ f(C, { children: "Return report to draft" }), /* @__PURE__ */ p(b, { children: [
483
+ "Provide review feedback explaining what needs revision before ",
484
+ D.title,
485
+ " can be re-submitted."
486
+ ] })] }),
487
+ /* @__PURE__ */ p("div", {
488
+ className: "grid gap-1.5 py-2",
489
+ children: [/* @__PURE__ */ f(_, {
490
+ htmlFor: "rejectReason",
491
+ children: "Reason *"
492
+ }), /* @__PURE__ */ f(g, {
493
+ id: "rejectReason",
494
+ value: R,
495
+ onChange: (e) => z(e.target.value),
496
+ placeholder: "Explain missing evidence or corrections required"
497
+ })]
498
+ }),
499
+ /* @__PURE__ */ p(x, { children: [/* @__PURE__ */ f(m, {
500
+ variant: "ghost",
501
+ onClick: () => L(!1),
502
+ children: "Cancel"
503
+ }), /* @__PURE__ */ f(m, {
504
+ onClick: Me,
505
+ disabled: M.isPending,
506
+ children: M.isPending ? "Returning…" : "Return to draft"
507
+ })] })
508
+ ] })
509
+ }),
510
+ /* @__PURE__ */ f(me, {
436
511
  entityType: "ecoimpacthub-report",
437
- entityId: M.id,
512
+ entityId: D.id,
438
513
  description: "Coordinate review and sign-off on this disclosure with your team."
439
514
  }),
440
- /* @__PURE__ */ _(C, {
441
- open: he,
442
- onOpenChange: z,
443
- children: /* @__PURE__ */ v(w, { children: [
444
- /* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Add line item" }), /* @__PURE__ */ v(T, { children: [
515
+ /* @__PURE__ */ f(v, {
516
+ open: Ce,
517
+ onOpenChange: F,
518
+ children: /* @__PURE__ */ p(y, { children: [
519
+ /* @__PURE__ */ p(S, { children: [/* @__PURE__ */ f(C, { children: "Add line item" }), /* @__PURE__ */ p(b, { children: [
445
520
  "Record a quantified disclosure for ",
446
- M.title,
521
+ D.title,
447
522
  "."
448
523
  ] })] }),
449
- /* @__PURE__ */ v("div", {
524
+ /* @__PURE__ */ p("div", {
450
525
  className: "grid gap-4 py-2",
451
526
  children: [
452
- /* @__PURE__ */ v("div", {
527
+ /* @__PURE__ */ p("div", {
453
528
  className: "grid gap-1.5",
454
- children: [/* @__PURE__ */ _(S, {
529
+ children: [/* @__PURE__ */ f(_, {
455
530
  htmlFor: "liLabel",
456
531
  children: "Label *"
457
- }), /* @__PURE__ */ _(x, {
532
+ }), /* @__PURE__ */ f(g, {
458
533
  id: "liLabel",
459
- value: U.label,
460
- onChange: (e) => W({
461
- ...U,
534
+ value: H.label,
535
+ onChange: (e) => U({
536
+ ...H,
462
537
  label: e.target.value
463
538
  }),
464
539
  placeholder: "Scope 1 emissions"
465
540
  })]
466
541
  }),
467
- /* @__PURE__ */ v("div", {
542
+ /* @__PURE__ */ p("div", {
468
543
  className: "grid gap-2 sm:grid-cols-2",
469
- children: [/* @__PURE__ */ v("div", {
544
+ children: [/* @__PURE__ */ p("div", {
470
545
  className: "grid gap-1.5",
471
- children: [/* @__PURE__ */ _(S, {
546
+ children: [/* @__PURE__ */ f(_, {
472
547
  htmlFor: "liValue",
473
548
  children: "Value *"
474
- }), /* @__PURE__ */ _(x, {
549
+ }), /* @__PURE__ */ f(g, {
475
550
  id: "liValue",
476
551
  type: "number",
477
552
  step: "any",
478
- value: U.value,
479
- onChange: (e) => W({
480
- ...U,
553
+ value: H.value,
554
+ onChange: (e) => U({
555
+ ...H,
481
556
  value: e.target.value
482
557
  }),
483
558
  placeholder: "1250"
484
559
  })]
485
- }), /* @__PURE__ */ v("div", {
560
+ }), /* @__PURE__ */ p("div", {
486
561
  className: "grid gap-1.5",
487
- children: [/* @__PURE__ */ _(S, {
562
+ children: [/* @__PURE__ */ f(_, {
488
563
  htmlFor: "liUnit",
489
564
  children: "Unit *"
490
- }), /* @__PURE__ */ _(x, {
565
+ }), /* @__PURE__ */ f(g, {
491
566
  id: "liUnit",
492
- value: U.unit,
493
- onChange: (e) => W({
494
- ...U,
567
+ value: H.unit,
568
+ onChange: (e) => U({
569
+ ...H,
495
570
  unit: e.target.value
496
571
  }),
497
572
  placeholder: "t CO₂e"
498
573
  })]
499
574
  })]
500
575
  }),
501
- /* @__PURE__ */ v("div", {
576
+ /* @__PURE__ */ p("div", {
502
577
  className: "grid gap-1.5",
503
- children: [/* @__PURE__ */ _(S, {
578
+ children: [/* @__PURE__ */ f(_, {
504
579
  htmlFor: "liCategory",
505
580
  children: "Category"
506
- }), /* @__PURE__ */ _(x, {
581
+ }), /* @__PURE__ */ f(g, {
507
582
  id: "liCategory",
508
- value: U.category,
509
- onChange: (e) => W({
510
- ...U,
583
+ value: H.category,
584
+ onChange: (e) => U({
585
+ ...H,
511
586
  category: e.target.value
512
587
  }),
513
588
  placeholder: "Optional grouping, e.g. Energy"
514
589
  })]
515
590
  }),
516
- /* @__PURE__ */ v("div", {
591
+ /* @__PURE__ */ p("div", {
517
592
  className: "grid gap-1.5",
518
- children: [/* @__PURE__ */ _(S, {
593
+ children: [/* @__PURE__ */ f(_, {
519
594
  htmlFor: "liCarbonEntry",
520
595
  children: "Carbon entry ID"
521
- }), /* @__PURE__ */ _(x, {
596
+ }), /* @__PURE__ */ f(g, {
522
597
  id: "liCarbonEntry",
523
- value: U.carbonEntryId,
524
- onChange: (e) => W({
525
- ...U,
598
+ value: H.carbonEntryId,
599
+ onChange: (e) => U({
600
+ ...H,
526
601
  carbonEntryId: e.target.value
527
602
  }),
528
603
  placeholder: "Optional linked carbon-ledger entry"
@@ -530,20 +605,20 @@ function A() {
530
605
  })
531
606
  ]
532
607
  }),
533
- /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
608
+ /* @__PURE__ */ p(x, { children: [/* @__PURE__ */ f(m, {
534
609
  variant: "outline",
535
- onClick: () => z(!1),
610
+ onClick: () => F(!1),
536
611
  children: "Cancel"
537
- }), /* @__PURE__ */ _(y, {
538
- onClick: Q,
539
- disabled: F.isPending,
540
- children: F.isPending ? "Adding…" : "Add line item"
612
+ }), /* @__PURE__ */ f(m, {
613
+ onClick: ke,
614
+ disabled: k.isPending,
615
+ children: k.isPending ? "Adding…" : "Add line item"
541
616
  })] })
542
617
  ] })
543
618
  })
544
619
  ]
545
620
  });
546
621
  }
547
- export { A as ReportDetailPage };
622
+ export { T as ReportDetailPage };
548
623
 
549
624
  //# sourceMappingURL=ReportDetailPage.js.map