@burdenoff/microfe-timecampus 2026.1031.13 → 2026.1102.1

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.
Files changed (62) hide show
  1. package/dist/generated/wspace-operations.d.ts +181 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +1373 -1273
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +574 -13
  6. package/dist/generated/wspace-types.d.ts.map +1 -1
  7. package/dist/generated/wspace-types.js +10 -8
  8. package/dist/generated/wspace-types.js.map +1 -1
  9. package/dist/index.js +7 -7
  10. package/dist/timecampus/TimeCampusRoot.d.ts.map +1 -1
  11. package/dist/timecampus/TimeCampusRoot.js +116 -96
  12. package/dist/timecampus/TimeCampusRoot.js.map +1 -1
  13. package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
  14. package/dist/timecampus/TimeCampusRoutes.js +26 -14
  15. package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
  16. package/dist/timecampus/components/ToggleSwitch.d.ts +12 -0
  17. package/dist/timecampus/components/ToggleSwitch.d.ts.map +1 -0
  18. package/dist/timecampus/components/ToggleSwitch.js +19 -0
  19. package/dist/timecampus/components/ToggleSwitch.js.map +1 -0
  20. package/dist/timecampus/components/index.d.ts +1 -0
  21. package/dist/timecampus/components/index.d.ts.map +1 -1
  22. package/dist/timecampus/components/index.js +11 -10
  23. package/dist/timecampus/index.js +7 -7
  24. package/dist/timecampus/pages/dashboard/ReportsPage.d.ts.map +1 -1
  25. package/dist/timecampus/pages/dashboard/ReportsPage.js +143 -129
  26. package/dist/timecampus/pages/dashboard/ReportsPage.js.map +1 -1
  27. package/dist/timecampus/pages/dashboard/ServerReportExports.d.ts +6 -0
  28. package/dist/timecampus/pages/dashboard/ServerReportExports.d.ts.map +1 -0
  29. package/dist/timecampus/pages/dashboard/ServerReportExports.js +257 -0
  30. package/dist/timecampus/pages/dashboard/ServerReportExports.js.map +1 -0
  31. package/dist/timecampus/pages/dashboard/reportTemplates.d.ts +33 -0
  32. package/dist/timecampus/pages/dashboard/reportTemplates.d.ts.map +1 -0
  33. package/dist/timecampus/pages/dashboard/reportTemplates.js +129 -0
  34. package/dist/timecampus/pages/dashboard/reportTemplates.js.map +1 -0
  35. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.d.ts.map +1 -1
  36. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js +147 -162
  37. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js.map +1 -1
  38. package/dist/timecampus/pages/settings/PrivacySettingsPage.d.ts +2 -0
  39. package/dist/timecampus/pages/settings/PrivacySettingsPage.d.ts.map +1 -0
  40. package/dist/timecampus/pages/settings/PrivacySettingsPage.js +268 -0
  41. package/dist/timecampus/pages/settings/PrivacySettingsPage.js.map +1 -0
  42. package/dist/timecampus/pages/settings/SettingsPage.d.ts +2 -0
  43. package/dist/timecampus/pages/settings/SettingsPage.d.ts.map +1 -0
  44. package/dist/timecampus/pages/settings/SettingsPage.js +175 -0
  45. package/dist/timecampus/pages/settings/SettingsPage.js.map +1 -0
  46. package/dist/timecampus/pages/settings/ThemePreferenceSync.d.ts +15 -0
  47. package/dist/timecampus/pages/settings/ThemePreferenceSync.d.ts.map +1 -0
  48. package/dist/timecampus/pages/settings/ThemePreferenceSync.js +80 -0
  49. package/dist/timecampus/pages/settings/ThemePreferenceSync.js.map +1 -0
  50. package/dist/timecampus/pages/settings/retention.d.ts +25 -0
  51. package/dist/timecampus/pages/settings/retention.d.ts.map +1 -0
  52. package/dist/timecampus/pages/settings/retention.js +34 -0
  53. package/dist/timecampus/pages/settings/retention.js.map +1 -0
  54. package/dist/timecampus/pages/settings/themePreference.d.ts +45 -0
  55. package/dist/timecampus/pages/settings/themePreference.d.ts.map +1 -0
  56. package/dist/timecampus/pages/settings/themePreference.js +49 -0
  57. package/dist/timecampus/pages/settings/themePreference.js.map +1 -0
  58. package/dist/timecampus/utils/helpers.d.ts +2 -0
  59. package/dist/timecampus/utils/helpers.d.ts.map +1 -1
  60. package/dist/timecampus/utils/helpers.js +5 -1
  61. package/dist/timecampus/utils/helpers.js.map +1 -1
  62. package/package.json +1 -1
@@ -0,0 +1,257 @@
1
+ import { useExportTimeCampusEntitiesMutation as e, useTimeCampusExportJobQuery as t } from "../../../generated/wspace-operations.js";
2
+ import { StatusBadge as n } from "../../components/StatusBadge.js";
3
+ import { ProgressMeter as r } from "../../components/charts/ProgressMeter.js";
4
+ import "../../components/index.js";
5
+ import { TimeCampusExportFormat as i } from "../../../generated/wspace-types.js";
6
+ import { REPORT_PERIODS as a, REPORT_TEMPLATES as o, buildReportName as s, exportStatusLabel as c, exportStatusTone as l, findReportTemplate as u, isTerminalExportStatus as d, resolveReportDateRange as f } from "./reportTemplates.js";
7
+ import { useEffect as p, useState as m } from "react";
8
+ import { Download as h, FileDown as g, Loader2 as _ } from "lucide-react";
9
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
10
+ import { GlassCard as b } from "@burdenoff/fe-libs/ui";
11
+ //#region src/timecampus/pages/dashboard/ServerReportExports.tsx
12
+ var x = 3e3, S = 9e5;
13
+ function C(e) {
14
+ if (!e) return "";
15
+ let t = new Date(e);
16
+ return Number.isNaN(t.getTime()) ? "" : t.toLocaleString();
17
+ }
18
+ function w({ report: e }) {
19
+ let [i, a] = m(d(e.initial.status)), [o, s] = m(!1), [u, f] = m(0), { data: g, error: b, stopPolling: w, startPolling: T, refetch: E } = t({
20
+ variables: { id: e.jobId },
21
+ pollInterval: i || o ? 0 : x,
22
+ fetchPolicy: "network-only"
23
+ }), D = g?.timeCampusExportJob ?? e.initial, O = D.status;
24
+ p(() => {
25
+ (d(O) || g?.timeCampusExportJob === null) && (w(), a(!0), s(!1));
26
+ }, [
27
+ O,
28
+ g,
29
+ w
30
+ ]), p(() => {
31
+ if (i) return;
32
+ let e = window.setTimeout(() => {
33
+ w(), s(!0);
34
+ }, S);
35
+ return () => window.clearTimeout(e);
36
+ }, [
37
+ i,
38
+ u,
39
+ w
40
+ ]);
41
+ let k = () => {
42
+ s(!1), f((e) => e + 1), T(x), E();
43
+ }, A = g !== void 0 && g.timeCampusExportJob === null, j = A ? "warning" : l(O), M = A ? "Unavailable" : c(O), N = !A && !d(O);
44
+ return /* @__PURE__ */ y("li", {
45
+ className: "flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-3 sm:flex-row sm:items-center sm:justify-between",
46
+ "data-testid": "report-export-job",
47
+ "data-status": A ? "MISSING" : O,
48
+ children: [/* @__PURE__ */ y("div", {
49
+ className: "min-w-0 flex-1 space-y-1",
50
+ children: [
51
+ /* @__PURE__ */ y("div", {
52
+ className: "flex flex-wrap items-center gap-2",
53
+ children: [
54
+ /* @__PURE__ */ v("p", {
55
+ className: "truncate text-sm font-medium text-text-primary",
56
+ children: e.name
57
+ }),
58
+ /* @__PURE__ */ v(n, {
59
+ variant: j,
60
+ label: M,
61
+ dot: !0
62
+ }),
63
+ /* @__PURE__ */ v("span", {
64
+ className: "text-xs text-text-secondary",
65
+ children: D.format
66
+ })
67
+ ]
68
+ }),
69
+ /* @__PURE__ */ y("p", {
70
+ className: "text-xs text-text-secondary",
71
+ children: [
72
+ "Started ",
73
+ C(D.createdAt),
74
+ D.completedAt ? ` · finished ${C(D.completedAt)}` : ""
75
+ ]
76
+ }),
77
+ N && /* @__PURE__ */ v(r, {
78
+ value: D.progress ?? 0,
79
+ max: 100,
80
+ higherIsWorse: !1,
81
+ label: "Progress",
82
+ format: (e) => `${Math.round(e)}%`,
83
+ size: "sm"
84
+ }),
85
+ O === "FAILED" && /* @__PURE__ */ v("p", {
86
+ className: "text-xs text-status-error-text",
87
+ children: D.errorMessage || "The export failed. Try generating it again."
88
+ }),
89
+ A && /* @__PURE__ */ v("p", {
90
+ className: "text-xs text-text-secondary",
91
+ children: "This export is no longer available."
92
+ }),
93
+ o && !i && /* @__PURE__ */ y("p", {
94
+ className: "text-xs text-text-secondary",
95
+ children: [
96
+ "Still generating. Status checks paused to save requests; the export keeps running on the server.",
97
+ " ",
98
+ /* @__PURE__ */ v("button", {
99
+ type: "button",
100
+ onClick: k,
101
+ className: "font-medium text-text-primary underline underline-offset-2",
102
+ children: "Check again"
103
+ })
104
+ ]
105
+ }),
106
+ b && !A && /* @__PURE__ */ y("p", {
107
+ className: "text-xs text-status-error-text",
108
+ children: ["Could not refresh the export status: ", b.message]
109
+ })
110
+ ]
111
+ }), /* @__PURE__ */ y("div", {
112
+ className: "flex shrink-0 items-center gap-2",
113
+ children: [N && !o && /* @__PURE__ */ v(_, {
114
+ className: "h-4 w-4 text-text-secondary motion-safe:animate-spin",
115
+ "aria-hidden": !0
116
+ }), O === "COMPLETED" && D.downloadUrl && /* @__PURE__ */ y("a", {
117
+ href: D.downloadUrl,
118
+ target: "_blank",
119
+ rel: "noopener noreferrer",
120
+ className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90",
121
+ title: D.downloadExpiresAt ? `Link expires ${C(D.downloadExpiresAt)}` : void 0,
122
+ children: [/* @__PURE__ */ v(h, { className: "h-4 w-4" }), "Download"]
123
+ })]
124
+ })]
125
+ });
126
+ }
127
+ function T() {
128
+ let [t, n] = m("time-entries"), [r, c] = m("30d"), [l, d] = m(i.Csv), [p, h] = m([]), [x, S] = m(null), [C, { loading: T }] = e(), E = u(t), D = async () => {
129
+ S(null);
130
+ let e = s(E, r);
131
+ try {
132
+ let t = (await C({ variables: { input: {
133
+ entityTypes: E.entityTypes,
134
+ format: l,
135
+ includeMetadata: !0,
136
+ name: e,
137
+ ...f(r)
138
+ } } })).data?.exportTimeCampusEntities;
139
+ if (!t) {
140
+ S("The export could not be started. Please try again.");
141
+ return;
142
+ }
143
+ h((n) => [{
144
+ jobId: t.id,
145
+ name: e,
146
+ initial: t
147
+ }, ...n]);
148
+ } catch (e) {
149
+ S(e instanceof Error ? e.message : "The export could not be started. Please try again.");
150
+ }
151
+ }, O = "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary";
152
+ return /* @__PURE__ */ v("section", {
153
+ "data-testid": "server-report-exports",
154
+ "aria-label": "Generate a full report",
155
+ children: /* @__PURE__ */ y(b, {
156
+ treatment: "glass",
157
+ className: "p-4 sm:p-5",
158
+ children: [
159
+ /* @__PURE__ */ y("div", {
160
+ className: "flex items-start gap-3",
161
+ children: [/* @__PURE__ */ v("div", {
162
+ className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-status-info-bg text-status-info-text",
163
+ children: /* @__PURE__ */ v(g, { className: "h-5 w-5" })
164
+ }), /* @__PURE__ */ y("div", {
165
+ className: "min-w-0",
166
+ children: [/* @__PURE__ */ v("h2", {
167
+ className: "text-sm font-semibold text-text-primary",
168
+ children: "Generate a full report"
169
+ }), /* @__PURE__ */ v("p", {
170
+ className: "mt-1 text-xs text-text-secondary",
171
+ children: "Built on the server from your complete records, not just what this page has loaded. Large reports keep generating in the background; the download appears here when it is ready."
172
+ })]
173
+ })]
174
+ }),
175
+ /* @__PURE__ */ y("div", {
176
+ className: "mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3",
177
+ children: [
178
+ /* @__PURE__ */ y("label", {
179
+ className: "block text-xs font-medium text-text-secondary",
180
+ children: ["Report", /* @__PURE__ */ v("select", {
181
+ value: t,
182
+ onChange: (e) => n(e.target.value),
183
+ className: O,
184
+ "aria-label": "Report template",
185
+ children: o.map((e) => /* @__PURE__ */ v("option", {
186
+ value: e.id,
187
+ children: e.label
188
+ }, e.id))
189
+ })]
190
+ }),
191
+ /* @__PURE__ */ y("label", {
192
+ className: "block text-xs font-medium text-text-secondary",
193
+ children: ["Period", /* @__PURE__ */ v("select", {
194
+ value: r,
195
+ onChange: (e) => c(e.target.value),
196
+ className: O,
197
+ "aria-label": "Report period",
198
+ children: a.map((e) => /* @__PURE__ */ v("option", {
199
+ value: e.id,
200
+ children: e.label
201
+ }, e.id))
202
+ })]
203
+ }),
204
+ /* @__PURE__ */ y("label", {
205
+ className: "block text-xs font-medium text-text-secondary",
206
+ children: ["Format", /* @__PURE__ */ y("select", {
207
+ value: l,
208
+ onChange: (e) => d(e.target.value),
209
+ className: O,
210
+ "aria-label": "Report format",
211
+ children: [/* @__PURE__ */ v("option", {
212
+ value: i.Csv,
213
+ children: "CSV"
214
+ }), /* @__PURE__ */ v("option", {
215
+ value: i.Json,
216
+ children: "JSON"
217
+ })]
218
+ })]
219
+ })
220
+ ]
221
+ }),
222
+ /* @__PURE__ */ v("p", {
223
+ className: "mt-2 text-xs text-text-secondary",
224
+ children: E.description
225
+ }),
226
+ /* @__PURE__ */ y("div", {
227
+ className: "mt-4 flex flex-wrap items-center gap-3",
228
+ children: [/* @__PURE__ */ y("button", {
229
+ type: "button",
230
+ onClick: D,
231
+ disabled: T,
232
+ className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-70",
233
+ children: [T ? /* @__PURE__ */ v(_, { className: "h-4 w-4 motion-safe:animate-spin" }) : /* @__PURE__ */ v(g, { className: "h-4 w-4" }), T ? "Starting…" : "Generate report"]
234
+ }), x && /* @__PURE__ */ v("p", {
235
+ role: "alert",
236
+ className: "text-sm text-status-error-text",
237
+ children: x
238
+ })]
239
+ }),
240
+ p.length > 0 && /* @__PURE__ */ y("div", {
241
+ className: "mt-5 border-t border-border-subtle pt-4",
242
+ children: [/* @__PURE__ */ v("h3", {
243
+ className: "text-xs font-semibold uppercase tracking-wide text-text-secondary",
244
+ children: "Generated this session"
245
+ }), /* @__PURE__ */ v("ul", {
246
+ className: "mt-2 space-y-2",
247
+ children: p.map((e) => /* @__PURE__ */ v(w, { report: e }, e.jobId))
248
+ })]
249
+ })
250
+ ]
251
+ })
252
+ });
253
+ }
254
+ //#endregion
255
+ export { T as ServerReportExports };
256
+
257
+ //# sourceMappingURL=ServerReportExports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerReportExports.js","names":[],"sources":["../../../../src/timecampus/pages/dashboard/ServerReportExports.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Download, FileDown, Loader2 } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { StatusBadge, ProgressMeter } from \"../../components\";\nimport { TimeCampusExportFormat } from \"@/generated/wspace-types\";\nimport {\n useExportTimeCampusEntitiesMutation,\n useTimeCampusExportJobQuery,\n type TimeCampusExportJobFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport {\n REPORT_PERIODS,\n REPORT_TEMPLATES,\n buildReportName,\n exportStatusLabel,\n exportStatusTone,\n findReportTemplate,\n isTerminalExportStatus,\n resolveReportDateRange,\n type ReportPeriodId,\n type ReportTemplateId,\n} from \"./reportTemplates\";\n\nconst POLL_INTERVAL_MS = 3000;\n/**\n * Stop polling a job that has not settled after this long, so a stuck job\n * cannot keep the page firing requests forever. The user can resume.\n */\nconst MAX_POLL_DURATION_MS = 15 * 60 * 1000;\n\ninterface StartedReport {\n jobId: string;\n name: string;\n initial: TimeCampusExportJobFieldsFragment;\n}\n\nfunction formatTimestamp(value: string | null | undefined): string {\n if (!value) return \"\";\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? \"\" : date.toLocaleString();\n}\n\n/**\n * One generated report. Polls `timeCampusExportJob` until the job reaches a\n * terminal status, then offers the archive download.\n */\nfunction ReportJobRow({ report }: { report: StartedReport }) {\n const [settled, setSettled] = useState(\n isTerminalExportStatus(report.initial.status),\n );\n const [timedOut, setTimedOut] = useState(false);\n const [pollEpoch, setPollEpoch] = useState(0);\n const { data, error, stopPolling, startPolling, refetch } =\n useTimeCampusExportJobQuery({\n variables: { id: report.jobId },\n pollInterval: settled || timedOut ? 0 : POLL_INTERVAL_MS,\n fetchPolicy: \"network-only\",\n });\n\n const job = data?.timeCampusExportJob ?? report.initial;\n const status = job.status;\n\n useEffect(() => {\n if (isTerminalExportStatus(status) || data?.timeCampusExportJob === null) {\n stopPolling();\n setSettled(true);\n setTimedOut(false);\n }\n }, [status, data, stopPolling]);\n\n // Cap how long one job is polled. pollEpoch restarts the window when the\n // user resumes checking.\n useEffect(() => {\n if (settled) return undefined;\n const timer = window.setTimeout(() => {\n stopPolling();\n setTimedOut(true);\n }, MAX_POLL_DURATION_MS);\n return () => window.clearTimeout(timer);\n }, [settled, pollEpoch, stopPolling]);\n\n const handleResume = () => {\n setTimedOut(false);\n setPollEpoch((n) => n + 1);\n startPolling(POLL_INTERVAL_MS);\n void refetch();\n };\n\n const missing = data !== undefined && data.timeCampusExportJob === null;\n const tone = missing ? \"warning\" : exportStatusTone(status);\n const label = missing ? \"Unavailable\" : exportStatusLabel(status);\n const inFlight = !missing && !isTerminalExportStatus(status);\n\n return (\n <li\n className=\"flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-3 sm:flex-row sm:items-center sm:justify-between\"\n data-testid=\"report-export-job\"\n data-status={missing ? \"MISSING\" : status}\n >\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {report.name}\n </p>\n <StatusBadge variant={tone} label={label} dot />\n <span className=\"text-xs text-text-secondary\">{job.format}</span>\n </div>\n <p className=\"text-xs text-text-secondary\">\n Started {formatTimestamp(job.createdAt)}\n {job.completedAt\n ? ` · finished ${formatTimestamp(job.completedAt)}`\n : \"\"}\n </p>\n {inFlight && (\n <ProgressMeter\n value={job.progress ?? 0}\n max={100}\n higherIsWorse={false}\n label=\"Progress\"\n format={(v) => `${Math.round(v)}%`}\n size=\"sm\"\n />\n )}\n {status === \"FAILED\" && (\n <p className=\"text-xs text-status-error-text\">\n {job.errorMessage || \"The export failed. Try generating it again.\"}\n </p>\n )}\n {missing && (\n <p className=\"text-xs text-text-secondary\">\n This export is no longer available.\n </p>\n )}\n {timedOut && !settled && (\n <p className=\"text-xs text-text-secondary\">\n Still generating. Status checks paused to save requests; the export\n keeps running on the server.{\" \"}\n <button\n type=\"button\"\n onClick={handleResume}\n className=\"font-medium text-text-primary underline underline-offset-2\"\n >\n Check again\n </button>\n </p>\n )}\n {error && !missing && (\n <p className=\"text-xs text-status-error-text\">\n Could not refresh the export status: {error.message}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {inFlight && !timedOut && (\n <Loader2\n className=\"h-4 w-4 text-text-secondary motion-safe:animate-spin\"\n aria-hidden\n />\n )}\n {status === \"COMPLETED\" && job.downloadUrl && (\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n title={\n job.downloadExpiresAt\n ? `Link expires ${formatTimestamp(job.downloadExpiresAt)}`\n : undefined\n }\n >\n <Download className=\"h-4 w-4\" />\n Download\n </a>\n )}\n </div>\n </li>\n );\n}\n\n/**\n * Server-side report builder: pick a template, a period and a format, and\n * wspace-export-svc builds the full dataset asynchronously.\n */\nexport function ServerReportExports() {\n const [templateId, setTemplateId] =\n useState<ReportTemplateId>(\"time-entries\");\n const [period, setPeriod] = useState<ReportPeriodId>(\"30d\");\n const [format, setFormat] = useState<TimeCampusExportFormat>(\n TimeCampusExportFormat.Csv,\n );\n const [reports, setReports] = useState<StartedReport[]>([]);\n const [startError, setStartError] = useState<string | null>(null);\n const [exportEntities, { loading }] = useExportTimeCampusEntitiesMutation();\n\n const template = findReportTemplate(templateId);\n\n const handleGenerate = async () => {\n setStartError(null);\n const name = buildReportName(template, period);\n try {\n const result = await exportEntities({\n variables: {\n input: {\n entityTypes: template.entityTypes,\n format,\n includeMetadata: true,\n name,\n ...resolveReportDateRange(period),\n },\n },\n });\n const job = result.data?.exportTimeCampusEntities;\n if (!job) {\n setStartError(\"The export could not be started. Please try again.\");\n return;\n }\n setReports((prev) => [{ jobId: job.id, name, initial: job }, ...prev]);\n } catch (err) {\n setStartError(\n err instanceof Error\n ? err.message\n : \"The export could not be started. Please try again.\",\n );\n }\n };\n\n const fieldClass =\n \"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\";\n\n return (\n <section\n data-testid=\"server-report-exports\"\n aria-label=\"Generate a full report\"\n >\n <GlassCard treatment=\"glass\" className=\"p-4 sm:p-5\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-status-info-bg text-status-info-text\">\n <FileDown className=\"h-5 w-5\" />\n </div>\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-text-primary\">\n Generate a full report\n </h2>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Built on the server from your complete records, not just what this\n page has loaded. Large reports keep generating in the background;\n the download appears here when it is ready.\n </p>\n </div>\n </div>\n\n <div className=\"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-xs font-medium text-text-secondary\">\n Report\n <select\n value={templateId}\n onChange={(e) =>\n setTemplateId(e.target.value as ReportTemplateId)\n }\n className={fieldClass}\n aria-label=\"Report template\"\n >\n {REPORT_TEMPLATES.map((t) => (\n <option key={t.id} value={t.id}>\n {t.label}\n </option>\n ))}\n </select>\n </label>\n <label className=\"block text-xs font-medium text-text-secondary\">\n Period\n <select\n value={period}\n onChange={(e) => setPeriod(e.target.value as ReportPeriodId)}\n className={fieldClass}\n aria-label=\"Report period\"\n >\n {REPORT_PERIODS.map((p) => (\n <option key={p.id} value={p.id}>\n {p.label}\n </option>\n ))}\n </select>\n </label>\n <label className=\"block text-xs font-medium text-text-secondary\">\n Format\n <select\n value={format}\n onChange={(e) =>\n setFormat(e.target.value as TimeCampusExportFormat)\n }\n className={fieldClass}\n aria-label=\"Report format\"\n >\n <option value={TimeCampusExportFormat.Csv}>CSV</option>\n <option value={TimeCampusExportFormat.Json}>JSON</option>\n </select>\n </label>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {template.description}\n </p>\n\n <div className=\"mt-4 flex flex-wrap items-center gap-3\">\n <button\n type=\"button\"\n onClick={handleGenerate}\n disabled={loading}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-70\"\n >\n {loading ? (\n <Loader2 className=\"h-4 w-4 motion-safe:animate-spin\" />\n ) : (\n <FileDown className=\"h-4 w-4\" />\n )}\n {loading ? \"Starting…\" : \"Generate report\"}\n </button>\n {startError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {startError}\n </p>\n )}\n </div>\n\n {reports.length > 0 && (\n <div className=\"mt-5 border-t border-border-subtle pt-4\">\n <h3 className=\"text-xs font-semibold uppercase tracking-wide text-text-secondary\">\n Generated this session\n </h3>\n <ul className=\"mt-2 space-y-2\">\n {reports.map((report) => (\n <ReportJobRow key={report.jobId} report={report} />\n ))}\n </ul>\n </div>\n )}\n </GlassCard>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAM,IAAmB,KAKnB,IAAuB;AAQ7B,SAAS,EAAgB,GAA0C;CACjE,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAO,IAAI,KAAK,CAAK;CAC3B,OAAO,OAAO,MAAM,EAAK,QAAQ,CAAC,IAAI,KAAK,EAAK,eAAe;AACjE;AAMA,SAAS,EAAa,EAAE,aAAqC;CAC3D,IAAM,CAAC,GAAS,KAAc,EAC5B,EAAuB,EAAO,QAAQ,MAAM,CAC9C,GACM,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,CAAC,GAAW,KAAgB,EAAS,CAAC,GACtC,EAAE,SAAM,UAAO,gBAAa,iBAAc,eAC9C,EAA4B;EAC1B,WAAW,EAAE,IAAI,EAAO,MAAM;EAC9B,cAAc,KAAW,IAAW,IAAI;EACxC,aAAa;CACf,CAAC,GAEG,IAAM,GAAM,uBAAuB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entity types that wspace-export-svc can
5
+ * export; the backend (`exportTimeCampusEntities`) rejects anything else.
6
+ */
7
+ export type ReportTemplateId = "time-entries" | "projects" | "expenses" | "team" | "focus" | "meetings";
8
+ export interface ReportTemplate {
9
+ id: ReportTemplateId;
10
+ label: string;
11
+ description: string;
12
+ entityTypes: string[];
13
+ }
14
+ export declare const REPORT_TEMPLATES: readonly ReportTemplate[];
15
+ export type ReportPeriodId = "7d" | "30d" | "90d" | "ytd" | "all";
16
+ export declare const REPORT_PERIODS: ReadonlyArray<{
17
+ id: ReportPeriodId;
18
+ label: string;
19
+ }>;
20
+ export interface ReportDateRange {
21
+ dateRangeStart?: string;
22
+ dateRangeEnd?: string;
23
+ }
24
+ /** Resolve a period into the ISO date range sent to the export mutation. */
25
+ export declare function resolveReportDateRange(period: ReportPeriodId, now?: Date): ReportDateRange;
26
+ export declare function findReportTemplate(id: ReportTemplateId): ReportTemplate;
27
+ export declare function buildReportName(template: ReportTemplate, period: ReportPeriodId): string;
28
+ /** True once an export job will not change status again. */
29
+ export declare function isTerminalExportStatus(status: string | null | undefined): boolean;
30
+ export type ExportStatusTone = "info" | "success" | "warning" | "error";
31
+ export declare function exportStatusTone(status: string): ExportStatusTone;
32
+ export declare function exportStatusLabel(status: string): string;
33
+ //# sourceMappingURL=reportTemplates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportTemplates.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/dashboard/reportTemplates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,gBAAgB,GAC1B,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,gBAAgB,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EA0DrD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAElE,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC;IACzC,EAAE,EAAE,cAAc,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAMA,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,GAAG,GAAE,IAAiB,GACrB,eAAe,CAYjB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,gBAAgB,GAAG,cAAc,CAIvE;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,cAAc,GACrB,MAAM,CAIR;AAUD,4DAA4D;AAC5D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,WAEvE;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAExE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAKjE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAoBxD"}
@@ -0,0 +1,129 @@
1
+ //#region src/timecampus/pages/dashboard/reportTemplates.ts
2
+ var e = [
3
+ {
4
+ id: "time-entries",
5
+ label: "Time entries",
6
+ description: "Every logged entry with project, task, duration and billable flag.",
7
+ entityTypes: ["timecampus_time_entries"]
8
+ },
9
+ {
10
+ id: "projects",
11
+ label: "Projects & tasks",
12
+ description: "Projects, their tasks and the clients they belong to.",
13
+ entityTypes: [
14
+ "timecampus_projects",
15
+ "timecampus_tasks",
16
+ "timecampus_clients"
17
+ ]
18
+ },
19
+ {
20
+ id: "expenses",
21
+ label: "Expenses",
22
+ description: "Expense entries with amounts, categories and approval status.",
23
+ entityTypes: ["timecampus_expense_entries"]
24
+ },
25
+ {
26
+ id: "team",
27
+ label: "Team & resourcing",
28
+ description: "Resource plans, allocations and timesheet approval requests for the team.",
29
+ entityTypes: [
30
+ "timecampus_resource_plans",
31
+ "timecampus_resource_allocations",
32
+ "timecampus_time_approval_requests"
33
+ ]
34
+ },
35
+ {
36
+ id: "focus",
37
+ label: "Focus & productivity",
38
+ description: "Pomodoro sessions, focus scores, work patterns and application usage.",
39
+ entityTypes: [
40
+ "timecampus_pomodoro_sessions",
41
+ "timecampus_focus_scores",
42
+ "timecampus_work_patterns",
43
+ "timecampus_application_usages"
44
+ ]
45
+ },
46
+ {
47
+ id: "meetings",
48
+ label: "Meetings",
49
+ description: "Meetings with participants and action items.",
50
+ entityTypes: [
51
+ "timecampus_meeting_metas",
52
+ "timecampus_meeting_participants",
53
+ "timecampus_meeting_action_items"
54
+ ]
55
+ }
56
+ ], t = [
57
+ {
58
+ id: "7d",
59
+ label: "Last 7 days"
60
+ },
61
+ {
62
+ id: "30d",
63
+ label: "Last 30 days"
64
+ },
65
+ {
66
+ id: "90d",
67
+ label: "Last 90 days"
68
+ },
69
+ {
70
+ id: "ytd",
71
+ label: "This year"
72
+ },
73
+ {
74
+ id: "all",
75
+ label: "All time"
76
+ }
77
+ ], n = 864e5;
78
+ function r(e, t = /* @__PURE__ */ new Date()) {
79
+ if (e === "all") return {};
80
+ let r = t.toISOString();
81
+ if (e === "ytd") return {
82
+ dateRangeStart: new Date(t.getFullYear(), 0, 1).toISOString(),
83
+ dateRangeEnd: r
84
+ };
85
+ let i = e === "7d" ? 7 : e === "30d" ? 30 : 90;
86
+ return {
87
+ dateRangeStart: (/* @__PURE__ */ new Date(t.getTime() - i * n)).toISOString(),
88
+ dateRangeEnd: r
89
+ };
90
+ }
91
+ function i(t) {
92
+ let n = e.find((e) => e.id === t);
93
+ if (!n) throw Error(`Unknown report template: ${t}`);
94
+ return n;
95
+ }
96
+ function a(e, n) {
97
+ let r = t.find((e) => e.id === n)?.label ?? "All time";
98
+ return `${e.label} report — ${r}`;
99
+ }
100
+ var o = /* @__PURE__ */ new Set([
101
+ "COMPLETED",
102
+ "FAILED",
103
+ "CANCELLED",
104
+ "EXPIRED",
105
+ "DELETED"
106
+ ]);
107
+ function s(e) {
108
+ return !!e && o.has(e);
109
+ }
110
+ function c(e) {
111
+ return e === "COMPLETED" ? "success" : e === "FAILED" ? "error" : o.has(e) ? "warning" : "info";
112
+ }
113
+ function l(e) {
114
+ switch (e) {
115
+ case "CREATED":
116
+ case "QUEUED": return "Queued";
117
+ case "RUNNING": return "Generating";
118
+ case "COMPLETED": return "Ready";
119
+ case "FAILED": return "Failed";
120
+ case "CANCELLED": return "Cancelled";
121
+ case "EXPIRED": return "Link expired";
122
+ case "DELETED": return "Deleted";
123
+ default: return e;
124
+ }
125
+ }
126
+ //#endregion
127
+ export { t as REPORT_PERIODS, e as REPORT_TEMPLATES, a as buildReportName, l as exportStatusLabel, c as exportStatusTone, i as findReportTemplate, s as isTerminalExportStatus, r as resolveReportDateRange };
128
+
129
+ //# sourceMappingURL=reportTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportTemplates.js","names":[],"sources":["../../../../src/timecampus/pages/dashboard/reportTemplates.ts"],"sourcesContent":["/**\n * Server-side report templates for the Reports page (BOFF-4043).\n *\n * Each template maps to TimeCampus entity types that wspace-export-svc can\n * export; the backend (`exportTimeCampusEntities`) rejects anything else.\n */\n\nexport type ReportTemplateId =\n \"time-entries\" | \"projects\" | \"expenses\" | \"team\" | \"focus\" | \"meetings\";\n\nexport interface ReportTemplate {\n id: ReportTemplateId;\n label: string;\n description: string;\n entityTypes: string[];\n}\n\nexport const REPORT_TEMPLATES: readonly ReportTemplate[] = [\n {\n id: \"time-entries\",\n label: \"Time entries\",\n description:\n \"Every logged entry with project, task, duration and billable flag.\",\n entityTypes: [\"timecampus_time_entries\"],\n },\n {\n id: \"projects\",\n label: \"Projects & tasks\",\n description: \"Projects, their tasks and the clients they belong to.\",\n entityTypes: [\n \"timecampus_projects\",\n \"timecampus_tasks\",\n \"timecampus_clients\",\n ],\n },\n {\n id: \"expenses\",\n label: \"Expenses\",\n description:\n \"Expense entries with amounts, categories and approval status.\",\n entityTypes: [\"timecampus_expense_entries\"],\n },\n {\n id: \"team\",\n label: \"Team & resourcing\",\n description:\n \"Resource plans, allocations and timesheet approval requests for the team.\",\n entityTypes: [\n \"timecampus_resource_plans\",\n \"timecampus_resource_allocations\",\n \"timecampus_time_approval_requests\",\n ],\n },\n {\n id: \"focus\",\n label: \"Focus & productivity\",\n description:\n \"Pomodoro sessions, focus scores, work patterns and application usage.\",\n entityTypes: [\n \"timecampus_pomodoro_sessions\",\n \"timecampus_focus_scores\",\n \"timecampus_work_patterns\",\n \"timecampus_application_usages\",\n ],\n },\n {\n id: \"meetings\",\n label: \"Meetings\",\n description: \"Meetings with participants and action items.\",\n entityTypes: [\n \"timecampus_meeting_metas\",\n \"timecampus_meeting_participants\",\n \"timecampus_meeting_action_items\",\n ],\n },\n];\n\nexport type ReportPeriodId = \"7d\" | \"30d\" | \"90d\" | \"ytd\" | \"all\";\n\nexport const REPORT_PERIODS: ReadonlyArray<{\n id: ReportPeriodId;\n label: string;\n}> = [\n { id: \"7d\", label: \"Last 7 days\" },\n { id: \"30d\", label: \"Last 30 days\" },\n { id: \"90d\", label: \"Last 90 days\" },\n { id: \"ytd\", label: \"This year\" },\n { id: \"all\", label: \"All time\" },\n];\n\nexport interface ReportDateRange {\n dateRangeStart?: string;\n dateRangeEnd?: string;\n}\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\n/** Resolve a period into the ISO date range sent to the export mutation. */\nexport function resolveReportDateRange(\n period: ReportPeriodId,\n now: Date = new Date(),\n): ReportDateRange {\n if (period === \"all\") return {};\n const end = now.toISOString();\n if (period === \"ytd\") {\n const start = new Date(now.getFullYear(), 0, 1);\n return { dateRangeStart: start.toISOString(), dateRangeEnd: end };\n }\n const days = period === \"7d\" ? 7 : period === \"30d\" ? 30 : 90;\n return {\n dateRangeStart: new Date(now.getTime() - days * DAY_MS).toISOString(),\n dateRangeEnd: end,\n };\n}\n\nexport function findReportTemplate(id: ReportTemplateId): ReportTemplate {\n const template = REPORT_TEMPLATES.find((t) => t.id === id);\n if (!template) throw new Error(`Unknown report template: ${id}`);\n return template;\n}\n\nexport function buildReportName(\n template: ReportTemplate,\n period: ReportPeriodId,\n): string {\n const periodLabel =\n REPORT_PERIODS.find((p) => p.id === period)?.label ?? \"All time\";\n return `${template.label} report — ${periodLabel}`;\n}\n\nconst TERMINAL_STATUSES = new Set([\n \"COMPLETED\",\n \"FAILED\",\n \"CANCELLED\",\n \"EXPIRED\",\n \"DELETED\",\n]);\n\n/** True once an export job will not change status again. */\nexport function isTerminalExportStatus(status: string | null | undefined) {\n return !!status && TERMINAL_STATUSES.has(status);\n}\n\nexport type ExportStatusTone = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport function exportStatusTone(status: string): ExportStatusTone {\n if (status === \"COMPLETED\") return \"success\";\n if (status === \"FAILED\") return \"error\";\n if (TERMINAL_STATUSES.has(status)) return \"warning\";\n return \"info\";\n}\n\nexport function exportStatusLabel(status: string): string {\n switch (status) {\n case \"CREATED\":\n case \"QUEUED\":\n return \"Queued\";\n case \"RUNNING\":\n return \"Generating\";\n case \"COMPLETED\":\n return \"Ready\";\n case \"FAILED\":\n return \"Failed\";\n case \"CANCELLED\":\n return \"Cancelled\";\n case \"EXPIRED\":\n return \"Link expired\";\n case \"DELETED\":\n return \"Deleted\";\n default:\n return status;\n }\n}\n"],"mappings":";AAiBA,IAAa,IAA8C;CACzD;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,aAAa,CAAC,yBAAyB;CACzC;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,aAAa;GACX;GACA;GACA;EACF;CACF;C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AI;CAChC;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,SAAgB,EAAuB,GAAmC;CACxE,OAAO,CAAC,CAAC,KAAU,EAAkB,IAAI,CAAM;AACjD;AAIA,SAAgB,EAAiB,GAAkC;CAIjE,OAHI,MAAW,cAAoB,YAC/B,MAAW,WAAiB,UAC5B,EAAkB,IAAI,CAAM,IAAU,YACnC;AACT;AAEA,SAAgB,EAAkB,GAAwB;CACxD,QAAQ,GAAR;EACE,KAAK;EACL,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"PersonalCorporatePage.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/lifetime/PersonalCorporatePage.tsx"],"names":[],"mappings":"AA8HA,wBAAgB,qBAAqB,gCAijBpC"}
1
+ {"version":3,"file":"PersonalCorporatePage.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/lifetime/PersonalCorporatePage.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,qBAAqB,gCAijBpC"}